Deno 1.31, the latest version of the rival Node.js runtime for JavaScript, TypeScript, and WebAssembly, adds package.json
support. The new feature is one of several enhancements designed to make it easier for developers to transition existing Node.js projects.
Deno will now automatically detect a package.json
and use it to install and resolve the dependencies used. This also allows the execution of project-specific scripts defined in the scripts
section with deno task
. However, current support is limited to simple scripts. Programs like rimraf
either cross-env
won’t work yet, but support for them will be added in a future release.
Deno 1.31 also stabilizes the Node-API (N-API). Developers no longer need to use the unstable
flag when using NPM packages that are based on this API. Lots of bug fixes applied to Node-API and more packages can be used without issue. The remaining bugs will be addressed in the coming weeks.
Additionally, Deno 1.31 moves the Node.js compatibility layer directly into the Deno runtime. Previously, Node.js support was provided through the use of https:/deno.land/std.node
, a collection of polyfills in userspace code in the Deno standard library. Because the dependency of https://deno.land/std
it had to be updated with each Deno release, the compatibility layer had to be downloaded after each update. The compatibility layer is now integrated into the runtime, and snapshots of the V8 JavaScript engine are used to reduce startup time. The tighter integration makes it easier to fill in missing APIs and improves the performance of built-in Node.js modules. To use embedded polyfills, developers can import from node: specifiers
.
Released on February 24, Deno 1.31 can be accessed via deno upgrade
for current users. Other installation options are listed on GitHub. Deno 1.31 follows last month’s release of Deno 1.30, which improved compatibility with Node.js modules.
Also in Deno 1.31:
- In a major change, pointers are now represented as plain or null objects for null pointers. These objects are created by V8 and are supported by the V8 Fast API, which improves FFI (External Function Interface) performance when working with
“pointer”
write parameters and return values from older versions. Pointer objects are opaque and cannot be manipulated directly from JavaScript. Thus, FFI becomes safer to use, since pointer spoofing is no longer as easy as typing a JavaScript number. Please note that the FFI API is unstable. - He
Deno.Command
andDeno.osUptime()
APIs are now stabilized. Developers are advised to migrate from theDeno.run()
API forDeno.Command
. - He
Deno.build.os
The API now returns more variants for operating systems, such as"darwin"
,"linux"
,"windows"
and"solaris"
. - For the standard library, modules for
https://deno.land/std/node
have been removed. This code is now directly embedded in the Deno runtime. - For the command interface, the
deno bundle
The command is no longer supported and will not appear in the help output. - Also for the CLI,
deno benchcode
now accept a--json
flag that will print the reference results as JSON. - The interactive permission prompt now accepts a new option,
A
. This option enables the granting of permissions for subsequent API calls using the granted domain. deno compile
now understands dynamic imports that can be resolved at compile time.
Copyright © 2023 IDG Communications, Inc.
Be First to Comment