fix(apple): scope keyed archive traversal to the selection

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Celekli
2026-10-10 21:17:35 +08:00
committed by Ysopwnable
parent 02ef2b1c41
commit c8fd2f152b
3 changed files with 129 additions and 11 deletions
+7 -2
View File
@@ -22,7 +22,11 @@ export class DirectoryArtifactReader implements ArtifactReader {
this.#rootPromise = realpath(root);
}
async *entries(signal?: AbortSignal): AsyncIterable<ArtifactEntry> {
/** Enumerate entries, optionally restricting descent while retaining directories. */
async *entries(
signal?: AbortSignal,
descendInto?: (path: string) => boolean,
): AsyncIterable<ArtifactEntry> {
const root = await this.#rootPromise.catch((cause: unknown) => {
throw directoryIoFailure("resolve artifact root", this.#rootPath, cause);
});
@@ -66,7 +70,8 @@ export class DirectoryArtifactReader implements ArtifactReader {
? "file"
: undefined;
if (kind === undefined) continue;
if (kind === "directory") directories.push(absolute);
if (kind === "directory" && (descendInto?.(path) ?? true))
directories.push(absolute);
yield {
path,
kind,