refactor: add EmitDeprecationWarning helper (#46879)

* refactor: add EmitDeprecationWarning helper

Also switches EmitWarning to using Node's ProcessEmitWarningGeneric

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

* chore: use node namespace for function call

Co-authored-by: David Sanders <dsanders11@ucsbalum.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
trop[bot] 2025-05-01 09:44:59 -05:00 committed by GitHub
parent ee65ab75f5
commit c24f330b45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 19 deletions

View file

@ -30,9 +30,19 @@ void EmitWarning(v8::Isolate* isolate,
std::string_view warning_type);
// Emit a warning via node's process.emitWarning(),
// using JavscriptEnvironment's isolate
// using JavascriptEnvironment's isolate
void EmitWarning(std::string_view warning_msg, std::string_view warning_type);
// Emit a deprecation warning via node's process.emitWarning()
void EmitDeprecationWarning(v8::Isolate* isolate,
std::string_view warning_msg,
std::string_view deprecation_code = "");
// Emit a deprecation warning via node's process.emitWarning(),
// using JavascriptEnvironment's isolate
void EmitDeprecationWarning(std::string_view warning_msg,
std::string_view deprecation_code = "");
// Run a script with JS source bundled inside the binary as if it's wrapped
// in a function called with a null receiver and arguments specified in C++.
// The returned value is empty if an exception is encountered.