Closed tracker1 closed 2 years ago
Hi,
Because of bundling issues with commonjs modules (axios, qs) and trying to make them work on every environment, I've rewritten the core and have removed the 3rd party dependencies in v0.2.0.
Now the library is using only fetch()
which should be supported by Deno (haven't got the time to test, but the documentation says that it is since Deno v1.0.0).
As a bonus the size was also reduced, from ~75kb to ~23kb (or ~5kb gzipped!).
Please give it a try and share your feedback.
I'll close the issue for now, because I'm not planning to make the library Deno first, because it will complicate the build process and will introduce some maintenance burden since I'm not very uptodate with Deno.
The recent fetch rewrite should simplify loading the SDK, but if anyone is still having difficulties, feel free to let me know and I'll research it more thoroughly.
The build process won’t be complicated: Just use deno2node
or https://github.com/denoland/dnt.
Here’s a Deno-first library we’ve been working on for years, that supports CJS Node.js and browsers as well: https://github.com/grammyjs/grammy
global.fetch = require('node-fetch');
for the node build.Deno requires a
.ts
as part of the import statement, by doing that change and adding a/mod.ts
in the root of the project containingexport * from "./src/index.ts
it would be easy enough for deno users to reference from github raw content directly (in the near term).From there, easy enough to make a clone of the
src/
directory, and remove the.ts
in the import lines... would only need to change the existing build configuration to make that copy, with the changes, then usetmp-src
for tests and builds for browser and node usage.Note: this would make testing slightly more complex... but could probably replace the test harness with Deno's built in testing framework. Which would simplify dependencies and output.
After that, could do a publish to
https://deno.land/x
to make the package more easy to discover. I know it may seem backward to suggest targeting the least used platform first, but it would be the easiest path towards the other two.If there's interrest, I'd be happy to help on such a transition.