fix(install): let Rolldown name the missing binding; repair on every OS

The first cut derived the package from `binding-${platform}-${arch}` with an
exact-suffix match, which never matches Windows (`-msvc`) or Linux
(`-gnu`/`-musl`) names, so the repair only ever worked on macOS and
install.sh had to gate it there. Rolldown's own loader already resolves
platform, arch and libc and prints the exact `@rolldown/binding-*` it wanted
in its error chain; parse that instead and drop the gate. Also spawn npm
through a shell on Windows (Node refuses to spawn npm.cmd directly) and trim
the tests to the two invariants (no-op when it loads; installs exactly what
the loader asked for, then re-probes).
This commit is contained in:
teknium1
2026-09-17 00:14:09 -07:00
committed by Teknium
parent f67cad172e
commit 3dcf0d49ad
3 changed files with 41 additions and 82 deletions

View File

@@ -3566,11 +3566,11 @@ install_desktop() {
log_info "Installing desktop workspace dependencies (includes Electron ~150MB, 1-3min)..."
local _deps_start _deps_remaining
_deps_start=$(date +%s)
if run_with_timeout "$DESKTOP_BUILD_TIMEOUT" bash -c 'cd "$1" && npm ci --include=optional && { [ "$2" != macos ] || node apps/desktop/scripts/ensure-rolldown-binding.mjs; }' _ "$INSTALL_DIR" "$OS"; then
if run_with_timeout "$DESKTOP_BUILD_TIMEOUT" bash -c 'cd "$1" && npm ci --include=optional && node apps/desktop/scripts/ensure-rolldown-binding.mjs' _ "$INSTALL_DIR"; then
log_success "Desktop workspace dependencies installed"
elif _deps_remaining=$(( DESKTOP_BUILD_TIMEOUT - ($(date +%s) - _deps_start) )); \
[ "$_deps_remaining" -lt 30 ] && _deps_remaining=30; \
run_with_timeout "$_deps_remaining" bash -c 'cd "$1" && npm install --include=optional && { [ "$2" != macos ] || node apps/desktop/scripts/ensure-rolldown-binding.mjs; }' _ "$INSTALL_DIR" "$OS"; then
run_with_timeout "$_deps_remaining" bash -c 'cd "$1" && npm install --include=optional && node apps/desktop/scripts/ensure-rolldown-binding.mjs' _ "$INSTALL_DIR"; then
log_success "Desktop workspace dependencies installed"
elif _electron_pkg_staged_missing_dist "$INSTALL_DIR"; then
log_warn "Desktop dependency install failed with a missing Electron dist; attempting self-heal..."