Skip to content
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

util: add sourcemap support to getCallSites #55589

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

marco-ippolito
Copy link
Member

Fixes: #55109

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/typescript

@nodejs-github-bot nodejs-github-bot added module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Oct 29, 2024
@marco-ippolito marco-ippolito marked this pull request as ready for review October 30, 2024 10:54
@marco-ippolito marco-ippolito added the semver-minor PRs that contain new features and should be released in the next minor version. label Oct 30, 2024
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.40%. Comparing base (68dc15e) to head (8a14517).
Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55589      +/-   ##
==========================================
- Coverage   88.40%   88.40%   -0.01%     
==========================================
  Files         654      654              
  Lines      187637   187640       +3     
  Branches    36098    36103       +5     
==========================================
- Hits       165887   165879       -8     
- Misses      14994    15002       +8     
- Partials     6756     6759       +3     
Files with missing lines Coverage Δ
lib/util.js 97.75% <100.00%> (+0.43%) ⬆️

... and 33 files with indirect coverage changes

doc/api/module.md Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
test/fixtures/typescript/ts/test-callsite.ts Outdated Show resolved Hide resolved
doc/api/module.md Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
lib/internal/source_map/source_map_cache.js Outdated Show resolved Hide resolved
test/es-module/test-module-get-callsite.mjs Outdated Show resolved Hide resolved
@marco-ippolito marco-ippolito force-pushed the mapCallSite branch 5 times, most recently from 2bc03cf to fe8f181 Compare October 30, 2024 19:09
@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 31, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 31, 2024
@nodejs-github-bot

This comment was marked as outdated.

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that if we want to fix #55109 instead of adding a new function, we should just improve the support of the existing util.getCallSite(). What about accepting a config and then proceeding with module mapping inside node:util?

@marco-ippolito
Copy link
Member Author

marco-ippolito commented Oct 31, 2024

I agree that if we want to fix #55109 instead of adding a new function, we should just improve the support of the existing util.getCallSite(). What about accepting a config and then proceeding with module mapping inside node:util?

With a new function it is more flexibile because you can decide which frame to map, instead of mapping all of them, and you can also mock.
It doesn't exclude that we could also improve support in util.getCallSite by adding an option.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment has been minimized.

@legendecas
Copy link
Member

Not a big fan of the polymorphism that derived from the ambiguity of the name util.getCallSite which actually returns an array of call site object.

Submitted #55626 to not hijacking this thread.

doc/api/module.md Outdated Show resolved Hide resolved
@marco-ippolito marco-ippolito changed the title util: add sourcemap support to getCallSite util: add sourcemap support to getCallSites Nov 2, 2024
Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

lib/util.js Show resolved Hide resolved
lib/util.js Outdated Show resolved Hide resolved
lib/util.js Show resolved Hide resolved
test/fixtures/typescript/ts/test-get-callsite-explicit.ts Outdated Show resolved Hide resolved
doc/api/util.md Outdated Show resolved Hide resolved
@marco-ippolito marco-ippolito force-pushed the mapCallSite branch 2 times, most recently from dc30bee to c1d8caf Compare November 3, 2024 09:27
@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 3, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 3, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@marco-ippolito
Copy link
Member Author

marco-ippolito commented Nov 3, 2024

Of course output matching on windows path is different, I have to update tests

@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2024
@nodejs-github-bot
Copy link
Collaborator

doc/api/util.md Outdated Show resolved Hide resolved
@marco-ippolito marco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2024
@nodejs-github-bot
Copy link
Collaborator

@marco-ippolito marco-ippolito added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 4, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 4, 2024
@nodejs-github-bot nodejs-github-bot merged commit d35cde6 into nodejs:main Nov 4, 2024
59 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in d35cde6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[22.9.0] util.getCallSite() doesn't report original line number for TS files
7 participants