diff --git a/bucket/bun-canary.json b/bucket/bun-canary.json index 1b601ad9f3c..427a9fd3265 100644 --- a/bucket/bun-canary.json +++ b/bucket/bun-canary.json @@ -1,5 +1,5 @@ { - "version": "1.1.22-canary.1+dbd320ccf", + "version": "1.3.12-canary.1+0ff0065f9", "description": "Incredibly fast JavaScript runtime, bundler, transpiler and package manager - all in one.", "homepage": "https://bun.sh/", "license": "MIT", @@ -8,11 +8,54 @@ }, "architecture": { "64bit": { - "url": "https://nightly.link/oven-sh/bun/suites/10149528008/artifacts/1752223277#/dl.zip", - "hash": "dc444df8d0fb88572dc742f4faefcc52de0d6be84b769ad12576cd2ee4a0e617", - "pre_install": "Expand-7zipArchive \"$dir\\bun-windows-x64.zip\" -ExtractDir 'bun-windows-x64' -Removal" + "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": [ + "eae99c1c1744c9bdb4176d5a907b985b82bc7fbf1490894c939579165f98cbba", + "905eba784398f49d3722a6f130c2f7921200978e3c4d85b0d724f5bbbc8c43e8" + ] + }, + "arm64": { + "url": "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip", + "hash": "fb5215b01a1a35e3b31269207dcea2470772a807bf2c02389ba561fe95a3900b" } }, + "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", [ @@ -21,31 +64,41 @@ "x" ] ], + "persist": [ + "bin", + "install" + ], + "uninstaller": { + "script": "Remove-Path -Path \"$persist_dir\\bin\" -Global:$global" + }, "checkver": { "script": [ - "$runs = (irm 'https://api.github.com/repos/oven-sh/bun/actions/workflows/ci.yml/runs?status=success&per_page=1')", - "$buildId = $runs.workflow_runs[0].id", - "$artifacts = (irm \"https://api.github.com/repos/oven-sh/bun/actions/runs/$buildId/artifacts\")", - "$artifactId = $artifacts.artifacts | Where-Object { $_.name -eq 'bun-windows-x64' } | Select-Object -ExpandProperty 'id'", - "$dl_url = \"https://nightly.link/oven-sh/bun/suites/$buildId/artifacts/$artifactId\"", - "$dl = cache_path 'bun-canary' 'unknown' \"$dl_url#/dl.zip\"", - "$dl_dir = strip_ext $dl", - "Invoke-RestMethod $dl_url -OutFile $dl", - "Expand-Archive $dl $dl_dir -Force", - "Expand-Archive \"$dl_dir\\bun-windows-x64.zip\" $dl_dir -Force", + "$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", - "Rename-Item $dl $($dl -replace 'unknown', $ver) -Force", - "Remove-Item $dl_dir -Recurse -Force", - "$ret = \"$ver#$buildId#$artifactId\"", - "$ret" + "Remove-Item -Path $dl_path, $dl_dir\\bun-windows-x64 -Recurse -Force", + "Write-Output $ver" ], - "regex": "(?\\S+)#(?\\d+)#(?\\d+)" + "regex": "(?\\S+)" }, "autoupdate": { "architecture": { "64bit": { - "url": "https://nightly.link/oven-sh/bun/suites/$matchBuildid/artifacts/$matchArtifactid#/dl.zip" + "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" } } }