Load layouts and optional features from staged asset caches

This commit is contained in:
Jonathan Sykes
2026-10-08 01:29:50 +08:00
parent d98d444552
commit 5d6a1545df
30 changed files with 512 additions and 146 deletions

View File

@@ -10,11 +10,13 @@
}
function blocking(manifest, previous, activeLayout) {
return [...new Set(Object.entries(manifest.groups)
const names = new Set(Object.entries(manifest.groups)
.filter(([name, group]) => name === 'core' || !group.background ||
name === 'layout:' + activeLayout ||
(previous?.groups[name] && previous.groups[name].contract !== group.contract))
.flatMap(([, group]) => group.files))].sort();
.map(([name]) => name));
for (const name of names) for (const dependency of manifest.groups[name].dependencies || []) names.add(dependency);
return [...new Set([...names].flatMap(name => manifest.groups[name].files))].sort();
}
function plan(manifest, keys) {
@@ -26,9 +28,10 @@
}
function retained(current, previous) {
const keep = new Set(paths(current).map(path => url(path, current.files[path])));
const currentPaths = new Set(paths(current));
const keep = new Set([...currentPaths].map(path => url(path, current.files[path])));
if (previous) for (const path of paths(previous)) {
if (current.files[path]?.h !== previous.files[path].h) keep.add(url(path, previous.files[path]));
if (!currentPaths.has(path) || current.files[path]?.h !== previous.files[path].h) keep.add(url(path, previous.files[path]));
}
return keep;
}