summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlegendecas <legendecas@gmail.com>2021-06-19 15:32:31 +0800
committerMichaƫl Zasso <targos@protonmail.com>2021-09-04 15:14:27 +0200
commit1a6bf1c4a3151112fbea79297d2385242a45a9fa (patch)
treeb52d9ffb3df529335993f3fa55ff7ec409cd877b /src
parentbaaa397e39beae42800304f6e1229257c3ff4285 (diff)
downloadnode-new-1a6bf1c4a3151112fbea79297d2385242a45a9fa.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/node_errors.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/node_errors.cc b/src/node_errors.cc
index c05bf1732b..94e19f70aa 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -819,9 +819,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(
@@ -862,7 +863,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);