{"version":3,"file":"remove.mjs","names":["unlinkPromise","unlink"],"sources":["../../../../../../@warlock.js/fs/src/remove.ts"],"sourcesContent":["import { rm, unlink as unlinkPromise } from \"node:fs/promises\";\nimport { rmSync, unlinkSync } from \"node:fs\";\n\n/**\n * Delete a single file. No error if the file doesn't exist.\n */\nexport async function unlinkAsync(path: string): Promise<void> {\n  try {\n    await unlinkPromise(path);\n  } catch (error: any) {\n    if (error?.code !== \"ENOENT\") throw error;\n  }\n}\n\nexport function unlink(path: string): void {\n  try {\n    unlinkSync(path);\n  } catch (error: any) {\n    if (error?.code !== \"ENOENT\") throw error;\n  }\n}\n\n/**\n * Recursively delete a directory and its contents. No error if missing.\n */\nexport async function removeDirectoryAsync(path: string): Promise<void> {\n  await rm(path, { recursive: true, force: true });\n}\n\nexport function removeDirectory(path: string): void {\n  rmSync(path, { recursive: true, force: true });\n}\n"],"mappings":";;;;;;;AAMA,eAAsB,YAAY,MAA6B;CAC7D,IAAI;EACF,MAAMA,OAAc,IAAI;CAC1B,SAAS,OAAY;EACnB,IAAI,OAAO,SAAS,UAAU,MAAM;CACtC;AACF;AAEA,SAAgBC,SAAO,MAAoB;CACzC,IAAI;EACF,WAAW,IAAI;CACjB,SAAS,OAAY;EACnB,IAAI,OAAO,SAAS,UAAU,MAAM;CACtC;AACF;;;;AAKA,eAAsB,qBAAqB,MAA6B;CACtE,MAAM,GAAG,MAAM;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;AACjD;AAEA,SAAgB,gBAAgB,MAAoB;CAClD,OAAO,MAAM;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;AAC/C"}