随笔 - deno简要记录

Deno 是一个类似于 Node.js 的 JavaScript 和 TypeScript 运行器,基于 Rust 和 V8 JavaScript 引擎构建。它是由 Node.js 的最初发明者 Ryan Dahl 创建的,以应对他在 2009 年最初设计和发布 Node.js 时所犯的错误。

文章链接:

An Introduction to Deno: Is It Better than Node.js?
Comparing the performance between Node.js and Deno

Deno优势:

  1. Deno 对 TypeScript 的支持是一流的
  2. Deno 在运行JS和TS时候更加安全.维护安全性的部分方式是通过其 permissions system
  3. Deno 尽可能与 Web 浏览器兼容
  4. Deno 管理依赖项的方式和Node是最大的区别:Node.js用npm或yarn下载依赖包,而Deno使用URLs方式直接使用第三方包.

Deno does away with those mechanisms in favor of a more
browser-centric way of using third-party packages: URLs.

Deno使用ES modules方式,值得注意的是,文件扩展名必须始终存在,无论您是从绝对路径还是相对路径导入。

  1. Deno 提供了一个标准库 standard libary(stdlib),旨在成为 Go 标准库的松散端
  2. 在Deno中也可以使用NPM包: 如果某些 NPM 包依赖于 Node.js API可能无法在 Deno 中使用它们(尤其是如果 Deno 的 Node.js 兼容层不支持特定 API),但许多 NPM 包可以通过 CDN 在 Deno 中使用

While you may not be able to utilize some NPM packages in Deno if they rely on Node.js APIs (especially if the specific APIs are not supported in Deno’s Node.js compatibility layer), many NPM packages can be utilized in Deno through CDNs like esm.sh and skypack.dev. Both these CDNs provide NPM packages as ES Modules that can be subsequently consumed in a Deno script even if the author of the package did not design it to target Deno specifically.

简单总结:

1.Deno有很多优势,修复Nodejs中的一些不足
2.尽管现在Node.js有一些性能优于Deno,但随着Deno的发展会逐渐抹平差异
3.Deno第三方软件包的可用性较低是其不足的一个明显方面,而且较为年轻,没有经过实战考验.
4.Deno未来是个趋势,现在可以逐渐尝试

猜你喜欢

转载自blog.csdn.net/baidu_33438652/article/details/122957729