"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_node_fs = require('../node/fs.js');
const require_paths_socket = require('../paths/socket.js');
const require_fs_safe = require('../fs/safe.js');
const require_promises_iterate = require('../promises/iterate.js');
const require_dlx_packages = require('./packages.js');

//#region src/dlx/dir.ts
/**
* @file Directory management utilities for DLX installations.
*/
/**
* Clear all DLX package installations.
*
* @example
*   ;```typescript
*   await clearDlx()
*   ```
*/
async function clearDlx() {
	await /* @__PURE__ */ require_promises_iterate.pEach(await require_dlx_packages.listDlxPackagesAsync(), (pkg) => require_dlx_packages.removeDlxPackage(pkg));
}
/**
* Clear all DLX package installations synchronously.
*
* @example
*   ;```typescript
*   clearDlxSync()
*   ```
*/
function clearDlxSync() {
	const packages = require_dlx_packages.listDlxPackages();
	for (const pkg of packages) require_dlx_packages.removeDlxPackageSync(pkg);
}
/**
* Check if the DLX directory exists.
*
* @example
*   ;```typescript
*   if (dlxDirExists()) {
*     console.log('DLX directory is present')
*   }
*   ```
*/
function dlxDirExists() {
	return (/* @__PURE__ */ require_node_fs.getNodeFs()).existsSync(require_paths_socket.getSocketDlxDir());
}
/**
* Ensure the DLX directory exists, creating it if necessary.
*
* @example
*   ;```typescript
*   await ensureDlxDir()
*   ```
*/
async function ensureDlxDir() {
	await require_fs_safe.safeMkdir(require_paths_socket.getSocketDlxDir());
}
/**
* Ensure the DLX directory exists synchronously, creating it if necessary.
*
* @example
*   ;```typescript
*   ensureDlxDirSync()
*   ```
*/
function ensureDlxDirSync() {
	require_fs_safe.safeMkdirSync(require_paths_socket.getSocketDlxDir());
}

//#endregion
exports.clearDlx = clearDlx;
exports.clearDlxSync = clearDlxSync;
exports.dlxDirExists = dlxDirExists;
exports.ensureDlxDir = ensureDlxDir;
exports.ensureDlxDirSync = ensureDlxDirSync;