mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
process: add api to enable source-maps programmatically
Add `process.setSourceMapsEnabled` to enable source-maps programmatically. PR-URL: https://github.com/nodejs/node/pull/39085 Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
e44ccd9aad
commit
cdf7251370
10 files changed
+170
-16
No files matched your search
+5
-4
@@ -820,9 +820,10 @@ void SetPrepareStackTraceCallback(const FunctionCallbackInfo<Value>& args) {
|
||||
env->set_prepare_stack_trace_callback(args[0].As<Function>());
|
||||
}
|
||||
|
||||
static void EnableSourceMaps(const FunctionCallbackInfo<Value>& args) {
|
||||
static void SetSourceMapsEnabled(const FunctionCallbackInfo<Value>& args) {
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
env->set_source_maps_enabled(true);
|
||||
CHECK(args[0]->IsBoolean());
|
||||
env->set_source_maps_enabled(args[0].As<Boolean>()->Value());
|
||||
}
|
||||
|
||||
static void SetEnhanceStackForFatalException(
|
||||
@@ -858,7 +859,7 @@ static void TriggerUncaughtException(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(SetPrepareStackTraceCallback);
|
||||
registry->Register(EnableSourceMaps);
|
||||
registry->Register(SetSourceMapsEnabled);
|
||||
registry->Register(SetEnhanceStackForFatalException);
|
||||
registry->Register(NoSideEffectsToString);
|
||||
registry->Register(TriggerUncaughtException);
|
||||
@@ -871,7 +872,7 @@ void Initialize(Local<Object> target,
|
||||
Environment* env = Environment::GetCurrent(context);
|
||||
env->SetMethod(
|
||||
target, "setPrepareStackTraceCallback", SetPrepareStackTraceCallback);
|
||||
env->SetMethod(target, "enableSourceMaps", EnableSourceMaps);
|
||||
env->SetMethod(target, "setSourceMapsEnabled", SetSourceMapsEnabled);
|
||||
env->SetMethod(target,
|
||||
"setEnhanceStackForFatalException",
|
||||
SetEnhanceStackForFatalException);
|
||||
|
||||
Reference in new issue
Block a user