Deno 1.39 released: WebGPU is back, plus better Node.js compatibility, and TypeScript 5.3

Deno 1.39 released: WebGPU is back, plus better Node.js compatibility, and TypeScript 5.3

Deno 1.39 is out with WebGPU support, new coverage reporters, better Node.js compatibility and TypeScript 5.3, though the team also warns about coming breaking changes in TypeScript decorators.

WebGPU has appeared in Deno before, as “experimental support” in March 2021. At the time the team said that “we believe JavaScript, instead of Python, could act as an ideal language for expressing mathematical ideas if the proper infrastructure existed,” promoting the API for general purpose GPU compute as well as GPU rendering. However a year later, in Deno 1.32, WebGPU was removed, the reason being that “supporting WebGPU introduced a cost that made deno binaries bigger and slower to start up for all users, even if they didn’t use it.”

Those issues appear now to be resolved, though the feature is still designated unstable meaning that use requires the –unstable-webgpu flag. The Deno team says though that the specification is stable and that the API is a “a solid foundation for developers to build on.” 

WebGPU is a W3C API and the Deno implementation is based on the same core as that in Firefox. The API was supported on Google Chrome since version 113 in May 2023. WebGPU is the successor to WebGL, which did not handle general-purpose GPU coding well.

Deno Coverage is a tool for reporting test coverage. New in this version is the ability to output a report either as a summary table, or to HTML. The output can be hosted on a static file server such as GitHub Pages. 

Node.js compatibility is improved in this release, with support for running executables in the node_modules/.bin directory in deno tasks, support for CommonJS entrypoints in node_modules, additional Node.js APIs, and more.

TypeScript 5.3 ships with this release, important since Deno is a TypeScript-first tool. There is a complication though regarding TypeScript decorators, declarations attached to classes, methods, accessors, properties or parameters. TypeScript has long had decorators under an experimental flag, called Stage 2 decorators. TypeScript 5.0 introduced incompatible ECMAScript standard decorators known as Stage 3 decorators, though keeping its old behaviour when the experimental flag was used. Deno implemented the experimental decorators by default, which was perhaps a mistake. The team now warn that the next Deno release, 1.40, will change the default to be Stage 3 decorators, which is a breaking change – though one that can be avoided by adding the experimentalDecorators flag to the deno.json configuration file for a project.

Deno competitor Bun is not standing still, with three releases in the space of four days (1.0.16, 1.0.17 and 1.0.18), mainly bug-fixes and performance improvements, though the 1.0.17 release adds the top 500 npm packages to an allowlist so that preinstall, install and postinstall scripts will run without specific permission, greatly improving compatibility.

Regarding Deno 1.39, it is WebGPU that attracts most interest. “As someone who detests python, I really hope we can get some good TS WebGPU libs going,” remarked one developer.