@hyperframes/studio 0.8.213 → 0.8.214
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/dist/assets/{hyperframes-player-Bb6n05RB.js → hyperframes-player-H1DIJsJZ.js} +1 -1
- package/dist/assets/{index-pq574E5O.js → index-BftVE_0y.js} +117 -117
- package/dist/assets/{index-DOtf09XR.js → index-v_hWj6Kv.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +9 -1
- package/package.json +8 -8
- package/src/player/lib/thumbnailDiskCache.test.ts +27 -0
- package/src/player/lib/thumbnailDiskCache.ts +12 -1
package/dist/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = "paper";
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-BftVE_0y.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -28472,6 +28472,7 @@ var ENTRY_ORIGIN = "https://hf-thumbnail.invalid/";
|
|
|
28472
28472
|
var STORED_THUMBNAIL_BYTES = 256 * 1024 * 1024;
|
|
28473
28473
|
var index;
|
|
28474
28474
|
var dropped = /* @__PURE__ */ new Set();
|
|
28475
|
+
var sourcesThisTabMovedOn = /* @__PURE__ */ new Set();
|
|
28475
28476
|
var saveTimer;
|
|
28476
28477
|
var warned = false;
|
|
28477
28478
|
var available = () => typeof caches !== "undefined" && typeof crypto?.subtle !== "undefined";
|
|
@@ -28507,6 +28508,12 @@ function laterOf(own, theirs) {
|
|
|
28507
28508
|
if (own && own.usedAt >= theirs.usedAt) return void 0;
|
|
28508
28509
|
return { usedAt: theirs.usedAt, bytes: Math.max(theirs.bytes, own?.bytes ?? 0) };
|
|
28509
28510
|
}
|
|
28511
|
+
function savedEtagsButThisTabsMoves(mine, theirs) {
|
|
28512
|
+
const etags = { ...mine, ...theirs };
|
|
28513
|
+
for (const key2 of sourcesThisTabMovedOn) etags[key2] = mine[key2];
|
|
28514
|
+
sourcesThisTabMovedOn.clear();
|
|
28515
|
+
return etags;
|
|
28516
|
+
}
|
|
28510
28517
|
function mergedIndex() {
|
|
28511
28518
|
const mine = loadIndex();
|
|
28512
28519
|
const theirs = savedIndex() ?? { etags: {}, caches: {} };
|
|
@@ -28514,7 +28521,7 @@ function mergedIndex() {
|
|
|
28514
28521
|
const later = dropped.has(name) ? void 0 : laterOf(mine.caches[name], entry3);
|
|
28515
28522
|
if (later) mine.caches[name] = later;
|
|
28516
28523
|
}
|
|
28517
|
-
mine.etags =
|
|
28524
|
+
mine.etags = savedEtagsButThisTabsMoves(mine.etags, theirs.etags);
|
|
28518
28525
|
dropped.clear();
|
|
28519
28526
|
return mine;
|
|
28520
28527
|
}
|
|
@@ -28546,6 +28553,7 @@ var rememberVersion = (stored) => quietly(async () => {
|
|
|
28546
28553
|
const saved2 = loadIndex();
|
|
28547
28554
|
if (saved2.etags[key2] === stored.etag) return;
|
|
28548
28555
|
saved2.etags[key2] = stored.etag;
|
|
28556
|
+
sourcesThisTabMovedOn.add(key2);
|
|
28549
28557
|
saveIndexSoon();
|
|
28550
28558
|
const keep = await cacheNameOf(stored);
|
|
28551
28559
|
for (const name of await caches.keys()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.214",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"dockview-react": "8.3.1",
|
|
61
61
|
"gsap": "^3.13.0",
|
|
62
62
|
"mediabunny": "^1.45.3",
|
|
63
|
-
"@hyperframes/core": "0.8.
|
|
64
|
-
"@hyperframes/
|
|
65
|
-
"@hyperframes/
|
|
66
|
-
"@hyperframes/sdk": "0.8.
|
|
67
|
-
"@hyperframes/
|
|
68
|
-
"@hyperframes/
|
|
63
|
+
"@hyperframes/core": "0.8.214",
|
|
64
|
+
"@hyperframes/parsers": "0.8.214",
|
|
65
|
+
"@hyperframes/player": "0.8.214",
|
|
66
|
+
"@hyperframes/sdk": "0.8.214",
|
|
67
|
+
"@hyperframes/studio-server": "0.8.214",
|
|
68
|
+
"@hyperframes/shader-transitions": "0.8.214"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^6.4.2",
|
|
83
83
|
"vitest": "^4.1.11",
|
|
84
84
|
"zustand": "^5.0.0",
|
|
85
|
-
"@hyperframes/producer": "0.8.
|
|
85
|
+
"@hyperframes/producer": "0.8.214"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": "19",
|
|
@@ -154,5 +154,32 @@ describe("stored thumbnails", () => {
|
|
|
154
154
|
const saved = JSON.parse(localStorage.getItem("hf-thumbnails-index")!);
|
|
155
155
|
expect(Object.keys(saved.caches)).toContain("hf-thumbnails:other:tab");
|
|
156
156
|
expect(Object.keys(saved.caches)).toHaveLength(2);
|
|
157
|
+
expect(Object.values(saved.etags)).toEqual(['"two"']);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("keep a newer version another tab saw of a source this tab only read at start", async () => {
|
|
161
|
+
await rememberVersion(v1);
|
|
162
|
+
await storeFrame(v1, "cover 1x1 0", 0, jpeg());
|
|
163
|
+
await vi.waitFor(() => expect(localStorage.getItem("hf-thumbnails-index")).toContain("bytes"), {
|
|
164
|
+
timeout: 3000,
|
|
165
|
+
});
|
|
166
|
+
resetStoredThumbnailsForTests();
|
|
167
|
+
// a new session reads the index, then another tab moves the source on to v2
|
|
168
|
+
await storeFrame({ source: "/other.mp4", etag: '"1"' }, "cover 1x1 0", 0, jpeg());
|
|
169
|
+
const other = JSON.parse(localStorage.getItem("hf-thumbnails-index")!);
|
|
170
|
+
const key = Object.keys(other.etags).find((k) => other.etags[k] === '"one"')!;
|
|
171
|
+
other.etags[key] = '"two"';
|
|
172
|
+
localStorage.setItem("hf-thumbnails-index", JSON.stringify(other));
|
|
173
|
+
await storeFrame({ source: "/other.mp4", etag: '"1"' }, "cover 1x1 1", 1, jpeg());
|
|
174
|
+
|
|
175
|
+
// this tab's save is the one that adds /other.mp4's cache to the index
|
|
176
|
+
await vi.waitFor(
|
|
177
|
+
() =>
|
|
178
|
+
expect(
|
|
179
|
+
Object.keys(JSON.parse(localStorage.getItem("hf-thumbnails-index")!).caches),
|
|
180
|
+
).toHaveLength(2),
|
|
181
|
+
{ timeout: 3000 },
|
|
182
|
+
);
|
|
183
|
+
expect(JSON.parse(localStorage.getItem("hf-thumbnails-index")!).etags[key]).toBe('"two"');
|
|
157
184
|
});
|
|
158
185
|
});
|
|
@@ -24,6 +24,7 @@ interface Index {
|
|
|
24
24
|
let index: Index | undefined;
|
|
25
25
|
// caches this tab dropped since its last save, which another tab's older snapshot must not bring back
|
|
26
26
|
const dropped = new Set<string>();
|
|
27
|
+
const sourcesThisTabMovedOn = new Set<string>();
|
|
27
28
|
let saveTimer: ReturnType<typeof setTimeout> | undefined;
|
|
28
29
|
let warned = false;
|
|
29
30
|
|
|
@@ -72,6 +73,13 @@ function laterOf(own: CacheEntry | undefined, theirs: CacheEntry): CacheEntry |
|
|
|
72
73
|
return { usedAt: theirs.usedAt, bytes: Math.max(theirs.bytes, own?.bytes ?? 0) };
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
function savedEtagsButThisTabsMoves(mine: Index["etags"], theirs: Index["etags"]): Index["etags"] {
|
|
77
|
+
const etags = { ...mine, ...theirs };
|
|
78
|
+
for (const key of sourcesThisTabMovedOn) etags[key] = mine[key]!;
|
|
79
|
+
sourcesThisTabMovedOn.clear();
|
|
80
|
+
return etags;
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
/** This tab's index with what other tabs saved since: each cache at its latest use, none this tab dropped. */
|
|
76
84
|
function mergedIndex(): Index {
|
|
77
85
|
const mine = loadIndex();
|
|
@@ -80,7 +88,7 @@ function mergedIndex(): Index {
|
|
|
80
88
|
const later = dropped.has(name) ? undefined : laterOf(mine.caches[name], entry);
|
|
81
89
|
if (later) mine.caches[name] = later;
|
|
82
90
|
}
|
|
83
|
-
mine.etags =
|
|
91
|
+
mine.etags = savedEtagsButThisTabsMoves(mine.etags, theirs.etags);
|
|
84
92
|
dropped.clear();
|
|
85
93
|
return mine;
|
|
86
94
|
}
|
|
@@ -122,6 +130,7 @@ export const rememberVersion = (stored: StoredSource) =>
|
|
|
122
130
|
const saved = loadIndex();
|
|
123
131
|
if (saved.etags[key] === stored.etag) return;
|
|
124
132
|
saved.etags[key] = stored.etag;
|
|
133
|
+
sourcesThisTabMovedOn.add(key);
|
|
125
134
|
saveIndexSoon();
|
|
126
135
|
const keep = await cacheNameOf(stored);
|
|
127
136
|
for (const name of await caches.keys()) {
|
|
@@ -209,4 +218,6 @@ export function resetStoredThumbnailsForTests(): void {
|
|
|
209
218
|
saveTimer = undefined;
|
|
210
219
|
index = undefined;
|
|
211
220
|
warned = false;
|
|
221
|
+
dropped.clear();
|
|
222
|
+
sourcesThisTabMovedOn.clear();
|
|
212
223
|
}
|