"use strict";
const node_path_1 = require("node:path");
const ENV_1 = require("./ENV");
const WIN32_1 = require("./WIN32");
// Bun cache directory path.
// Bun stores its cache in a platform-specific location.
//
// Default locations:
// - macOS: ~/Library/Caches/bun
// - Linux: ~/.bun/install/cache
// - Windows: %TEMP%/bun
//
// Can be overridden by:
// - BUN_INSTALL_CACHE_DIR environment variable
// - cache.dir setting in bunfig.toml
//
// Documentation: https://bun.sh/docs/runtime/bunfig#cache-dir
function getBunCachePath() {
    // Check for explicit BUN_INSTALL_CACHE_DIR environment variable.
    const bunCacheDir = process.env['BUN_INSTALL_CACHE_DIR'];
    if (bunCacheDir) {
        return bunCacheDir;
    }
    if (WIN32_1) {
        // On Windows, Bun uses TEMP directory.
        const temp = process.env['TEMP'] || process.env['TMP'];
        return temp ? node_path_1.join(temp, 'bun') : '';
    }
    // On macOS, use Library/Caches.
    if (process.platform === 'darwin' && ENV_1.HOME) {
        return node_path_1.join(ENV_1.HOME, 'Library', 'Caches', 'bun');
    }
    // On Linux/Unix, use ~/.bun/install/cache.
    return ENV_1.HOME ? node_path_1.join(ENV_1.HOME, '.bun', 'install', 'cache') : '';
}
module.exports = getBunCachePath();
//# sourceMappingURL=bun-cache-path.js.map