powercord-org / powercord

A lightweight @discord client mod focused on simplicity and performance.
MIT License
1.2k stars 147 forks source link

[Feature Request] Publish libraries to NPM #575

Closed Martmists-GH closed 2 years ago

Martmists-GH commented 2 years ago

Describe the feature request Publish the libraries (like powercord/http which was mentioned in the docs, no clue which other ones exist) to NPM The reason for this is that kotlin/js requires npm to generate the dummy classes and methods required to compile against it.

What Plugin would it be for? N/A but it would enable support for Kotlin/JS

cyyynthia commented 2 years ago

Libraries will not be published to npm as they're part of a standard lib that exclusively makes sense in the context of Powercord running along with Discord. It also would be of no use as you still have the entire collection of modules from Discord (over 10,000 modules, that we have no way of typing in a feasible manner) untyped.

It makes little to no sense to use any form of type checking (and especially strict typing) as the very thing that allows Powercord to function is JS' tolerance for injecting everywhere without much regards for types, and you 100% cannot guarantee correctness of the types assigned to the exposed Discord modules (making type checking pointless).

The only realistic (and only sane) way of writing a plugin is through actual JavaScript, and is the only supported way of doing it (with the exception in cases where it makes sense to use WebAssembly binaries, which only make sense in computationally expensive workloads such as embedding ffmpeg).