Skip to content

Commit eecbf11

Browse files
authored
fix: adjust bootstrap script (#658)
* fix: `process.std*` are not exposed in main worker * fix: expose `MessagePort`
1 parent afb0fd0 commit eecbf11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/runtime/js/bootstrap.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ const globalScope = {
263263
performance: writable(performance.performance),
264264

265265
// messagePort
266+
MessagePort: nonEnumerable(messagePort.MessagePort),
266267
MessageChannel: nonEnumerable(messagePort.MessageChannel),
267268
structuredClone: writable(messagePort.structuredClone),
268269

@@ -768,7 +769,6 @@ globalThis.bootstrapSBEdge = (opts, ctx) => {
768769
});
769770
}
770771

771-
const nodeBootstrap = globalThis.nodeBootstrap;
772772
if (nodeBootstrap) {
773773
nodeBootstrap({
774774
runningOnMainThread: true,
@@ -783,6 +783,8 @@ globalThis.bootstrapSBEdge = (opts, ctx) => {
783783
delete globalThis.bootstrapSBEdge;
784784
};
785785

786+
const nodeBootstrap = globalThis.nodeBootstrap;
787+
786788
globalThis.bootstrap = {
787789
dispatchLoadEvent,
788790
dispatchUnloadEvent,
@@ -794,3 +796,4 @@ globalThis.bootstrap = {
794796

795797
core.setUnhandledPromiseRejectionHandler(processUnhandledPromiseRejection);
796798
core.setHandledPromiseRejectionHandler(processRejectionHandled);
799+
nodeBootstrap({ warmup: true });

0 commit comments

Comments
 (0)