This content originally appeared on Bits and Pieces - Medium and was authored by Fernando Doglio
An overview of the release notes of Deno 1.27
In October, the Deno team released version 1.27, and in this article we’re going to quickly analyze how good that update was.
You see, release notes tend to be filled with details that sometimes are hard to understand or even can confuse those not working directly on the release.
So I’m going to cover what I consider to be the most exciting piece of updates. And you can tell me if you agree with me or not at the end!
Inlay Hints
This update is not part of Deno but rather part of TypeScript 4.4. Thanks to the fact that Deno has TS integrated into it, it gains the benefit as well.
In particular, inlay hints are type hints provided by the TS compiler that can be shown by your IDE to add extra information to the code without the need to add explicit type hints.
In other words, the TS compiler is getting a lot smarter and now you can see how it’s interpreting your code, even when you don’t specify types in it.
This helps keep the code clean while at the same time providing the added value of the hints.
The immediate place where you can see the effects of this update, is on your VSCode IDE. If you’re using a different IDE, you’ll have to see if it’s already able to show inlay hints, otherwise, you’re not going to benefit from this new feature.
If you’re a VSCode user, make sure you have the latest version of the IDE, the latest version of the Deno plugin and version 1.27 of Deno installed on your system.
Now, keep in mind TypeScript 4.4 was released more than a year ago, and the “inlay hints” wasn’t the only feature that was added with it. So Deno is actually capable of doing a lot more coupled with an IDE like VSCode. Check out TS release notes if you’d like to know more about that.
Improved registry completion
Like before, this is not specifically an improvement on the language itself, but rather on a related service.
In this particular case, we’re talking about the search engine that powers the registry completion. That service is used by your IDE (usually if it’s “smart” enough) when you’re trying to import something into your code.
Mind you, the search was already there, but now you get extra information like module description and popularity indicator. This comes in handy when you don’t have a centralized package manager like NPM handling all that information.
Granted, by the looks of it, Deno is trying to achieve something similar with this. We’ll just have to way and see how far they want to take it.
Improved NPM support
Since version 1.25 Deno has made available the compatibility with NPM for developers to start using it and providing feedback.
This release continues to add support for NPM in the hopes of exponentially increasing the number of libraries available for the runtime.
While there is still more work ahead, this release added things like:
- Pulling types from NPM packages that provide them for TypeScript files.
- Added support for Node-API (it was called N-API before). This is major because this API is used to run native code in Node.js and many packages make use of it. Mainly ones like parcel , sqlite3 , usb and others. This opens up the doors for those packages to now be compatible with Deno.
There are other improvements as well, but these are the 2 most exciting ones.
Added “navigator.language” — ”navigator.languages” API
This one is a bit strange, although I guess I understand why they went with it.
One of the major philosophies guiding the Deno implementation so far, has been to be fully compatible with the web’s APIs. Essentially, every single standard out there around JavaScript will have to be implemented into Deno, even if it’s not being used by any browser at the moment.
The Deno runtime is, mainly, a back-end runtime just like Node. However, they’ve added the navigator.language and navigator.languages APIs used to understand the user’s preference in regards to language.
Normally, the value from navigator.language is a string that can be influenced, in the case of Deno, by environment variables like LC_ALL for Linux systems. And in the case of navigator.languages (notice the plural form) is an array having the value of navigator.language as its first element. Usually the rest of the values are influenced by the Accept-Language header sent by the client, but in the case of Deno, that information is not yet clear although I would expect them to follow the same standard.
The Deno API changed a bit
Don’t worry though, it wasn’t a bad change, instead some previously unstable methods are not marked as stable, so you don’t need to specify the unstable flag.
These are:
- Deno.consoleSize()
- Deno.futime()
- Deno.futimeSync()
- Deno.loadavg()
- Deno.osRelease()
- Deno.stdin.setRaw()
- Deno.utime()
- Deno.utimeSync()
And some others, like Deno.kill() , Deno.getGid() , Deno.getUid() , and others were slightly changed, so check out the new docs if you’re using them.
Did you like what you read? Consider subscribing to my FREE newsletter where I share my 2 decades’ worth of wisdom in the IT industry with everyone. Join “The Rambling of an old developer” !
There is a new version of V8
Deno is using version 10.8 of the JavaScript runtime engine (V8), and the interesting bit about this, is that incorporating the new updated version also brings new features into the language, simply because the team behind V8 has already added them.
In particular, the most notable update coming in V8 is the addition of more array methods that let you modify the content and return a new array as a result.
For example, you’ll now have the toReversed() method, which will reverse an array and return the new version without affecting the original array.
You’ll also gain the toSorted() method, to sort the values of an array and return them as a new one.
This is a Stage 3 proposal, which means the implementation is somewhat finished, but they’re looking for feedback from users to understand if further refinement is required. If everything goes well, Stage 4 should be the final stage of the proposal where it’s indicated that the feature is ready to be added to the ECMAScript standard.
If you follow closely these updates, and others like the recent Node 19 release announcement, you’ll start seeing how they “get inspired” by each other. Node adding the --watch flag and Deno starting to provide an NPM-like service for searching packages. Will this trend eventually take them to become one single runtime?
What do you think?
This particular update added many features that are great from the Developer Experience point of view (like the inlay hints from TypeScript), but not many that fundamentally change the language.
Are you excited about these updates?
Build composable web applications
Don’t build web monoliths. Use Bit to create and compose decoupled software components — in your favorite frameworks like React or Node. Build scalable and modular applications with a powerful and enjoyable dev experience.
Bring your team to Bit Cloud to host and collaborate on components together, and speed up, scale, and standardize development as a team. Try composable frontends with a Design System or Micro Frontends, or explore the composable backend with serverside components.
Learn More
- How We Build Micro Frontends
- How we Build a Component Design System
- The Composable Enterprise: A Guide
- 7 Tools for Faster Frontend Development in 2022
Deno 1.27 is out, let’s see what’s new! was originally published in Bits and Pieces on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Bits and Pieces - Medium and was authored by Fernando Doglio
Fernando Doglio | Sciencx (2022-11-21T08:01:49+00:00) Deno 1.27 is out, let’s see what’s new!. Retrieved from https://www.scien.cx/2022/11/21/deno-1-27-is-out-lets-see-whats-new/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.