Summary by TwinMind · 32m 52s
Summary by TwinMind · 32m 52s
The Importance Of Deno 2.0
The Importance Of Deno 2.0
Theo - t3․gg
Theo - t3․gg
Deno 2.0 Release Overview
- Largest update since 1.0, includes major changes like node's process global
- Final 1.x version was 1.46, now releasing 2.0 release candidate
- Philosophical shifts: preferring
deno installover deprecateddeno cache - Created by Ryan Dahl (node.js creator) as response to regrets about node design
- Originally meant to reorganize node (D-no = undo node)
Global Variables Changes
- Window Global Removal
- Window global caused compatibility issues with libraries
- Libraries check for window to determine browser vs server environment
- Led to bugs in libraries that would otherwise work in Deno
- Deno 1.40 discouraged window globals, suggested Global this or self instead
- Process Global Addition
- Widely requested feature for node compatibility
- Previously required importing from
node:process - Popular frameworks rely on process being in global scope
- New
no-process-globallint rule encourages explicit imports - Helps frameworks like Next.js work seamlessly
Dependency Management Improvements
- Deno Add Command Enhancements
- Now handles specifiers with sub-paths
- Automatically adds newest version when version not specified
- Supports package format scope names starting with @
- JSR or npm prefixes now required to avoid ambiguity between registries
- Package.json Integration
- If project contains package.json, npm dependencies go there instead of deno.json
- Support for dev dependencies using
-Dflag
- New Commands
deno installsupports entry point flag for selective dependency installationdeno removesubcommand for quick dependency removal
- Lock File Improvements
- New lock file format similar to pnpm
- Better merge conflict resolution
- Improved error messages with helpful hints
Permission System Overhaul
- Deno's security model: requires explicit permissions for file system, network access
- Default behavior: operations fail without proper permissions
- New error handling: special errors instead of OS-level errors
- Catchable errors within code for better error handling
- Various permission changes for file access, network access
Node.js Compatibility Improvements
- CommonJS Support Enhancement
- Previously focused on ESM, now better CommonJS support
- Can run
.cjsfiles directly withdeno run - Can import CommonJS files with
.cjsextension - Support for requiring ES modules from CommonJS
- Better error messages for CommonJS issues
- Node Modules Directory Handling
- Three modes: none (default for Deno-first), auto, manual (default for package.json projects)
- "Bring your own node_modules" functionality
- Better compatibility with frameworks like Next.js, Remix, SvelteKit
- Node API Compatibility
- Much more flushed out node crypto support
- Async local storage more performant and reliable
- Net.isPort and portfinder support
- npm Puppeteer and Playwright more reliable
Breaking Changes
- Bundle Command Deprecated
- Previously allowed creating standalone executables
- Similar to Vercel's ncc but includes Deno runtime
- New built-in bundler coming in future updates
- Import Assertions → Import Attributes
- Keyword changed from
asserttowith - Proposal underwent major changes
- Some browsers unshipped import assertions support
- Keyword changed from
New Features
- Doc Tests
- Type check and execute examples in JSDoc comments
deno test --docensures examples stay up to date- Can execute code blocks in markdown files
- TypeScript Updates
- Ships with TypeScript built-in
- New default settings: noImplicitOverride, useUnknownInCatchVariables
- Built-in support for @types/node v22
- Allow list for compiler options
- Web GPU APIs
- Now stable, no longer require flags
CLI and Configuration Changes
- Escape commas in file names support
- Various permission system updates
- Better error messages throughout
- Improved backwards compatibility
JSR Package Registry
- New package registry built by Deno team
- Works with Node, Deno, and Bun
- Built-in TypeScript support
- Documentation generated from type definitions
- Goal to improve npm package management pain points
