swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.76k stars 73 forks source link

feat(register): return addHook result to it can be reverted #647

Closed Craga89 closed 2 years ago

Craga89 commented 2 years ago

Currently the register method doesn't return the result of pirates#addHook, which means you can't revert the registration of the hook. This is very useful in circumstances like jest-config, which temporarily registers the transform, reads the config file, then de-registers it. See below

https://github.com/facebook/jest/blob/199f9811ae68b15879cbe18b7ef7ebd61eefcf23/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L83-L101

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.