-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Feature: Deno support #2888
Comments
This issue is also being tracked on Linear. We use Linear to manage our development process, but we keep the conversations on Github. LINEAR-ID: d090669b-9ce7-4068-97dd-943e747a5912 |
Hey @sambacha, Thanks for this and the other issues/PRs that you opened. Now that 2.10 is out will evaluate all of them. I follow the deno ecosystem a bit, and I'm impressed with its progress. I haven't thought about how packages can work both in deno and node, but thanks for the pointer. Currently, Hardhat heavily depends on some node specific behavior. The major examples are the plugin system depending on how modules are loaded and cached, and Solidity dependencies on node's resolution algorithm. We consider both to be somewhat undesirable and we want to change them. If in the process we can make HH compatible with deno, that'd be great. |
Yup, I think actually adopting a new cache system would be the biggest boost given the benchmarks I have seen. The Deno stuff as you pointed out is not worth the squeeze. Now that EthereumJs is ESM compatible, maybe some potential avenues there. Congrats on the new release btw! |
The community asks for it! |
I give a bump to this. Hardhat would be great with Deno! Deno supports importing node_modules now so it should be possible to use hardhat with it and with the permission management I don't need to trust in dependencies. I can verify my app is not doing stuff I don't grant explicit access for. |
bumping this again for support for Deno 2.0 |
I'm trying Deno v2 support for Hardhat v3 at the moment, but there are some Deno issues that stop it from working:
|
Thanks for the details @SebastienGllmt, and for working through the blockers. Super helpful as always. We have worked in Hardhat 3 to significantly reduce the surface area of our Node API usage. The intention being to move us closer to supporting other runtimes. However this is a longer term objective and it is not an explicit goal of Hardhat 3 to run under deno or other runtimes. |
I noticed that you can bypass this issue entirely if you just comment out this line: https://github.com/NomicFoundation/hardhat/blob/v-next/v-next/hardhat/src/internal/cli/main.ts#L102 Note that this I tried disabling this line and building & plugins still work for me. It could be that (modulo the forge issue that can be hackily worked around) we might actually only be a single line change away from Deno support for hardhat v3 |
That's really interesting! Thanks for trying it out! I'm not against small changes like that in a best-effort approach. As @kanej mentioned, we'll first focus on shipping v3 before expanding to other runtimes, but we are intentionally relying less on node-specific apis. How can we detect if the system is running on Deno to avoid calling |
Yes, I tested that the following works as well // register is not supported in Deno: https://github.com/denoland/deno/issues/23201
if (typeof Deno === "undefined") {
if (options.registerTsx) {
register();
}
} It would be nice to confirm that |
I am guessing v3 of Hardhat is being planned. With that said It may be benifical to give Deno a serious consideration.
Native web worker support
see this issue about NodeJs having web worker support
sane FFI see https://deno.land/manual/runtime/ffi_api
X-Typescript-Types
HRE could adopt providing responses with a custom X-TypeScript-Types HTTP header when the types (.d.ts) is defined. This is useful for deno type checks (link).
Possibility for Interoperable packages
All required remote dependencies are referenced in a file called
deps.ts
and the required methods and classes are re-exported. The dependent local modules then reference the deps.ts rather than the remote dependencies. If now for example one remote dependency is used in several files, upgrading to a new version of this remote dependency is much simpler as this can be done just within deps.ts.see https://deno.land/manual/examples/manage_dependencies
Maintain NodeJS Compatibility easily with
dnt
Deno to NodeJs
dnt
allows you to develop your Deno module mostly as-is and use a single Deno script to build, type check, and test an npm package in an output directory. Once built, you only need to npm publish the output directory to distribute it to Node.js users.WebAssembly and Rust
The old bottleneck for web performance used to be the network. But the new bottleneck for web performance is the CPU, and particularly the main thread. Packets go brrrrrrrr. Really though moving towards decoding wasm vs parsing javascript is where we want to be heading right?
Don't listen to any of this, I just wanted to hear yall's thoughts on the idea, I did not find an issue with respect to the scope of this topic.
Cheers, and happy July 4th!
The text was updated successfully, but these errors were encountered: