@buoy-gg/assets 7.0.41 → 7.0.43
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 +12 -73
- package/bundlers/vite.mjs +1 -53
- package/lib/commonjs/autoCapture.js +1 -5
- package/lib/commonjs/autoCapture.web.js +1 -6
- package/lib/commonjs/capture/assetLifecycle.js +1 -11
- package/lib/commonjs/capture/assetLifecycle.web.js +1 -20
- package/lib/commonjs/capture/browserAssets.js +1 -83
- package/lib/commonjs/capture/expo.js +1 -46
- package/lib/commonjs/capture/expo.web.js +1 -19
- package/lib/commonjs/capture/install.js +1 -91
- package/lib/commonjs/capture/install.web.js +1 -75
- package/lib/commonjs/capture/isBuoyAsset.js +1 -23
- package/lib/commonjs/capture/measure.js +1 -187
- package/lib/commonjs/capture/metroGraph.js +1 -175
- package/lib/commonjs/capture/metroGraph.web.js +1 -27
- package/lib/commonjs/capture/registry.js +1 -127
- package/lib/commonjs/components/AssetDetail.js +1 -211
- package/lib/commonjs/components/AssetImage.js +1 -66
- package/lib/commonjs/components/AssetRow.js +1 -232
- package/lib/commonjs/components/AssetsFilterBar.js +1 -105
- package/lib/commonjs/components/AssetsHeader.js +1 -73
- package/lib/commonjs/components/AssetsIcon.js +1 -19
- package/lib/commonjs/components/AssetsListControls.js +1 -81
- package/lib/commonjs/components/AssetsModal.js +1 -378
- package/lib/commonjs/components/ScanNotice.js +1 -86
- package/lib/commonjs/components/optionalExpoImage.js +1 -16
- package/lib/commonjs/components/optionalExpoImage.web.js +1 -10
- package/lib/commonjs/export.js +1 -62
- package/lib/commonjs/format.js +1 -59
- package/lib/commonjs/hooks/useAssetRecords.js +1 -22
- package/lib/commonjs/hooks/useAssetScanStatus.js +1 -28
- package/lib/commonjs/index.js +1 -294
- package/lib/commonjs/preset.js +1 -39
- package/lib/commonjs/remote.js +1 -68
- package/lib/commonjs/state.js +1 -51
- package/lib/commonjs/store/assetStore.js +1 -256
- package/lib/commonjs/store/baseline.js +1 -175
- package/lib/commonjs/store/insights.js +1 -120
- package/lib/commonjs/sync/assetsSyncAdapter.js +1 -157
- package/lib/commonjs/types.js +0 -1
- package/lib/commonjs/utils/deviceScale.js +1 -50
- package/lib/commonjs/utils/testIDs.js +1 -110
- package/lib/module/autoCapture.js +1 -5
- package/lib/module/autoCapture.web.js +1 -5
- package/lib/module/capture/assetLifecycle.js +1 -7
- package/lib/module/capture/assetLifecycle.web.js +1 -16
- package/lib/module/capture/browserAssets.js +1 -75
- package/lib/module/capture/expo.js +1 -41
- package/lib/module/capture/expo.web.js +1 -14
- package/lib/module/capture/install.js +1 -85
- package/lib/module/capture/install.web.js +1 -68
- package/lib/module/capture/isBuoyAsset.js +1 -18
- package/lib/module/capture/measure.js +1 -180
- package/lib/module/capture/metroGraph.js +1 -168
- package/lib/module/capture/metroGraph.web.js +1 -21
- package/lib/module/capture/registry.js +1 -120
- package/lib/module/components/AssetDetail.js +1 -207
- package/lib/module/components/AssetImage.js +1 -62
- package/lib/module/components/AssetRow.js +1 -228
- package/lib/module/components/AssetsFilterBar.js +1 -101
- package/lib/module/components/AssetsHeader.js +1 -69
- package/lib/module/components/AssetsIcon.js +1 -12
- package/lib/module/components/AssetsListControls.js +1 -77
- package/lib/module/components/AssetsModal.js +1 -373
- package/lib/module/components/ScanNotice.js +1 -82
- package/lib/module/components/optionalExpoImage.js +1 -12
- package/lib/module/components/optionalExpoImage.web.js +1 -6
- package/lib/module/export.js +1 -57
- package/lib/module/format.js +1 -51
- package/lib/module/hooks/useAssetRecords.js +1 -18
- package/lib/module/hooks/useAssetScanStatus.js +1 -23
- package/lib/module/index.js +1 -64
- package/lib/module/preset.js +1 -35
- package/lib/module/remote.js +1 -61
- package/lib/module/state.js +1 -47
- package/lib/module/store/assetStore.js +1 -240
- package/lib/module/store/baseline.js +1 -167
- package/lib/module/store/insights.js +1 -116
- package/lib/module/sync/assetsSyncAdapter.js +1 -153
- package/lib/module/types.js +0 -1
- package/lib/module/utils/deviceScale.js +1 -46
- package/lib/module/utils/testIDs.js +1 -99
- package/lib/web/index.mjs +3 -4
- package/package.json +3 -8
- package/lib/commonjs/autoCapture.js.map +0 -1
- package/lib/commonjs/autoCapture.web.js.map +0 -1
- package/lib/commonjs/capture/assetLifecycle.js.map +0 -1
- package/lib/commonjs/capture/assetLifecycle.web.js.map +0 -1
- package/lib/commonjs/capture/browserAssets.js.map +0 -1
- package/lib/commonjs/capture/expo.js.map +0 -1
- package/lib/commonjs/capture/expo.web.js.map +0 -1
- package/lib/commonjs/capture/install.js.map +0 -1
- package/lib/commonjs/capture/install.web.js.map +0 -1
- package/lib/commonjs/capture/isBuoyAsset.js.map +0 -1
- package/lib/commonjs/capture/measure.js.map +0 -1
- package/lib/commonjs/capture/metroGraph.js.map +0 -1
- package/lib/commonjs/capture/metroGraph.web.js.map +0 -1
- package/lib/commonjs/capture/registry.js.map +0 -1
- package/lib/commonjs/components/AssetDetail.js.map +0 -1
- package/lib/commonjs/components/AssetImage.js.map +0 -1
- package/lib/commonjs/components/AssetRow.js.map +0 -1
- package/lib/commonjs/components/AssetsFilterBar.js.map +0 -1
- package/lib/commonjs/components/AssetsHeader.js.map +0 -1
- package/lib/commonjs/components/AssetsIcon.js.map +0 -1
- package/lib/commonjs/components/AssetsListControls.js.map +0 -1
- package/lib/commonjs/components/AssetsModal.js.map +0 -1
- package/lib/commonjs/components/ScanNotice.js.map +0 -1
- package/lib/commonjs/components/optionalExpoImage.js.map +0 -1
- package/lib/commonjs/components/optionalExpoImage.web.js.map +0 -1
- package/lib/commonjs/export.js.map +0 -1
- package/lib/commonjs/format.js.map +0 -1
- package/lib/commonjs/hooks/useAssetRecords.js.map +0 -1
- package/lib/commonjs/hooks/useAssetScanStatus.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/state.js.map +0 -1
- package/lib/commonjs/store/assetStore.js.map +0 -1
- package/lib/commonjs/store/baseline.js.map +0 -1
- package/lib/commonjs/store/insights.js.map +0 -1
- package/lib/commonjs/sync/assetsSyncAdapter.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/deviceScale.js.map +0 -1
- package/lib/commonjs/utils/testIDs.js.map +0 -1
- package/lib/module/autoCapture.js.map +0 -1
- package/lib/module/autoCapture.web.js.map +0 -1
- package/lib/module/capture/assetLifecycle.js.map +0 -1
- package/lib/module/capture/assetLifecycle.web.js.map +0 -1
- package/lib/module/capture/browserAssets.js.map +0 -1
- package/lib/module/capture/expo.js.map +0 -1
- package/lib/module/capture/expo.web.js.map +0 -1
- package/lib/module/capture/install.js.map +0 -1
- package/lib/module/capture/install.web.js.map +0 -1
- package/lib/module/capture/isBuoyAsset.js.map +0 -1
- package/lib/module/capture/measure.js.map +0 -1
- package/lib/module/capture/metroGraph.js.map +0 -1
- package/lib/module/capture/metroGraph.web.js.map +0 -1
- package/lib/module/capture/registry.js.map +0 -1
- package/lib/module/components/AssetDetail.js.map +0 -1
- package/lib/module/components/AssetImage.js.map +0 -1
- package/lib/module/components/AssetRow.js.map +0 -1
- package/lib/module/components/AssetsFilterBar.js.map +0 -1
- package/lib/module/components/AssetsHeader.js.map +0 -1
- package/lib/module/components/AssetsIcon.js.map +0 -1
- package/lib/module/components/AssetsListControls.js.map +0 -1
- package/lib/module/components/AssetsModal.js.map +0 -1
- package/lib/module/components/ScanNotice.js.map +0 -1
- package/lib/module/components/optionalExpoImage.js.map +0 -1
- package/lib/module/components/optionalExpoImage.web.js.map +0 -1
- package/lib/module/export.js.map +0 -1
- package/lib/module/format.js.map +0 -1
- package/lib/module/hooks/useAssetRecords.js.map +0 -1
- package/lib/module/hooks/useAssetScanStatus.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/remote.js.map +0 -1
- package/lib/module/state.js.map +0 -1
- package/lib/module/store/assetStore.js.map +0 -1
- package/lib/module/store/baseline.js.map +0 -1
- package/lib/module/store/insights.js.map +0 -1
- package/lib/module/sync/assetsSyncAdapter.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/deviceScale.js.map +0 -1
- package/lib/module/utils/testIDs.js.map +0 -1
- package/lib/typescript/autoCapture.d.ts.map +0 -1
- package/lib/typescript/autoCapture.web.d.ts.map +0 -1
- package/lib/typescript/capture/assetLifecycle.d.ts.map +0 -1
- package/lib/typescript/capture/assetLifecycle.web.d.ts.map +0 -1
- package/lib/typescript/capture/browserAssets.d.ts.map +0 -1
- package/lib/typescript/capture/expo.d.ts.map +0 -1
- package/lib/typescript/capture/expo.web.d.ts.map +0 -1
- package/lib/typescript/capture/install.d.ts.map +0 -1
- package/lib/typescript/capture/install.web.d.ts.map +0 -1
- package/lib/typescript/capture/isBuoyAsset.d.ts.map +0 -1
- package/lib/typescript/capture/measure.d.ts.map +0 -1
- package/lib/typescript/capture/metroGraph.d.ts.map +0 -1
- package/lib/typescript/capture/metroGraph.web.d.ts.map +0 -1
- package/lib/typescript/capture/registry.d.ts.map +0 -1
- package/lib/typescript/components/AssetDetail.d.ts.map +0 -1
- package/lib/typescript/components/AssetImage.d.ts.map +0 -1
- package/lib/typescript/components/AssetRow.d.ts.map +0 -1
- package/lib/typescript/components/AssetsFilterBar.d.ts.map +0 -1
- package/lib/typescript/components/AssetsHeader.d.ts.map +0 -1
- package/lib/typescript/components/AssetsIcon.d.ts.map +0 -1
- package/lib/typescript/components/AssetsListControls.d.ts.map +0 -1
- package/lib/typescript/components/AssetsModal.d.ts.map +0 -1
- package/lib/typescript/components/ScanNotice.d.ts.map +0 -1
- package/lib/typescript/components/optionalExpoImage.d.ts.map +0 -1
- package/lib/typescript/components/optionalExpoImage.web.d.ts.map +0 -1
- package/lib/typescript/export.d.ts.map +0 -1
- package/lib/typescript/format.d.ts.map +0 -1
- package/lib/typescript/hooks/useAssetRecords.d.ts.map +0 -1
- package/lib/typescript/hooks/useAssetScanStatus.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/remote.d.ts.map +0 -1
- package/lib/typescript/state.d.ts.map +0 -1
- package/lib/typescript/store/assetStore.d.ts.map +0 -1
- package/lib/typescript/store/baseline.d.ts.map +0 -1
- package/lib/typescript/store/insights.d.ts.map +0 -1
- package/lib/typescript/sync/assetsSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/deviceScale.d.ts.map +0 -1
- package/lib/typescript/utils/testIDs.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,88 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @buoy-gg/assets
|
|
4
4
|
|
|
5
5
|
Inspect assets visible to the runtime registry and, in development, the Metro dependency graph. Compare sizes and find possible duplicates.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/assets"><b>Assets guide</b></a> · <a href="https://buoy.gg">buoy.gg</a> · <a href="https://github.com/Buoy-gg/buoy">All tools</a>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Install
|
|
9
|
+
[](https://www.npmjs.com/package/@buoy-gg/assets) [](https://www.npmjs.com/package/@buoy-gg/assets)
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
npm install @buoy-gg/core @buoy-gg/assets
|
|
15
|
-
```
|
|
11
|
+
<a href="https://buoy.gg/buoy/latest/docs/tools/assets"><img src="https://raw.githubusercontent.com/Buoy-gg/buoy/main/.github/readme/tools/assets.png" alt="Watch the Assets film on buoy.gg" width="640" /></a>
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
</div>
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
## Install
|
|
20
16
|
|
|
21
17
|
```bash
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
For Expo, initialize Buoy before rendering the menu:
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
import { Buoy } from "@buoy-gg/core";
|
|
29
|
-
|
|
30
|
-
Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
|
|
34
|
-
|
|
35
|
-
## Quick start
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { FloatingDevTools } from "@buoy-gg/core";
|
|
39
|
-
|
|
40
|
-
export default function App() {
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
<YourApp />
|
|
44
|
-
<FloatingDevTools />
|
|
45
|
-
</>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
18
|
+
npm install @buoy-gg/core @buoy-gg/assets
|
|
48
19
|
```
|
|
49
20
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Buoy's own package assets are excluded from the inventory and its totals. App assets and assets from other libraries remain visible.
|
|
53
|
-
|
|
54
|
-
SVG thumbnails and detail previews use `expo-image` when it is installed and available in the native app. It is an optional peer; `react-native-svg` is not required. Without a compatible renderer, the tool shows a preview-unavailable label. Desktop and web use browser image rendering. Some SVG paths may not render correctly with the iOS system decoder.
|
|
55
|
-
|
|
56
|
-
Registered assets appear immediately. A spinner and a "found so far" count stay visible while the tool queries the development server for more assets. After eight seconds, a message explains that discovery is taking longer than usual. Size checks run afterward. If discovery fails or exceeds 90 seconds, the existing list stays available with a Retry button.
|
|
57
|
-
|
|
58
|
-
## Check the integration
|
|
59
|
-
|
|
60
|
-
Find a known bundled asset and compare its source and dimensions. “Not observed” means not seen in React Native’s asset registry during this app run; it does not prove an asset is unused or safe to delete. Runtime coverage is not a complete inventory of native resources.
|
|
61
|
-
|
|
62
|
-
## What you get
|
|
63
|
-
|
|
64
|
-
- **Inventory, largest first** — discovered assets with a thumbnail, dimensions, `@1x/@2x/@3x` scale coverage, and its size. Filter by kind, search by name, sort by size/name/type
|
|
65
|
-
- **Size information** — development builds can measure available variants through Metro. Release decoded-memory estimates are not encoded file sizes
|
|
66
|
-
- **Unobserved assets** — compare the available development bundle graph with assets registered during the session. Review candidates before deleting them
|
|
67
|
-
- **Duplicate content** — identical bytes shipped under different names, flagged by content hash (one of the cheapest app-size wins there is)
|
|
68
|
-
- **Audit findings** — images that decode larger than the device screen, heavy GIFs (every frame decodes into memory), unsubset icon fonts, WebP conversion candidates, missing/broken scale variants
|
|
69
|
-
- **Loaded font families** — build-time embedded and runtime loaded (via the expo-font native module when present)
|
|
70
|
-
- **Markdown report** — the full inventory with findings, ready to paste into an issue or PR
|
|
71
|
-
|
|
72
|
-
## How it relates to @buoy-gg/images
|
|
73
|
-
|
|
74
|
-
[`@buoy-gg/images`](https://www.npmjs.com/package/@buoy-gg/images) shows what your app **renders** at runtime — per-load cache verdicts, timings, failures. Assets inspects the available asset inventory. Use both views to investigate loading behavior and bundle size.
|
|
75
|
-
|
|
76
|
-
## Desktop & AI
|
|
77
|
-
|
|
78
|
-
To connect a React Native app to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) or MCP, install `@buoy-gg/external-sync` and follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop). Sign in to Desktop separately. [MCP setup](https://buoy.gg/buoy/latest/docs/mcp) also requires a process account and Pro access. Available remote actions depend on the tool and app integration.
|
|
79
|
-
|
|
80
|
-
## Account and plan requirements
|
|
81
|
-
|
|
82
|
-
Use a Free or Pro Buoy account. History limits and paid features vary by tool; see [pricing](https://buoy.gg/pricing). Production access requires Pro where supported. Development-only hooks and actions remain unavailable in release builds.
|
|
21
|
+
Assets appears in the menu once installed. SVG previews use `expo-image` when it's available.
|
|
83
22
|
|
|
84
|
-
|
|
23
|
+
The [Assets guide](https://buoy.gg/buoy/latest/docs/tools/assets) covers setup, what it captures and its limits. New to Buoy? Start with the [Quick start](https://buoy.gg/buoy/latest/docs/quick-start).
|
|
85
24
|
|
|
86
|
-
|
|
25
|
+
---
|
|
87
26
|
|
|
88
|
-
|
|
27
|
+
<sub>Part of <a href="https://buoy.gg">Buoy</a>, developer tools that live inside your app. Proprietary software. © Buoy LLC. <a href="https://buoy.gg/terms">Terms</a></sub>
|
package/bundlers/vite.mjs
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
|
|
5
|
-
const media = /\.(?:avif|gif|jpe?g|png|svg|webp|ico|woff2?|ttf|otf|eot|mp[34]|m4a|ogg|wav|webm|pdf)$/i;
|
|
6
|
-
const digest = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
7
|
-
|
|
8
|
-
/** Include unrequested assets in Buoy's inventory without downloading them. */
|
|
9
|
-
export function buoyAssets({ filename = 'buoy-assets.json' } = {}) {
|
|
10
|
-
let config;
|
|
11
|
-
const publicEntries = async () => {
|
|
12
|
-
if (!config.publicDir) return [];
|
|
13
|
-
const entries = [];
|
|
14
|
-
async function walk(directory) {
|
|
15
|
-
let children;
|
|
16
|
-
try { children = await readdir(directory, { withFileTypes: true }); }
|
|
17
|
-
catch (error) { if (error.code === 'ENOENT') return; throw error; }
|
|
18
|
-
for (const child of children) {
|
|
19
|
-
const file = path.join(directory, child.name);
|
|
20
|
-
if (child.isDirectory()) await walk(file);
|
|
21
|
-
else if (child.isFile() && media.test(child.name)) {
|
|
22
|
-
const bytes = await readFile(file);
|
|
23
|
-
entries.push({ url: `${config.base}${path.relative(config.publicDir, file).split(path.sep).map(encodeURIComponent).join('/')}`, bytes: bytes.length, hash: digest(bytes) });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
await walk(config.publicDir);
|
|
28
|
-
return entries;
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
name: 'buoy-asset-manifest',
|
|
32
|
-
configResolved(value) { config = value; },
|
|
33
|
-
configureServer(server) {
|
|
34
|
-
server.middlewares.use(async (request, response, next) => {
|
|
35
|
-
if (request.url?.split('?')[0] !== `${config.base}${filename}`) return next();
|
|
36
|
-
try {
|
|
37
|
-
response.setHeader('Content-Type', 'application/json');
|
|
38
|
-
response.setHeader('Cache-Control', 'no-store');
|
|
39
|
-
response.end(JSON.stringify(await publicEntries()));
|
|
40
|
-
} catch (error) { next(error); }
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
async generateBundle(_options, bundle) {
|
|
44
|
-
const assets = await publicEntries();
|
|
45
|
-
for (const entry of Object.values(bundle)) {
|
|
46
|
-
if (entry.type !== 'asset' || entry.fileName === filename) continue;
|
|
47
|
-
const bytes = typeof entry.source === 'string' ? Buffer.from(entry.source) : entry.source;
|
|
48
|
-
assets.push({ url: `${config.base}${entry.fileName}`, bytes: bytes.length, hash: digest(bytes) });
|
|
49
|
-
}
|
|
50
|
-
this.emitFile({ type: 'asset', fileName: filename, source: JSON.stringify(assets) });
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
1
|
+
import{readdir as p,readFile as y}from"node:fs/promises";import{createHash as h}from"node:crypto";import c from"node:path";const m=/\.(?:avif|gif|jpe?g|png|svg|webp|ico|woff2?|ttf|otf|eot|mp[34]|m4a|ogg|wav|webm|pdf)$/i;const l=a=>h("sha256").update(a).digest("hex");export function buoyAssets({filename:a="buoy-assets.json"}={}){let i;const f=async()=>{if(!i.publicDir)return[];const r=[];async function o(s){let e;try{e=await p(s,{withFileTypes:true})}catch(t){if(t.code==="ENOENT")return;throw t}for(const t of e){const n=c.join(s,t.name);if(t.isDirectory())await o(n);else if(t.isFile()&&m.test(t.name)){const u=await y(n);r.push({url:`${i.base}${c.relative(i.publicDir,n).split(c.sep).map(encodeURIComponent).join("/")}`,bytes:u.length,hash:l(u)})}}}await o(i.publicDir);return r};return{name:"buoy-asset-manifest",configResolved(r){i=r},configureServer(r){r.middlewares.use(async(o,s,e)=>{if(o.url?.split("?")[0]!==`${i.base}${a}`)return e();try{s.setHeader("Content-Type","application/json");s.setHeader("Cache-Control","no-store");s.end(JSON.stringify(await f()))}catch(t){e(t)}})},async generateBundle(r,o){const s=await f();for(const e of Object.values(o)){if(e.type!=="asset"||e.fileName===a)continue;const t=typeof e.source==="string"?Buffer.from(e.source):e.source;s.push({url:`${i.base}${e.fileName}`,bytes:t.length,hash:l(t)})}this.emitFile({type:"asset",fileName:a,source:JSON.stringify(s)})}}}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.startBrowserAssetCapture = startBrowserAssetCapture;
|
|
7
|
-
/** Native asset capture starts when the package is imported. */
|
|
8
|
-
function startBrowserAssetCapture() {
|
|
9
|
-
return () => {};
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=assetLifecycle.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.startBrowserAssetCapture=startBrowserAssetCapture;function startBrowserAssetCapture(){return()=>{}}
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.startBrowserAssetCapture = startBrowserAssetCapture;
|
|
7
|
-
var _install = require("./install.web");
|
|
8
|
-
let owners = 0;
|
|
9
|
-
function startBrowserAssetCapture() {
|
|
10
|
-
if (typeof document === 'undefined') return () => {};
|
|
11
|
-
if (++owners === 1) (0, _install.installAssetCapture)();
|
|
12
|
-
let active = true;
|
|
13
|
-
return () => {
|
|
14
|
-
if (active) {
|
|
15
|
-
active = false;
|
|
16
|
-
if (--owners === 0) (0, _install.stopBrowserAssetCapture)();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=assetLifecycle.web.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.startBrowserAssetCapture=startBrowserAssetCapture;var _install=require("./install.web");let owners=0;function startBrowserAssetCapture(){if(typeof document==="undefined")return()=>{};if(++owners===1)(0,_install.installAssetCapture)();let e=true;return()=>{if(e){e=false;if(--owners===0)(0,_install.stopBrowserAssetCapture)()}}}
|
|
@@ -1,83 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.captureBrowserResource = captureBrowserResource;
|
|
7
|
-
exports.getBrowserAssetManifest = getBrowserAssetManifest;
|
|
8
|
-
exports.loadBrowserAssetManifest = loadBrowserAssetManifest;
|
|
9
|
-
exports.registerBrowserAssetManifest = registerBrowserAssetManifest;
|
|
10
|
-
exports.scanBrowserAssets = scanBrowserAssets;
|
|
11
|
-
var _state = require("../state");
|
|
12
|
-
var _assetStore = require("../store/assetStore");
|
|
13
|
-
let manifest = [];
|
|
14
|
-
function registerBrowserAssetManifest(assets) {
|
|
15
|
-
manifest = assets;
|
|
16
|
-
if (typeof document !== 'undefined') scanBrowserAssets();
|
|
17
|
-
}
|
|
18
|
-
function getBrowserAssetManifest() {
|
|
19
|
-
return manifest;
|
|
20
|
-
}
|
|
21
|
-
async function loadBrowserAssetManifest(url) {
|
|
22
|
-
const response = await fetch(url);
|
|
23
|
-
if (!response.ok) throw new Error(`Asset manifest returned HTTP ${response.status}.`);
|
|
24
|
-
const assets = await response.json();
|
|
25
|
-
if (!Array.isArray(assets) || assets.some(asset => !asset || typeof asset.url !== 'string')) throw new Error('An asset manifest must contain an array of assets with URL strings.');
|
|
26
|
-
registerBrowserAssetManifest(assets);
|
|
27
|
-
}
|
|
28
|
-
function upsert(asset, loaded) {
|
|
29
|
-
let url;
|
|
30
|
-
try {
|
|
31
|
-
url = new URL(asset.url, document.baseURI);
|
|
32
|
-
} catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const filename = url.pathname.split('/').pop() ?? '';
|
|
36
|
-
const type = filename.includes('.') ? filename.split('.').pop().toLowerCase() : 'other';
|
|
37
|
-
const record = (0, _assetStore.upsertRecord)({
|
|
38
|
-
key: url.href,
|
|
39
|
-
name: filename.slice(0, -(type.length + 1)) || filename,
|
|
40
|
-
type,
|
|
41
|
-
origin: loaded ? 'browser' : 'graph',
|
|
42
|
-
resolvedUri: url.href,
|
|
43
|
-
resolvedScale: 1,
|
|
44
|
-
scales: [1],
|
|
45
|
-
hash: asset.hash,
|
|
46
|
-
loaded,
|
|
47
|
-
width: asset.width,
|
|
48
|
-
height: asset.height
|
|
49
|
-
});
|
|
50
|
-
if (record && asset.bytes !== undefined && asset.bytes >= 0) (0, _assetStore.updateRecord)(record.id, {
|
|
51
|
-
sizeBytes: asset.bytes,
|
|
52
|
-
sizesByScale: {
|
|
53
|
-
'1': asset.bytes
|
|
54
|
-
},
|
|
55
|
-
sizeSource: 'measured'
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function captureBrowserResource(entry) {
|
|
59
|
-
// Fetch/XHR traffic belongs to Network. Styles, fonts and media belong here.
|
|
60
|
-
if (entry.initiatorType === 'fetch' || entry.initiatorType === 'xmlhttprequest') return;
|
|
61
|
-
upsert({
|
|
62
|
-
url: entry.name,
|
|
63
|
-
bytes: entry.encodedBodySize > 0 ? entry.encodedBodySize : undefined
|
|
64
|
-
}, true);
|
|
65
|
-
}
|
|
66
|
-
function scanBrowserAssets() {
|
|
67
|
-
if (typeof document === 'undefined' || (0, _state.assetsState)().captureDisabled) return;
|
|
68
|
-
manifest.forEach(asset => upsert(asset, false));
|
|
69
|
-
performance.getEntriesByType('resource').forEach(entry => captureBrowserResource(entry));
|
|
70
|
-
document.querySelectorAll('img').forEach(image => {
|
|
71
|
-
if (!image.closest('[data-buoy-root]') && image.currentSrc) upsert({
|
|
72
|
-
url: image.currentSrc,
|
|
73
|
-
width: image.naturalWidth || undefined,
|
|
74
|
-
height: image.naturalHeight || undefined
|
|
75
|
-
}, image.complete && image.naturalWidth > 0);
|
|
76
|
-
});
|
|
77
|
-
const state = (0, _state.assetsState)();
|
|
78
|
-
state.graphSupported = manifest.length > 0;
|
|
79
|
-
state.graphCount = manifest.length > 0 ? manifest.length : null;
|
|
80
|
-
state.measuredCount = state.records.filter(record => record.sizeBytes !== undefined).length;
|
|
81
|
-
state.lastScanAt = Date.now();
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=browserAssets.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.captureBrowserResource=captureBrowserResource;exports.getBrowserAssetManifest=getBrowserAssetManifest;exports.loadBrowserAssetManifest=loadBrowserAssetManifest;exports.registerBrowserAssetManifest=registerBrowserAssetManifest;exports.scanBrowserAssets=scanBrowserAssets;var _state=require("../state");var _assetStore=require("../store/assetStore");let manifest=[];function registerBrowserAssetManifest(e){manifest=e;if(typeof document!=="undefined")scanBrowserAssets()}function getBrowserAssetManifest(){return manifest}async function loadBrowserAssetManifest(e){const t=await fetch(e);if(!t.ok)throw new Error(`Asset manifest returned HTTP ${t.status}.`);const r=await t.json();if(!Array.isArray(r)||r.some(s=>!s||typeof s.url!=="string"))throw new Error("An asset manifest must contain an array of assets with URL strings.");registerBrowserAssetManifest(r)}function upsert(e,t){let r;try{r=new URL(e.url,document.baseURI)}catch{return}const s=r.pathname.split("/").pop()??"";const n=s.includes(".")?s.split(".").pop().toLowerCase():"other";const o=(0,_assetStore.upsertRecord)({key:r.href,name:s.slice(0,-(n.length+1))||s,type:n,origin:t?"browser":"graph",resolvedUri:r.href,resolvedScale:1,scales:[1],hash:e.hash,loaded:t,width:e.width,height:e.height});if(o&&e.bytes!==void 0&&e.bytes>=0)(0,_assetStore.updateRecord)(o.id,{sizeBytes:e.bytes,sizesByScale:{"1":e.bytes},sizeSource:"measured"})}function captureBrowserResource(e){if(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")return;upsert({url:e.name,bytes:e.encodedBodySize>0?e.encodedBodySize:void 0},true)}function scanBrowserAssets(){if(typeof document==="undefined"||(0,_state.assetsState)().captureDisabled)return;manifest.forEach(t=>upsert(t,false));performance.getEntriesByType("resource").forEach(t=>captureBrowserResource(t));document.querySelectorAll("img").forEach(t=>{if(!t.closest("[data-buoy-root]")&&t.currentSrc)upsert({url:t.currentSrc,width:t.naturalWidth||void 0,height:t.naturalHeight||void 0},t.complete&&t.naturalWidth>0)});const e=(0,_state.assetsState)();e.graphSupported=manifest.length>0;e.graphCount=manifest.length>0?manifest.length:null;e.measuredCount=e.records.filter(t=>t.sizeBytes!==void 0).length;e.lastScanAt=Date.now()}
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getLoadedFontFamilies = getLoadedFontFamilies;
|
|
7
|
-
exports.getLocalAssets = getLocalAssets;
|
|
8
|
-
/**
|
|
9
|
-
* Expo enrichment — all optional, all read through globalThis.expo guards so
|
|
10
|
-
* bare RN apps (no expo-modules) silently get none of it and no imports are
|
|
11
|
-
* added for anyone.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function expoModules() {
|
|
15
|
-
return globalThis.expo?.modules;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Every loaded font family — build-time embedded (config plugin / UIAppFonts /
|
|
20
|
-
* android assets/fonts) AND runtime Font.loadAsync, straight from the native
|
|
21
|
-
* module Expo documents as a stable global. [] when unavailable (bare RN).
|
|
22
|
-
*/
|
|
23
|
-
function getLoadedFontFamilies() {
|
|
24
|
-
try {
|
|
25
|
-
const fonts = expoModules()?.ExpoFontLoader?.getLoadedFonts?.();
|
|
26
|
-
return Array.isArray(fonts) ? [...new Set(fonts)].sort() : [];
|
|
27
|
-
} catch {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* expo-updates' per-file-hash → local URI map: the COMPLETE shipped asset set
|
|
34
|
-
* in Expo Go / OTA environments, independent of what JS has evaluated.
|
|
35
|
-
* null when not running in an updates-managed environment.
|
|
36
|
-
*/
|
|
37
|
-
function getLocalAssets() {
|
|
38
|
-
try {
|
|
39
|
-
const map = expoModules()?.ExpoUpdates?.localAssets;
|
|
40
|
-
if (map && typeof map === "object" && Object.keys(map).length > 0) return map;
|
|
41
|
-
return null;
|
|
42
|
-
} catch {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=expo.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getLoadedFontFamilies=getLoadedFontFamilies;exports.getLocalAssets=getLocalAssets;function expoModules(){return globalThis.expo?.modules}function getLoadedFontFamilies(){try{const e=expoModules()?.ExpoFontLoader?.getLoadedFonts?.();return Array.isArray(e)?[...new Set(e)].sort():[]}catch{return[]}}function getLocalAssets(){try{const e=expoModules()?.ExpoUpdates?.localAssets;if(e&&typeof e==="object"&&Object.keys(e).length>0)return e;return null}catch{return null}}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getLoadedFontFamilies = getLoadedFontFamilies;
|
|
7
|
-
exports.getLocalAssets = getLocalAssets;
|
|
8
|
-
function getLoadedFontFamilies() {
|
|
9
|
-
if (typeof document === 'undefined' || !document.fonts) return [];
|
|
10
|
-
const families = new Set();
|
|
11
|
-
document.fonts.forEach(face => {
|
|
12
|
-
if (face.status === 'loaded') families.add(face.family.replace(/^['"]|['"]$/g, ''));
|
|
13
|
-
});
|
|
14
|
-
return [...families].sort();
|
|
15
|
-
}
|
|
16
|
-
function getLocalAssets() {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=expo.web.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getLoadedFontFamilies=getLoadedFontFamilies;exports.getLocalAssets=getLocalAssets;function getLoadedFontFamilies(){if(typeof document==="undefined"||!document.fonts)return[];const e=new Set;document.fonts.forEach(t=>{if(t.status==="loaded")e.add(t.family.replace(/^['"]|['"]$/g,""))});return[...e].sort()}function getLocalAssets(){return null}
|
|
@@ -1,91 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getScanStatus = getScanStatus;
|
|
7
|
-
exports.installAssetCapture = installAssetCapture;
|
|
8
|
-
exports.rescan = rescan;
|
|
9
|
-
var _state = require("../state");
|
|
10
|
-
var _assetStore = require("../store/assetStore");
|
|
11
|
-
var _expo = require("./expo");
|
|
12
|
-
var _measure = require("./measure");
|
|
13
|
-
var _metroGraph = require("./metroGraph");
|
|
14
|
-
var _registry = require("./registry");
|
|
15
|
-
/**
|
|
16
|
-
* Capture install + scan orchestration.
|
|
17
|
-
*
|
|
18
|
-
* installAssetCapture() is cheap and synchronous (registry walk + patch) and
|
|
19
|
-
* runs at package import. The expensive passes — Metro graph fetch and byte
|
|
20
|
-
* measurement — run in rescan(), triggered when the modal opens or via the
|
|
21
|
-
* `rescan` sync action, so merely installing Buoy never hits the network.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function installAssetCapture() {
|
|
25
|
-
const s = (0, _state.assetsState)();
|
|
26
|
-
if (s.captureDisabled || s.installed) return;
|
|
27
|
-
s.installed = true;
|
|
28
|
-
s.registryAvailable = (0, _registry.getRegistryModule)() != null;
|
|
29
|
-
s.patched = (0, _registry.patchRegisterAsset)();
|
|
30
|
-
(0, _registry.walkRegistry)();
|
|
31
|
-
refreshEnrichment();
|
|
32
|
-
s.lastScanAt = Date.now();
|
|
33
|
-
(0, _assetStore.invalidate)();
|
|
34
|
-
}
|
|
35
|
-
function refreshEnrichment() {
|
|
36
|
-
const s = (0, _state.assetsState)();
|
|
37
|
-
s.fontFamilies = (0, _expo.getLoadedFontFamilies)();
|
|
38
|
-
const localAssets = (0, _expo.getLocalAssets)();
|
|
39
|
-
s.localAssetCount = localAssets ? Object.keys(localAssets).length : null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Full scan: registry re-walk (catches anything the patch missed), Metro
|
|
44
|
-
* graph merge (dev), Expo enrichment refresh, then size measurement.
|
|
45
|
-
*/
|
|
46
|
-
async function rescan() {
|
|
47
|
-
const s = (0, _state.assetsState)();
|
|
48
|
-
if (s.captureDisabled) return getScanStatus();
|
|
49
|
-
if (s.scanPromise) return s.scanPromise;
|
|
50
|
-
s.scanPromise = runScan();
|
|
51
|
-
try {
|
|
52
|
-
return await s.scanPromise;
|
|
53
|
-
} finally {
|
|
54
|
-
s.scanPromise = undefined;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async function runScan() {
|
|
58
|
-
const s = (0, _state.assetsState)();
|
|
59
|
-
(0, _assetStore.removeBuoyRecords)();
|
|
60
|
-
installAssetCapture();
|
|
61
|
-
(0, _registry.walkRegistry)();
|
|
62
|
-
refreshEnrichment();
|
|
63
|
-
await (0, _metroGraph.fetchAssetGraph)();
|
|
64
|
-
s.lastScanAt = Date.now();
|
|
65
|
-
(0, _assetStore.invalidate)();
|
|
66
|
-
void (0, _measure.measureSizes)();
|
|
67
|
-
return getScanStatus();
|
|
68
|
-
}
|
|
69
|
-
function getScanStatus() {
|
|
70
|
-
const s = (0, _state.assetsState)();
|
|
71
|
-
// Mirrors report the synced DEVICE's status, not the dashboard's.
|
|
72
|
-
if (s.mirrorScanStatus) return s.mirrorScanStatus;
|
|
73
|
-
let registryCount = 0;
|
|
74
|
-
for (const record of s.records) if (record.registryId != null) registryCount++;
|
|
75
|
-
return {
|
|
76
|
-
registryAvailable: s.registryAvailable,
|
|
77
|
-
patched: s.patched,
|
|
78
|
-
registryCount,
|
|
79
|
-
graphSupported: s.graphSupported || (0, _metroGraph.getDevServerOrigin)() != null,
|
|
80
|
-
graphCount: s.graphCount,
|
|
81
|
-
graphError: s.graphError,
|
|
82
|
-
graphFetchInFlight: s.graphFetchInFlight,
|
|
83
|
-
graphFetchStartedAt: s.graphFetchStartedAt ?? null,
|
|
84
|
-
lastScanAt: s.lastScanAt,
|
|
85
|
-
measuring: s.measuring,
|
|
86
|
-
measuredCount: s.measuredCount,
|
|
87
|
-
fontFamilies: s.fontFamilies,
|
|
88
|
-
localAssetCount: s.localAssetCount
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=install.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getScanStatus=getScanStatus;exports.installAssetCapture=installAssetCapture;exports.rescan=rescan;var _state=require("../state");var _assetStore=require("../store/assetStore");var _expo=require("./expo");var _measure=require("./measure");var _metroGraph=require("./metroGraph");var _registry=require("./registry");function installAssetCapture(){const e=(0,_state.assetsState)();if(e.captureDisabled||e.installed)return;e.installed=true;e.registryAvailable=(0,_registry.getRegistryModule)()!=null;e.patched=(0,_registry.patchRegisterAsset)();(0,_registry.walkRegistry)();refreshEnrichment();e.lastScanAt=Date.now();(0,_assetStore.invalidate)()}function refreshEnrichment(){const e=(0,_state.assetsState)();e.fontFamilies=(0,_expo.getLoadedFontFamilies)();const t=(0,_expo.getLocalAssets)();e.localAssetCount=t?Object.keys(t).length:null}async function rescan(){const e=(0,_state.assetsState)();if(e.captureDisabled)return getScanStatus();if(e.scanPromise)return e.scanPromise;e.scanPromise=runScan();try{return await e.scanPromise}finally{e.scanPromise=void 0}}async function runScan(){const e=(0,_state.assetsState)();(0,_assetStore.removeBuoyRecords)();installAssetCapture();(0,_registry.walkRegistry)();refreshEnrichment();await(0,_metroGraph.fetchAssetGraph)();e.lastScanAt=Date.now();(0,_assetStore.invalidate)();void(0,_measure.measureSizes)();return getScanStatus()}function getScanStatus(){const e=(0,_state.assetsState)();if(e.mirrorScanStatus)return e.mirrorScanStatus;let t=0;for(const r of e.records)if(r.registryId!=null)t++;return{registryAvailable:e.registryAvailable,patched:e.patched,registryCount:t,graphSupported:e.graphSupported||(0,_metroGraph.getDevServerOrigin)()!=null,graphCount:e.graphCount,graphError:e.graphError,graphFetchInFlight:e.graphFetchInFlight,graphFetchStartedAt:e.graphFetchStartedAt??null,lastScanAt:e.lastScanAt,measuring:e.measuring,measuredCount:e.measuredCount,fontFamilies:e.fontFamilies,localAssetCount:e.localAssetCount}}
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getScanStatus = getScanStatus;
|
|
7
|
-
exports.installAssetCapture = installAssetCapture;
|
|
8
|
-
exports.rescan = rescan;
|
|
9
|
-
exports.stopBrowserAssetCapture = stopBrowserAssetCapture;
|
|
10
|
-
var _state = require("../state");
|
|
11
|
-
var _assetStore = require("../store/assetStore");
|
|
12
|
-
var _browserAssets = require("./browserAssets");
|
|
13
|
-
var _expo = require("./expo");
|
|
14
|
-
let observer;
|
|
15
|
-
function installAssetCapture() {
|
|
16
|
-
const state = (0, _state.assetsState)();
|
|
17
|
-
if (typeof document === 'undefined' || state.captureDisabled || state.installed) return;
|
|
18
|
-
state.installed = true;
|
|
19
|
-
state.registryAvailable = true;
|
|
20
|
-
if (typeof PerformanceObserver !== 'undefined') {
|
|
21
|
-
observer = new PerformanceObserver(list => {
|
|
22
|
-
if ((0, _state.assetsState)().captureDisabled) {
|
|
23
|
-
stopBrowserAssetCapture();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
list.getEntries().forEach(entry => (0, _browserAssets.captureBrowserResource)(entry));
|
|
27
|
-
});
|
|
28
|
-
try {
|
|
29
|
-
observer.observe({
|
|
30
|
-
type: 'resource',
|
|
31
|
-
buffered: true
|
|
32
|
-
});
|
|
33
|
-
state.patched = true;
|
|
34
|
-
} catch {
|
|
35
|
-
observer.disconnect();
|
|
36
|
-
observer = undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
(0, _browserAssets.scanBrowserAssets)();
|
|
40
|
-
state.fontFamilies = (0, _expo.getLoadedFontFamilies)();
|
|
41
|
-
(0, _assetStore.invalidate)();
|
|
42
|
-
}
|
|
43
|
-
function stopBrowserAssetCapture() {
|
|
44
|
-
observer?.disconnect();
|
|
45
|
-
observer = undefined;
|
|
46
|
-
(0, _state.assetsState)().installed = false;
|
|
47
|
-
(0, _state.assetsState)().patched = false;
|
|
48
|
-
}
|
|
49
|
-
async function rescan() {
|
|
50
|
-
installAssetCapture();
|
|
51
|
-
(0, _browserAssets.scanBrowserAssets)();
|
|
52
|
-
(0, _state.assetsState)().fontFamilies = (0, _expo.getLoadedFontFamilies)();
|
|
53
|
-
(0, _assetStore.invalidate)();
|
|
54
|
-
return getScanStatus();
|
|
55
|
-
}
|
|
56
|
-
function getScanStatus() {
|
|
57
|
-
const state = (0, _state.assetsState)();
|
|
58
|
-
return state.mirrorScanStatus ?? {
|
|
59
|
-
registryAvailable: state.registryAvailable,
|
|
60
|
-
patched: state.patched,
|
|
61
|
-
registryCount: state.records.filter(record => record.loaded).length,
|
|
62
|
-
graphSupported: state.graphSupported,
|
|
63
|
-
graphCount: state.graphCount,
|
|
64
|
-
graphError: null,
|
|
65
|
-
graphFetchInFlight: false,
|
|
66
|
-
graphFetchStartedAt: null,
|
|
67
|
-
lastScanAt: state.lastScanAt,
|
|
68
|
-
measuring: false,
|
|
69
|
-
measuredCount: state.measuredCount,
|
|
70
|
-
fontFamilies: state.fontFamilies,
|
|
71
|
-
localAssetCount: null,
|
|
72
|
-
browser: true
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=install.web.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getScanStatus=getScanStatus;exports.installAssetCapture=installAssetCapture;exports.rescan=rescan;exports.stopBrowserAssetCapture=stopBrowserAssetCapture;var _state=require("../state");var _assetStore=require("../store/assetStore");var _browserAssets=require("./browserAssets");var _expo=require("./expo");let observer;function installAssetCapture(){const e=(0,_state.assetsState)();if(typeof document==="undefined"||e.captureDisabled||e.installed)return;e.installed=true;e.registryAvailable=true;if(typeof PerformanceObserver!=="undefined"){observer=new PerformanceObserver(t=>{if((0,_state.assetsState)().captureDisabled){stopBrowserAssetCapture();return}t.getEntries().forEach(s=>(0,_browserAssets.captureBrowserResource)(s))});try{observer.observe({type:"resource",buffered:true});e.patched=true}catch{observer.disconnect();observer=void 0}}(0,_browserAssets.scanBrowserAssets)();e.fontFamilies=(0,_expo.getLoadedFontFamilies)();(0,_assetStore.invalidate)()}function stopBrowserAssetCapture(){observer?.disconnect();observer=void 0;(0,_state.assetsState)().installed=false;(0,_state.assetsState)().patched=false}async function rescan(){installAssetCapture();(0,_browserAssets.scanBrowserAssets)();(0,_state.assetsState)().fontFamilies=(0,_expo.getLoadedFontFamilies)();(0,_assetStore.invalidate)();return getScanStatus()}function getScanStatus(){const e=(0,_state.assetsState)();return e.mirrorScanStatus??{registryAvailable:e.registryAvailable,patched:e.patched,registryCount:e.records.filter(t=>t.loaded).length,graphSupported:e.graphSupported,graphCount:e.graphCount,graphError:null,graphFetchInFlight:false,graphFetchStartedAt:null,lastScanAt:e.lastScanAt,measuring:false,measuredCount:e.measuredCount,fontFamilies:e.fontFamilies,localAssetCount:null,browser:true}}
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isBuoyAsset = isBuoyAsset;
|
|
7
|
-
exports.isBuoyAssetPath = isBuoyAssetPath;
|
|
8
|
-
/** Identify Buoy-owned resources by package location, never by asset name. */
|
|
9
|
-
function isBuoyAssetPath(value) {
|
|
10
|
-
if (!value) return false;
|
|
11
|
-
let path = value;
|
|
12
|
-
try {
|
|
13
|
-
path = decodeURIComponent(path);
|
|
14
|
-
} catch {
|
|
15
|
-
// Keep readable path segments when an unrelated escape is malformed.
|
|
16
|
-
}
|
|
17
|
-
path = path.replace(/\\/g, "/");
|
|
18
|
-
return /(?:^|\/)node_modules\/@buoy-gg\/[^/]+(?:\/|$)/.test(path) || /(?:^|\/)buoy-packages\/packages\/[^/]+(?:\/|$)/.test(path) || /(?:^|\/)packages\/floating-tools-core\/(?:src|lib\/(?:module|commonjs))\/icons\/assets(?:\/|$)/.test(path);
|
|
19
|
-
}
|
|
20
|
-
function isBuoyAsset(asset) {
|
|
21
|
-
return [asset.key, asset.httpServerLocation, asset.fileSystemLocation, ...(asset.files ?? [])].some(isBuoyAssetPath);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=isBuoyAsset.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isBuoyAsset=isBuoyAsset;exports.isBuoyAssetPath=isBuoyAssetPath;function isBuoyAssetPath(e){if(!e)return false;let t=e;try{t=decodeURIComponent(t)}catch{}t=t.replace(/\\/g,"/");return/(?:^|\/)node_modules\/@buoy-gg\/[^/]+(?:\/|$)/.test(t)||/(?:^|\/)buoy-packages\/packages\/[^/]+(?:\/|$)/.test(t)||/(?:^|\/)packages\/floating-tools-core\/(?:src|lib\/(?:module|commonjs))\/icons\/assets(?:\/|$)/.test(t)}function isBuoyAsset(e){return[e.key,e.httpServerLocation,e.fileSystemLocation,...e.files??[]].some(isBuoyAssetPath)}
|