httptoolkit / mockrtc

Powerful friendly WebRTC mock peer & proxy
Apache License 2.0
286 stars 10 forks source link

Update node-datachannel to 0.5.x #5

Open ptrcnull opened 11 months ago

ptrcnull commented 11 months ago

0.5.0 fixes an issue when building from source on modern Linux systems: https://github.com/murat-dogan/node-datachannel/pull/183

pimterry commented 11 months ago

I am looking into this, but it's a little tricky, due to a) newly flaky tests in this repo (I think due to Chrome changes?) and b) node-datachannel 0.5.0+ moving to pure ESM, so it can't easily be used in CommonJS modules like this one.

Nothing insurmountable, but it might take a little while. Any PRs or testing to help work through those issues is very welcome :smile:

ptrcnull commented 11 months ago

so it can't easily be used in CommonJS modules like this one.

when setting up http toolkit server, hotpatching require to import in pre-compiled TS code:

const NodeDataChannel = import("node-datachannel");

worked for me just fine :p however, i'm not sure if that wouldn't require modernising the tsconfig to the new import method to work properly

pimterry commented 11 months ago

:laughing: very neat. Probably not the solution I want to ship into production though I'm afraid! I'll let you know once I've got something working here.

pimterry commented 11 months ago

Oh, to be clear: it's probably going to require converting this module to ESM too, as a new breaking release, so you might want to be prepared for that downstream.

pimterry commented 11 months ago

I've just released v0.3.2, which uses the latest node-datachannel (without migrating to ESM, by using https://github.com/nktnet1/import-sync internally). @ptrcnull Can you test it out and let me know if that works for you now?