Other breaking changes
Here's a list of some breaking changes that are not covered by the patches provided by the upgrade-kit.
Encryption package
- Zero breaking changes in the functional API
Env
- Zero breaking changes in the functional API
Config
- Remove undocumented
Config.mergemethod.
Logger
- Zero breaking changes in the functional API.
- Add support for multiple loggers.
- Upgrade to latest version of Pino.
Events
- Remove deprecated
trapandtrapAllmethods. - Remove
namespacemethod. Since we are opting for standard imports and not magic string based imports, thenamespacemethod is no longer relevant. - Add assertion methods like
assertNoneEmitted,assertNotEmitted,assertEmitted.
Bodyparser
- Remove
file.moveToDiskmethod from the bodyparser source code. However, you can still use this method if you have@adonisjs/drivepackage installed. - Removed
queryStringconfig option from raw bodyparser config block. The option was unused and hence has no breaking change at runtime, but will give static type error. - Add support for
convertEmptyStringsToNullfor JSON parser as well. - rename
whitelistedMethodsproperty toallowedMethods.
Session
- Add
@adonisjs/session/session_middlewareto the middleware list in order to enable sessions. In v5, it was not needed.
Encore
- No breaking changes
- Zero breaking changes in the functional API.
- Add
alwaysToandalwaysFrommethods. - Add
assertSent,assertNotSent,assertNoneSentto write assertions during testing.
Ally
- Zero breaking changes
Hash
-
Remove
Hash.isFakedproperty since it serves no use case. -
The
Hash.extendmethod signature has been changed.// EarlierHash.extend('md5', (manager, mappingName, config) => {console.log(manager === Hash) // true})// NowHash.extend('md5', (config) => {})
Repl
- Zero functional breaking changes.
- Top-level imports do not work in REPL mode. It is a limitation of Node.js. However, you can use dynamic imports to import ES modules.
Container
IoC Container has been rewritten from scratch and has received a massive API refactor. Since, the container is the foundation of the framework, there was no easy way to avoid this massive refactor.
With that said, the API changes will not impact the applications written in AdonisJS. The breaking changes will impact packages though.
Read the release notes for following releases.
Application
The application module has also received significant breaking changes. Please consult the following release notes.
- https://github.com/adonisjs/application/releases/tag/v6.0.0-0
- https://github.com/adonisjs/application/releases/tag/v6.3.0-0
- https://github.com/adonisjs/application/releases/tag/v6.8.0-0
Http server
The Http server module has received significant changes. Please refer to the following release notes.
- https://github.com/adonisjs/http-server/releases/tag/v6.0.0-0
- https://github.com/adonisjs/http-server/releases/tag/v6.1.0-0
- https://github.com/adonisjs/http-server/releases/tag/v6.2.0-0
Shield
- Remove DNS prefetching guard, since it is not a standard feature anymore. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
i18n
- Rename
i18nManager.getSupportedLocaletoi18nManager.getSupportedLocaleFor. - Rename
i18nManager.getFallbackLocaletoi18nManager.getFallbackLocaleFor. provideValidatorMessagesconfig option was removed, in favor ofapp/Middleware/DetectUserLocale:export default class DetectUserLocaleMiddleware {static {RequestValidator.messagesProvider = (ctx) => {return ctx.i18n.createMessagesProvider()}}}- Other config options (located at
config.i18n.ts) changed:// Earlierimport { I18nConfig } from '@ioc:Adonis/Addons/I18n'const i18nConfig: I18nConfig = {translationsFormat: 'icu',loaders: {fs: {enabled: true,location: app.resourcesPath('lang'),},},}// Nowimport { defineConfig, formatters, loaders } from '@adonisjs/i18n'const i18nConfig = defineConfig({formatter: formatters.icu(),loaders: [loaders.fs({location: app.languageFilesPath()})],})
Redis
- No longer emit events using the AdonisJS global event emitter. These events were never documented.