This commit is contained in:
2026-10-18 23:18:25 +07:00
parent 8da494c424
commit fc326f46c8
10 changed files with 336 additions and 29 deletions
+23 -8
View File
@@ -304,14 +304,29 @@ export class PackageStore {
await this.exclusive(async () => {
const dir = await this.path(key)
await rm(dir, { recursive: true, force: true })
this.ready.delete(key)
this.descriptions.delete(key)
for (const token of this.checked.keys())
if (token.startsWith(`${key}/`)) this.checked.delete(token)
for (const token of this.repaired)
if (token.startsWith(`${key}/`)) this.repaired.delete(token)
for (const token of this.assetErrors.keys())
if (token.startsWith(`${key}/`)) this.assetErrors.delete(token)
this.forget(key)
})
}
private forget(key: string) {
this.ready.delete(key)
this.descriptions.delete(key)
for (const token of this.checked.keys())
if (token.startsWith(`${key}/`)) this.checked.delete(token)
for (const token of this.repaired)
if (token.startsWith(`${key}/`)) this.repaired.delete(token)
for (const token of this.assetErrors.keys())
if (token.startsWith(`${key}/`)) this.assetErrors.delete(token)
}
async clear(): Promise<void> {
await this.exclusive(async () => {
await Promise.allSettled([...this.loading.values(), ...this.remembering.values()])
const root = await this.path()
for (const key of await readdir(root)) {
if (!hex.test(key)) continue
// Удаляется сама ссылка, без перехода к её цели.
await rm(join(root, key), { recursive: true, force: true })
this.forget(key)
}
})
}
private descriptionPackage(pkg: ScreenPackage): LocalPackage {