Rewrite in ESM and refactoring internals
Pre-release
Pre-release
This release sits on the last major pre-release and has following breaking changes on top of it.
- The main export now uses the default export to export the
Hooks
class. Earlier it was a named export. - The types are moved to a separate subpath export.
// Earlier import type { HooksHandler } from '@poppinss/hooks' // Now import type { HooksHandler } from '@poppinss/hooks/types'
- The
Hooks
class now allows defining types for the known events well in advance. This makes the class and the underlying methods type safe. As a result, some of the types likeHooksHandler
needs generics to know the type of the arguments - The
hooks.runner
method does not accept the 2nd argument for ignoring hooks by name. Instead, you should call therunner.without
method.// Earlier hooks.runner('creating', ['hashPassword']).run() // Now hooks.runner('creating').without(['hashPassword']).run()
Rest of the APIs are same, infact a few more methods have been added.
Commits
- chore: ignore package-lock file 84e84cd
- ci: fix import url to be cross platform dcfdda7
- docs(README): grammatical improvements 2eb9845
- docs: add documentation 87b8b8d
- refactor: improve events generic type 816f7fd
- docs(README): initial docs 828aae8
- feat: add support to register hook providers a6cbe7b
- refactor: rewrite in TypeScript 378e487
Full Changelog: v6.0.2-0...v7.0.0-0