Deno 2 represents a major advancement for the JavaScript/TypeScript runtime, aiming for scalability and compatibility with existing JavaScript infrastructure even as its core principles of simplicity, security, and a comprehensive toolchain remain the same.
Key highlights:
-
Node.js and npm Compatibility: As with Node 12, Deno 2 sits inside the existing Node ecosystem and developers are able to run this Node application & use npm packages from Deno projects. This includes support for package.json, node_modules, and (for example) npm workspaces. At the same time, the announcement reads: "Deno 2 is backward compatible with Node, and npm." That means you can run Deno from within your existing Node projects as well as gradually integrate Deno's full toolchain as one all in one tool.
-
Enhanced Package Management: New commands like deno install, deno add, and deno remove offer a streamlined experience for managing dependencies, further bridging the gap with familiar Node.js workflows. Deno boasts significant speed improvements in dependency installation compared to npm: "deno install is 15% faster than npm with a cold cache, and 90% faster with a hot cache."
-
Introducing JSR: Deno 2 introduces JSR, a modern JavaScript registry built for the future. JSR features native TypeScript support, streamlined module loading, and automatic documentation generation, offering a compelling alternative to npm.
-
Stable Standard Library: Deno's Standard Library, a collection of audited utility modules, achieves stability in Deno 2, providing developers with a reliable set of tools for common tasks. This reduces reliance on external dependencies and streamlines development.
-
LTS Releases: Recognizing the needs of enterprise users, Deno 2 introduces Long Term Support (LTS) releases, providing stability and peace of mind for production deployments.
-
Performance Enhancements: Deno 2 continues to improve performance across various metrics, including startup time and request handling, ensuring a smooth developer experience and optimal efficiency in production. However, it's important to note that: "The first HTTP benchmark shown above was conducted using Deno 1.45, not Deno 2.0. In reality, Deno 2.0 is about 20% slower than indicated here. This difference is due to our recent disabling of V8 pointer compression to address cases where users exceeded the 4GB heap limit."
Deno 2 addresses concerns about straying from its original vision:
"Deno’s goal is not to become a Node clone in Rust or a drop-in replacement. Our aim is to level up JavaScript, moving beyond 2010-era CommonJS and narrowing the gap between server-side and browser environments in a way that developers can adopt practically. We refuse to accept that JavaScript must remain a tangle of mismatched tooling and endless layers of transpilation, unable to evolve."
Deno 2 represents a strategic step forward, balancing the practicality of embracing the existing JavaScript ecosystem with its forward-looking vision for simplifying and modernizing web development. This release empowers developers to leverage the strengths of both worlds, utilizing familiar tools and workflows while benefiting from Deno's innovative features and focus on security and performance.
The above is the detailed content of Deno s Finally Here: Key Highlights. For more information, please follow other related articles on the PHP Chinese website!