Skip to content
Commit Detail

Commit 1d8cfaa

Author
Pete Bacon Darwin <pbacondarwin@cloudflare.com> 2026-02-13 12:43:41 +0000
Parents
dd7a515
Tree
403fc30
Make node:worker_threads independent of expose_global_message_channel flag

The node:worker_threads module was previously importing MessageChannel and
MessagePort from globalThis, which meant it only worked when the
expose_global_message_channel compatibility flag was enabled.

This change introduces a new internal module (cloudflare-internal:messagechannel)
that exposes MessageChannel and MessagePort for use by built-in modules,
independent of the global flag.

Changes:
- Add MessageChannelModule C++ class in messagechannel.h
- Register cloudflare-internal:messagechannel as an internal module
- Update node:worker_threads to import from the internal module
- Add TypeScript type definitions for the internal module
- Remove expose_global_message_channel from worker_threads tests

This unblocks cloudflare/workers-sdk#12043 which needs worker_threads to
work without requiring the global flag.

Files changed