-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Emit warning if require will not comply with specification #3681
Conversation
@mstoykov do you intend to open the pull request dropping the support directly now? It would be useful to be sure we are not going to forget to act on this. |
Finally managed to finish it in #3694 |
var parent string | ||
var buf [2]goja.StackFrame | ||
frames := rt.CaptureCallStack(2, buf[:0]) | ||
parent = frames[1].SrcName() |
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.
Is this always safe? Is there any change to get frames
with only one or no items at all?🤔
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.
In all of the experiments I have ran in the last 4 months or so (this particular code is very old) I have had 1 panic when I called it when there was nothing running on the runtime.
As I would argue that is very much the wrong way to use it ... I am particularly certain it makes sense to capture this it seems.
The base branch was changed.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3681 +/- ##
==========================================
+ Coverage 73.26% 73.28% +0.02%
==========================================
Files 276 278 +2
Lines 20333 20386 +53
==========================================
+ Hits 14897 14940 +43
- Misses 4486 4496 +10
Partials 950 950
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Co-authored-by: Joan López de la Franca Beltran <[email protected]>
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.
Generally, it looks good to me.
One thing that could be improved is to migrate from the terms "correct" and "wrong" words.
Maybe instead, the wrong use of CommonJS specification is non-compliant? I know that's longer, but I'm trying to think from the user perspective how they understand what's the issue faster. WDYT?
872ce2c
to
79d8dab
Compare
@olegbespalov I used to call it "compliant" earlier .. but then I had to explain to what it is "compliant" and it becomes longer and longer. Arguably the linked issue is the much better place to find why this is happening and what needs to be done. Also as I explain in the issue - you are really unlikely to hit this issue at all. If you just use ESM syntax - babel transpile it correctly. If not ... you literally need to be doing dynamic So I expect this will have practically 0 comments. But we will see 🤞 |
What?
Add warning on require invocations that do not follow the specification.
Depends on #3680
Why?
As this isn't how it works we would like to fix it.
Also happens to be hard to keep it working once we move to ESM.
part of #3534
Checklist
make lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)