-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making Node.js code compatible with Deno #2
Comments
their difference in appearance? |
How about those rely on Node's core API? |
@motss via polyfills, |
Sounds interesting. Considering that Deno has a different security model would the compiler or whatever is generating the code be aware of this? Or are you thinking of making the generated code "less secure" by being permissive ( |
@scanf The generated code should work the same as normal Deno code, Deno will only ask for permissions when needed. |
How about working with the package author to support Deno? |
@motss that's like working with the package author to support TypeScript 😂which won't work since not everyone has the time / interest in doing so. |
Which is more or less same as: npx webrunify ./index.js > ./dist/index.js
deno dist/index.js Where However, bundling stuff together is an easy part. Next wall you'll gonna hit is unfortunate fact that your compiler can't produce bundles that are guaranteed to pass typescript's type checking. That is important because So you essentially need to prepend your bundle with |
There is also webpack powered PoC: https://github.com/reggi/node-to-deno Also let me point you to two related
But I'm just a reader who did few local tests, @reggi knows all nasty details and what is needed here is his expertise |
Problem
There are many great Node.js libraries that are also useful in Deno ecosystem, it would be a waste of time to reinvent the wheels from scratch for Deno.
Solution
Creating a compiler, probably on top of webpack, to generate Deno-compatible code from Node.js code.
denoify ./index.js -o ./dist/index.js deno dist/index.js # it works
👍 If you like this idea
The text was updated successfully, but these errors were encountered: