toposort
toposort copied to clipboard
Deno support
Can you please add Deno support? Since this project doesn't have any dependency it should be fairly easy
What does deno need?
You don't really need anything but mod.js file is welcome
Cool. You're welcome to submit a pull request in case you don't want to wait for me to get around to this :)
Cool. You're welcome to submit a pull request in case you don't want to wait for me to get around to this :)
@marcelklehr I started to work on it so I added the file mod.js
export * as topsort from './index.js';
And then I wanted to test if this work so I import it and got the error
error: Uncaught ReferenceError: module is not defined
module.exports = function(edges) {
There are a couple of options to solve this issue:
- Change the code to use the
export
keyword, not a good option cause this will break some node's version capabilities. - import module from
https://deno.land/[email protected]/node
(Deno Node compatibility) to support CommonJS (CJS) importing. import big file for small change - Developers that want to use this with Deno will need to use some CDNs that convert node project to browser compatible package (
module
is not needed). An example of CDN that will work is SkyPack and there are more.
I prefer the 3rd option, which won't change the code and can prevent possible errors (which is critical cause many libraries depend on this) If you want I can update the README with instructions for how to use this library with Deno.
Love to hear what you think