Time flies Node has released it’s version 10 and it’s going under the codename “Dubnium”. Its been over seven years since Node was released and it’s their 7th major release. Now let’s jump into what’s new in node 10 and what they have deprecated in their new release!
Node has released its stable version to 10.1.0 and therefore the new unleash line with active LTS (Long Term Support, currently v8.11.2) support will begin from October of 2018 and it’ll be for long three years. Releases within the future Support line target Performance, security, stability, extended support, and providing a reliable platform for applications of any scale.
Node 10 features and improvements
Improved HTTP & HTTP/2 in node 10
HTTP/2 is a higher performer than it’s the previous version of HTTP. The implementation of HTTP/2 has landed in Node.js v8.4.0(LTS) as an associate degree experimental feature. With Node v10 the hypertext transfer protocol two modules have become a stable addition to the Node core for net applications and also the web platform.
Loading an online page is extremely intensive, as hypertext transfer protocol solely permits one outstanding request per-protocol association however HTTP/2 supports queries multiplexing that allows multiple requests at constant time and thus rushing up the method of delivering web content and content. Google giving a ranking boost for fast-loading websites. With HTTP/2, your web site ought to load quicker than the antecedent hypertext transfer protocol, meaning that your website should enjoy boosted rankings on search engine results pages makes it’s SEO friendly.
What’s introduced in HTTP/2
- Multiplexing
- Single Connection
- Server Push
- Prioritization
- Header Compression
Overall, HTTP/2 is commencing to wind down because the implementation becomes a lot of and more stable and performant. The goal is to maneuver it out of experimental standing as presently as doable in 2018.
N-API is no longer experimental
N-API is an Associate in Nursing API that enables developers to make native Add-ons. When JavaScript performance isn’t enough for providing the performance boost to the codebase we used Node.JS Add-ons by providing Associate in the Nursing interface between JavaScript running in Node.js and C/C++ libraries. we will use that interface to make dynamically-linked shared objects in C++ that we can load into a Node.js application through a require() operate. Add-ons are the same as Node.js modules however offers a performance boost for computationally hard to please applications once required.
The goal is to safeguard Addons to be stable across all versions of Node.js modules compiled for one version will run on later versions while not re-compilation. so that they have added the appliance Binary Interface (ABI) stable module genus Apis (N-API) as Associate in Nursing formally supported API layer.ABI is incredibly a lot of the same as API. after you write ASCII text file, you access the library through Associate in Nursing API. Once the code is compiled, your application accesses the binary information within the library through the ABI. The ABI defines the structures and strategies that your compiled application can use to access the external library (just like the API did), solely on a lower level. If the program access specific library which library is later updated, you don’t want to have to re-compile that application. If the updated library uses constant ABI, then your program won’t be got to amendment.N-API adds ABI stability to Node.js helps module maintainers and production deployments.
Performance improvements with V8 Engine v6.6
Node.js V8 has been updated to its version 6.6 in Node.js ten with warranted forward ABI compatibility with V8 half-dozen.7. that comes with Chrome sixty-six and provides a reduction of around 20–40% in each analysis and compilation time of JavaScript.Promise and async/await execution has improved considerably, ensuing in Hapi v17 realizing a 30% increase in output.
We will expect Node.js v10 an enormous profit during this space, additionally brings Async generators and array performance enhancements. Array#reduce has increased by over ten for porous double arrays. The performance of Async generators in conjunction with Async iterations was significantly improved.
Upgrade to OpenSSL version 1.1.1
The culmination of the TLS one.3 specification, an enormous leap forward for the safety of the online applications, the OpenSSL team discharged its one.1.1 (Beta four ) in might, the first feature of that is TLS one.3 support. Node.js10 is that the 1st unleash to incorporate OpenSSL one.x sets it up for a simple API and ABI stable upgrade when OpenSSL one.1.1 released. Recent work by OpenSSL and also the Core Infrastructure created it potential for Node.js ten to essentially benefit of OpenSSL as well as the ChaCha20 cipher and Polu1305 critic.
NPM v6 ships immediately
Node ten has updated its NPM from v5.7 to v6.0. This major version increase in NPM provides associate degree improvement all told areas as well as the main target on performance, security, and stability giving major performance boost compared to previous versions of NPM. Continuous progress on security sorting for third-party NPM modules (not directly introduced to the Node ten or Node eleven unharness lines). a lot of data on NPM v6.
ESM Modules in Node v10
The downside is 2 module systems aren’t compatible the Modules Team had to seek out a correct resolution therefore JavaScript modules can be designed on a platform to be used each in Node and browsers. you’ll work this around victimization the module pattern, however, it still wasn’t extremely convenient.
By Introducing bundlers and ECMAScript Modules this downside is somewhat relieved, however not nevertheless absolutely resolved. Node.js has had its module system, however, ECMAScript vi brought a homogenous module system to JavaScript. Node’s module system is called CommonJS.Best fitted to the Node atmosphere solely and if you are trying to run a CommonJS come in the browser, you’ll get many red flags in dev tools.
Error-Handling Improvements
The sole thanks to matching error in node were in try-catch clauses to ascertain for the error message however users will only match the error message once handling errors during this approach. antecedently any changes to the text for a slip-up required to be delayed till a server major unleash, that means error changes couldn’t be created till the consequent major version of Node.js shipped. Node.js major versions ship each six months.
In Node ten they need additional error codes as all errors thrown by the Node.js APIs will through error code that should be readable for humans to begin with we don’t need to match error messages like we used to do in node previous versions.
Experimental Fs-promises
Nodejs v10 are shipping with associate degree experimental version of the fs package with guarantees.Node.js v8 introduced util.promisify to simply wrap functions that give a request API. currently, developers will utilize fs with promises-type Apis directly and in the best manner with no need the additional step.
New JavaScript Language Features
New JavaScript language features introduced in node.js v10
1. Function.prototype.toString()
This method returns exact slices of source text which include whitespace and comments.
2. The function trimLeft() and trimRight() becomes aliases for the newly implemented String.prototype.trimStart() and String.prototype.trimEnd() to ensure backward compatibility
3. The catch clause of try statements no longer requires a parameter.
APIs deprecated in Node 10
1. Using require() to access several of Node.js own internal dependencies will emit a runtime deprecation.
2. Use of the tls.convertNPNProtocols() method will emit a runtime deprecation warning.
3. Previously deprecated legacy Async_hooks APIs have reached end-of-life and have been removed.4. Previously deprecated internal getters/setters on the net. The server has reached end-of-life and has been removed.
Conclusion
The best thing is Node will continue improving and even add more new features for Node.js Developers to deliver reliable and scalable code. we are looking forward to the future integration with TLS 1.3 and @npm6.
As per the release schedule, Node.js 10 will become Node.js 10 “Dubnium” LTS in October 2018. This means that both the features shipping with Node.js 10 on release and any features that are developed and included before the LTS release date will be supported until April 2021.