mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
@libp2p/webrtc imports @ipshipyard/node-datachannel/polyfill which requires native C++ compilation. Stub provides ESM+CJS exports for both main and polyfill subpaths with no-op WebRTC classes. Also ignores pnpm-lock.yaml in cspell and copies stubs dir in Dockerfiles.
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
// Stub polyfill for @ipshipyard/node-datachannel/polyfill (CJS)
|
|
class RTCPeerConnection {
|
|
constructor() {}
|
|
close() {}
|
|
createDataChannel() { return new RTCDataChannel(); }
|
|
createOffer() { return Promise.resolve({}); }
|
|
createAnswer() { return Promise.resolve({}); }
|
|
setLocalDescription() { return Promise.resolve(); }
|
|
setRemoteDescription() { return Promise.resolve(); }
|
|
addIceCandidate() { return Promise.resolve(); }
|
|
addEventListener() {}
|
|
removeEventListener() {}
|
|
}
|
|
class RTCSessionDescription {
|
|
constructor(init) { this.type = init?.type ?? ''; this.sdp = init?.sdp ?? ''; }
|
|
}
|
|
class RTCIceCandidate {
|
|
constructor(init) { this.candidate = init?.candidate ?? ''; this.sdpMid = init?.sdpMid ?? null; this.sdpMLineIndex = init?.sdpMLineIndex ?? null; }
|
|
}
|
|
class RTCDataChannel {
|
|
constructor() { this.readyState = 'closed'; }
|
|
close() {}
|
|
send() {}
|
|
addEventListener() {}
|
|
removeEventListener() {}
|
|
}
|
|
class RTCDataChannelEvent {
|
|
constructor(type, init) { this.type = type; this.channel = init?.channel ?? null; }
|
|
}
|
|
module.exports = { RTCPeerConnection, RTCSessionDescription, RTCIceCandidate, RTCDataChannel, RTCDataChannelEvent };
|