diff --git a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift index 22935bd0..04aedb94 100644 --- a/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift +++ b/Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift @@ -225,3 +225,8 @@ public extension JSPromise { } #endif + +// See `Sources/JavaScriptKit/XcodeSupport.swift` for rationale of the stub functions. +#if !arch(wasm32) + func _unsafe_event_loop_yield() { fatalError() } +#endif diff --git a/Sources/JavaScriptKit/XcodeSupport.swift b/Sources/JavaScriptKit/XcodeSupport.swift index 9689cf3b..ac5f117b 100644 --- a/Sources/JavaScriptKit/XcodeSupport.swift +++ b/Sources/JavaScriptKit/XcodeSupport.swift @@ -1,10 +1,10 @@ import _CJavaScriptKit /// Note: -/// Define all runtime function stubs which are imported from JavaScript environment. -/// SwiftPM doesn't support WebAssembly target yet, so we need to define them to -/// avoid link failure. -/// When running with JavaScript runtime library, they are ignored completely. +/// Define stubs for runtime functions which are usually imported from JavaScript environment. +/// JavaScriptKit itself supports only WebAssembly target, but it should be able +/// to be built for host platforms like macOS or Linux for tentative IDE support. +/// (ideally, IDE should build for WebAssembly target though) #if !arch(wasm32) func _set_prop( _: JavaScriptObjectRef,