1const ignoredDirectoryNames = new Set([2 ".git",3 ".playwright-cli",4 ".vite",5 "node_modules",6]);78async function filesBelow(path: string): Promise<string[]> {9 const files: string[] = [];10 for await (const entry of Deno.readDir(path)) {11 const child = `${path}/${entry.name}`;12 if (entry.isDirectory) files.push(...await filesBelow(child));13 else if (entry.isFile) files.push(child);14 }15 return files;16}1718export async function collectBuildArtifactFiles(root = "."): Promise<string[]> {19 const artifacts: string[] = [];2021 async function visit(path: string) {22 for await (const entry of Deno.readDir(path)) {23 if (!entry.isDirectory || ignoredDirectoryNames.has(entry.name)) continue;24 const child = path === "." ? entry.name : `${path}/${entry.name}`;25 if (entry.name === "dist") artifacts.push(...await filesBelow(child));26 else await visit(child);27 }28 }2930 try {31 await visit(root);32 } catch (error) {33 if (!(error instanceof Deno.errors.NotFound)) throw error;34 }3536 return artifacts;37}