import fs from 'node:fs' import path from 'node:path' import { findMetadataFiles } from './cacheList.js' export async function cacheDelete (opts: { cacheDir: string, registry?: string }, filter: string[]): Promise { const metaFiles = await findMetadataFiles(opts, filter) for (const metaFile of metaFiles) { fs.unlinkSync(path.join(opts.cacheDir, metaFile)) } return metaFiles.sort().join('\n') }