JavaScript News

AdonisJS v6 Released: TypeScript, ESM, and Beyond

AdonisJS, a Node.js web application framework, has released its latest major release AdonisJS v6. Notable highlights include a transition to ECMAScript Modules (ESM), an improved and simplified IoC container, improved TypeScript integration, and a more straightforward approach to route and controller binding. Additionally, the release introduces a new validation library called VineJS, Vite integration for bundling frontend assets, and an overhauled scaffolding system with a codemods API.

One of the key highlights of AdonisJS v6 is the migration to ECMAScript Modules (ESM) and TypeScript, aligning the framework with modern JavaScript standards. This move ensures compatibility with the latest versions of packages and enhances security by allowing the use of the latest security fixes. AdonisJS v6 applications will now use TypeScript and ESM by default, though users can still install and use packages written in CommonJS.

The release also bids farewell to TypeScript compiler hooks, a notable feature in AdonisJS v5. In v6, the framework eliminates the need for these hooks, resulting in regular JavaScript imports without relying on the official TypeScript compiler API. This change simplifies the codebase and allows developers to choose other Just-In-Time (JIT) tools like ESBuild or SWC.

Type safety is enhanced in AdonisJS v6, featuring improvements to routes, controllers, middleware references, AdonisRC files, and event emitters. The adoption of direct imports replaces the use of magic strings in routes and controllers, resulting in improved type safety and enhanced code readability. Named middleware references and AdonisRC files are now managed through TypeScript references, contributing to better code intelligence and an improved developer experience.

The introduction of class-based events is another noteworthy enhancement in AdonisJS v6. Developers can now define events as classes, encapsulating both the event identifier and data within a single class. This approach enhances type safety and provides a cleaner way to structure events in the application.

AdonisJS v6 embraces Vite as the official frontend bundler, moving away from recommending Webpack Encore for new projects. The release also brings a new scaffolding system and codemods API, providing a more streamlined and efficient way to configure packages and scaffold resources. In addition, it introduces VineJS as the official validation system. VineJS aims to offer improved speed, comprehensive features, and a more developer-friendly API compared to the previous validation module.

The documentation for AdonisJS was also improved in the release, covering previously undocumented topics like IoC Container and Service providers. The framework aims to provide developers with comprehensive guides and references to facilitate a smoother learning curve.

Looking ahead, the AdonisJS team outlined future plans for AdonisJS v6. The focus will be on stabilizing the framework, fixing bugs, and improving the migration guide. Several packages, such as Drive, Limiter, Lucid Slugify, Attachment Lite, Route model binding, and Health checks, are expected to be migrated to AdonisJS 6 in the coming weeks.


Shakeel Shahid

About Author

Leave a comment

Your email address will not be published. Required fields are marked *

You may also like

JavaScript News

JQuery 4.0.0 Beta Released with Important Deprecations and Breaking Changes

 Timmy Wilison recently announced the beta release of jQuery 4.0. The new version of jQuery is a large release with
JavaScript News

The Guardian Creates a Newsroom Collaboration Tool Using Serverless, React and GraphQL

The Guardian created Pinboard, a discussion and asset-sharing tool integrated into a variety of content management platforms used by the company. The