The WHATWG Streams API was recently updated with a new hook for TransformStream cleanup. This allows cleaning up resources backing a transform stream when the stream is errored or aborted. Previously this sort of cleanup was only possible via the flush hook, which is only called when the readable stream naturally closes.
The spec PR can be found here: whatwg/streams#1283
WPT: https://wpt.fyi/results/streams/transform-streams/cancel.any.html?label=master&label=experimental&aligned