All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- New context API carries state down the tree without plumbing through arguments.
- New
ContextType<Handle>
utility type which gets the value type of a context.
- Renamed public type
ResourceContext
toResourceScope
. destroy(...)
is no longer allowed to destroy child resources, only roots.- Added tree-shaking metadata. This is useful for bundle analysis tools.
0.5.1 - 2023-08-12
- Added support for parametrized resources in
ResourceHandle<T>
.
0.5.0 - 2023-08-12
- Wardens is now published with ESM (
type=module
). It should be backwards compatible. - Now
destroy(...)
throws if you pass an object that wasn't constructed withcreate(...)
.
- If a resource fails while initializing, now all intermediate child resources are destroyed as well.
- If a resource fails while being destroyed, now its child resources are destroyed as well.
- Resources can no longer provision child resources after teardown. This closes a loophole where resources could escape destruction.
- New
ResourceHandle<T>
utility type represents the value returned when creating a resource.
0.4.1 - 2023-01-14
- Newer versions of TypeScript complained about signatures in
bindContext(...)
.
0.4.0 - 2022-06-19
- Support for provisioning resources through async functions instead of
Resource
subclasses. This offers better type safety around null conditions. - A new
Resource
utility type is exported. The new functional API expects you to return this interface.
- The
Resource
abstract class was removed. Use async functions instead. - The
Controls<...>
utility type was removed. Import the type you need from the module instead.
0.3.0 - 2022-06-04
- Prevent use of
allocate(...)
/deallocate(...)
outside a resource subclass. - Renamed
enter()
andleave()
tocreate()
anddestroy()
. - Renamed
mount()
andunmount()
tocreate()
anddestroy()
.
- Second type parameter to
Resource
is gone. Arguments toenter(...)
are now inferred. - No more default implementations for
enter(...)
/leave(...)
on resources.
0.2.0 - 2022-05-24
mount(...)
andallocate(...)
no longer require a config argument if the resource doesn't explicitly define one.
enter(...)
now supports variable arguments.
- The second generic parameter of
Resource
was a config parameter, but now it's an argument tuple. - The
ExternalControls
utility type was renamed toControls
.
0.1.0 - 2022-05-22
- Resource class for modeling asynchronously provisioned resources
mount
/unmount
hooks to provision resourcesallocate
/deallocate
for creating hierarchies of resources