getappmap / appmap-node

AppMap client agent for Node.js
Other
9 stars 4 forks source link

feat: Instrument calls to libraries #128

Closed zermelo-wisen closed 1 month ago

zermelo-wisen commented 6 months ago

Fixes #83

dividedmind commented 6 months ago
  • Will this work for ESM? I'm worried the whole approach will need to be different. Unless we can use the same trick for CJS-loading and hoping the hooked module will be cached across the two loaders...

BTW, I think if ESM support is going to be non-trivial it's ok to just do this for CJS for now and open a separate issue to add ESM support later.

zermelo-wisen commented 5 months ago
  • Will this work for ESM? I'm worried the whole approach will need to be different. Unless we can use the same trick for CJS-loading and hoping the hooked module will be cached across the two loaders...

BTW, I think if ESM support is going to be non-trivial it's ok to just do this for CJS for now and open a separate issue to add ESM support later.

It was trivial for built-ins. For third party libs I managed to do it by implementing resolve function in our custom loader.