You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2022. It is now read-only.
It would be nice to have a Revolt library that is compatible with Deno. I already submitted an issue on the official JavaScript library, but let's also try and get this one working. There are two ways we can go about it: SkyPack or native.
SkyPack
SkyPack is a CDN meant to convert CommonJS modules to ESM. Currently, you could use this for Deno compatibility but this loses the typings, because SkyPack isn't seeing the typings file. Fortunately, the fix is easy; define the typings file in package.json, under a typings field
Native Compatibility
This would take significantly more work but it would mean that we are able to use the same library on Deno and Node.JS, without relying on a CDN. Since Deno could also natively run TypeScript files, it would mean significantly less work for publication and updating.
There are two major things that one would have to consider before changing our repo:
Deno relies on module imports with the extension
Node.js relies on module imports without the extension
Every static import would have to be changed to a dynamic one with the following code: import('<file path>' + ("Deno" in (window || {}) ? '.ts' : ''))
Also, while Node.js relies on a node_modules folder, Deno could import modules from anywhere. This means that the above problems would exist on every module we use as a dependency. It's probably best to start from the end (aka this library) and work our way up to the dependencies.
The text was updated successfully, but these errors were encountered:
I got some free time this week. 😄
Porting better-revolt.js to deno isn't hard since we depending on way less libraries than the official revolt.js
I think we can easily create an automated script to convert the whole library to deno, I saw something similar at postgres
I'll look into that tomorrow.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It would be nice to have a Revolt library that is compatible with Deno. I already submitted an issue on the official JavaScript library, but let's also try and get this one working. There are two ways we can go about it: SkyPack or native.
SkyPack
SkyPack is a CDN meant to convert CommonJS modules to ESM. Currently, you could use this for Deno compatibility but this loses the typings, because SkyPack isn't seeing the typings file. Fortunately, the fix is easy; define the typings file in package.json, under a typings field
Native Compatibility
This would take significantly more work but it would mean that we are able to use the same library on Deno and Node.JS, without relying on a CDN. Since Deno could also natively run TypeScript files, it would mean significantly less work for publication and updating.
There are two major things that one would have to consider before changing our repo:
Every static import would have to be changed to a dynamic one with the following code:
import('<file path>' + ("Deno" in (window || {}) ? '.ts' : ''))
Also, while Node.js relies on a node_modules folder, Deno could import modules from anywhere. This means that the above problems would exist on every module we use as a dependency. It's probably best to start from the end (aka this library) and work our way up to the dependencies.
The text was updated successfully, but these errors were encountered: