-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Instrument calls to libraries #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're on the right track. Couple of comments:
- 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...
- The Error approach is a no-go; it will have an unacceptably massive performance hit. Also, it's maybe a bit too complicated; appmap-ruby skips tracing
if current_package.shallow? && last_package == current_package
(where package is just an appmap.yml package: entry), which is extremely simple and works well in practice. This also allows shallow mode to work for user (eg. path:) packages, a feature occasionally useful.
src/hooks/standardLibs.ts
Outdated
@@ -0,0 +1,152 @@ | |||
import assert from "node:assert"; | |||
|
|||
import { ESTree } from "meriyah"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to use import type
when applicable to make it clear when code is being imported vs. just types.
5f31df6
to
7d321a0
Compare
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. |
b3e4888
to
970d733
Compare
It was trivial for built-ins. For third party libs I managed to do it by implementing |
46de9c8
to
988deeb
Compare
988deeb
to
6132680
Compare
1c5375a
to
b13d2e4
Compare
6a1f9e5
to
153af06
Compare
153af06
to
efa6a7b
Compare
efa6a7b
to
a8b9fbf
Compare
Fixes #83