{
    "version": "1.3.14-canary.1+611740ffe",
    "description": "Incredibly fast JavaScript runtime, bundler, transpiler and package manager - all in one.",
    "homepage": "https://bun.sh/",
    "license": "MIT",
    "suggest": {
        "vcredist": "extras/vcredist2022"
    },
    "architecture": {
        "64bit": {
            "url": [
                "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-x64.zip",
                "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-x64-baseline.zip"
            ],
            "hash": [
                "ecbae76ea0b62b1167f16c42319ea2a4ef557125e5474aba9bc48895749c25cf",
                "de7ce96b7ce7f65b6e957ee4bf18cc2d9a7214fda88082a4ee391f0e883f74ce"
            ]
        },
        "arm64": {
            "url": "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip",
            "hash": "44ffb18efc1db13659a398b34ab03662cc40eaa27021947c6a5b7020c43e067a"
        }
    },
    "pre_install": [
        "# Migrate legacy Bun data if it exists and the new persist directory doesn't exist",
        "$legacy_bun = Join-Path -Path $env:USERPROFILE -ChildPath '.bun'",
        "if ((Test-Path $legacy_bun) -and -not (Test-Path $persist_dir)) {",
        "    Write-Host \"Migrating legacy Bun data from '$legacy_bun' to '$persist_dir'.\" -ForegroundColor Yellow",
        "    Move-Item $legacy_bun $persist_dir -Force",
        "} elseif ((Test-Path $legacy_bun) -and (Test-Path $persist_dir)) {",
        "    Write-Host \"Found both '$legacy_bun' and '$persist_dir'. Skipping auto-migration; please migrate manually if needed.\" -ForegroundColor Yellow",
        "}",
        "",
        "# Extract the appropriate binary based on architecture and CPU features",
        "if ($architecture -eq 'arm64') {",
        "    $target = 'bun-windows-aarch64'",
        "} else {",
        "    $avx2 = Start-Job -ScriptBlock {",
        "        Add-Type -MemberDefinition '[DllImport(\"kernel32.dll\")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);' -Name Kernel32 -Namespace Win32",
        "        return [Win32.Kernel32]::IsProcessorFeaturePresent(40)",
        "    } | Receive-Job -Wait -AutoRemoveJob",
        "    $target = 'bun-windows-x64'",
        "    if (-not $avx2) {",
        "        $target += '-baseline'",
        "    }",
        "}",
        "Move-Item \"$dir\\$target\\bun.exe\" \"$dir\\bun.exe\"",
        "Remove-Item \"$dir\\bun-windows-*\" -Recurse"
    ],
    "installer": {
        "script": "Add-Path -Path \"$persist_dir\\bin\" -Global:$global -Force"
    },
    "env_set": {
        "BUN_INSTALL": "$persist_dir",
        "BUN_INSTALL_BIN": "$persist_dir\\bin",
        "BUN_INSTALL_GLOBAL_DIR": "$persist_dir\\install\\global"
    },
    "bin": [
        "bun.exe",
        [
            "bun.exe",
            "bunx",
            "x"
        ]
    ],
    "persist": [
        "bin",
        "install"
    ],
    "uninstaller": {
        "script": "Remove-Path -Path \"$persist_dir\\bin\" -Global:$global"
    },
    "checkver": {
        "script": [
            "$dl_url = 'https://github.com/oven-sh/bun/releases/download/canary/bun-windows-x64.zip'",
            "$dl_path = cache_path 'bun-canary' 'unknown' $dl_url",
            "$dl_dir = Split-Path -Path $dl_path -Parent",
            "Invoke-WebRequest -Uri $dl_url -OutFile $dl_path",
            "Expand-Archive -Path $dl_path -DestinationPath $dl_dir | Out-Null",
            "$ver = & \"$dl_dir\\bun-windows-x64\\bun.exe\" --revision",
            "Remove-Item -Path $dl_path, $dl_dir\\bun-windows-x64 -Recurse -Force",
            "Write-Output $ver"
        ],
        "regex": "(?<version>\\S+)"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": [
                    "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-x64.zip",
                    "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-x64-baseline.zip"
                ]
            },
            "arm64": {
                "url": "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip"
            }
        },
        "hash": {
            "url": "https://api.github.com/repos/oven-sh/bun/releases/tags/canary",
            "jsonpath": "$..assets[?(@.name == '$basename')].digest"
        }
    }
}
