Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These definitely would need to use the
emitWarning()
mechanism. Also, I'd prefer if these were opt-in and gated by a command line flag.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.
Im not familiar with those functions, but it does sound better than just
printf(stderr
…Does emitwarning elide duplicate warnings? i.e. only print a warning once?
I think it is major because it's long standing behavior.
( @aduh95 out of curiosity, just to keep myself up to date, what is the major use case that you see for without-intl — smaller size, and/or embedded devices, ?)
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.
The
emitWarning()
API does a number of things... (a) it ensures that all warnings are emitted in a consistent format, (b) it allows warnings to be supressed using command-line flag or environment variables, (b) it forwards the warnings to theprocess.on('warning')
event which is emitted even if the warning output to the console has been disabled (allowing warnings to be logged using third party tools). It does not currently limit warnings to be printed only once unless those areDeprecationWarning
orExperimentalWarning
but that is something we can look at later.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.
@srl295 As a matter of fact, I don't use it :) I stumbled upon this weird behavior when working on #35091, so I figure that was probably not intentional.
@jasnell do you know if
emitWarning
API is available from C++-land and how to access it? I agree that is the "correct" way to do it, but I didn't manage to get it working.Another approach I have thought of would be to call the
punycode
JS module, but again I don't know if that's possible from C++-land. That would remove the need for a warning (or a throw).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.
Yes, do a search in
src
forProcessEmitWarning
and you'll see how to make that happen