Skip to content

fix: support Windows host runtimes and stable native caching#15

Merged
mertushka merged 2 commits into
mainfrom
fix/windows-cmake-delay-load-hook
Jun 14, 2026
Merged

fix: support Windows host runtimes and stable native caching#15
mertushka merged 2 commits into
mainfrom
fix/windows-cmake-delay-load-hook

Conversation

@mertushka

@mertushka mertushka commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Purpose

Fix Windows native addon loading under compatible Node-API host runtimes and prevent stale vcpkg caches from rebuilding OpenSSL on every CI run.

Root cause

The addon linked delayed node.exe imports but omitted ${CMAKE_JS_SRC}. Under Bun on Windows, the first Node-API call could cross into a separately loaded Node runtime and crash the process. The standard cmake-js win_delay_load_hook.cc redirects those imports to the active host runtime.

Windows CI also cached vcpkg_installed under a key that ignored the MSVC toolset. GitHub Actions could restore an ABI-incompatible exact cache, vcpkg would remove and rebuild OpenSSL, and the immutable cache entry could not be replaced.

Changes

  • Add ${CMAKE_JS_SRC} to the native addon target.
  • Extend the native integration check to require the cmake-js delay-load hook.
  • Rotate the Windows vcpkg cache namespace.
  • Include the active MSVC toolset version in the cache key, falling back to the runner image version.

Impact

  • Native/build impact: Windows addon linkage includes the standard cmake-js delay-load hook.
  • CI impact: the first run populates a fresh toolset-specific vcpkg cache; later runs should reuse OpenSSL instead of rebuilding it.
  • Public API impact: none.
  • WPT/conformance impact: none; WebRTC semantics are unchanged.
  • Browser impact: none.
  • Bun impact: fixes the observed Windows native-addon load crash. This does not add a Bun support claim.

Validation

  • npm run build
  • npm run check
  • npm run native:check
  • npm test (52/52)
  • Bun 1.3.14 Windows x64: package load and peer construction
  • Bun 1.3.14 Windows x64: two-peer offer/answer, data-channel open, TSFN event delivery, string message exchange, and cleanup
  • PowerShell MSVC toolset detection against Visual Studio Build Tools
  • Composite action YAML parse
  • git diff --check

@mertushka mertushka changed the title fix: include Windows Node-API delay-load hook fix: support Windows host runtimes and stable native caching Jun 14, 2026
@mertushka mertushka marked this pull request as ready for review June 14, 2026 03:24
@mertushka mertushka merged commit 1ce5b7f into main Jun 14, 2026
19 checks passed
@mertushka mertushka deleted the fix/windows-cmake-delay-load-hook branch June 14, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant