-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
module: add module.stripTypeScriptTypes #55282
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
7c1529b
to
ecc1d82
Compare
ecc1d82
to
56fcf17
Compare
I think it makes more sense for it to be just in its own API as a function, which can be used to strip the type before the text is passed into any of the |
56fcf17
to
80fa828
Compare
there's also #54250 |
eca9ab2
to
f41d422
Compare
Unfortunately it seems to have been stalled for a while. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #55282 +/- ##
==========================================
- Coverage 88.40% 88.40% -0.01%
==========================================
Files 653 654 +1
Lines 187600 187673 +73
Branches 36117 36126 +9
==========================================
+ Hits 165854 165915 +61
+ Misses 14974 14973 -1
- Partials 6772 6785 +13
|
50afe56
to
9ab643f
Compare
I think this could be benefited from a dedicated module |
Maybe putting it on module also makes sense? Or module.typescript if we can foresee adding other typescript-related utilities in the future |
I'm ok with a new module, I think parser is ok, I'd like to hear more opinions about it |
If we decide to ship it I'll drop the vm commits |
If this needs to be a new module, then it should be added to node/lib/internal/bootstrap/realm.js Line 130 in b4e8f1b
require('parser') without the node: prefix, otherwise it breaks https://www.npmjs.com/package/parser or anyone creating an alias of parser in node_modules.
|
76ff249
to
4fbcb6c
Compare
Yes, it manipulates source code without evaluating it (even though its not js) |
1f6b897
to
777ea5d
Compare
Failed to start CI⚠ Something was pushed to the Pull Request branch since the last approving review. ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/11327838941 |
5956acc
to
ede9ffe
Compare
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'm sorry for doing this, but I think we shouldn't introduce a new module just for a single method. This should live in node:util with similar functions like parseEnv.
@anonrig I feel like I motivated the decision in previous comment, that function that manipulate source code without evaluating should be moved to this module, like |
@marco-ippolito I think this is a textbook case for calling a vote. I dislike the use of name
|
ede9ffe
to
4d72bec
Compare
I moved it to the |
4d72bec
to
f7f29c3
Compare
This PR introduces a new api in
node:module
.Fixes: #54300