mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
lib: add api to detect whether source-maps are enabled
Add `process.sourceMapsEnabled` to detect whether source-maps are enabled. Fixes: https://github.com/nodejs/node/issues/46304 PR-URL: https://github.com/nodejs/node/pull/46391 Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
1 parent
b4a2be457c
commit
6bb400f8ec
4 files changed
+30
No files matched your search
@@ -326,6 +326,7 @@ process.emitWarning = emitWarning;
|
||||
|
||||
{
|
||||
const {
|
||||
getSourceMapsEnabled,
|
||||
setSourceMapsEnabled,
|
||||
maybeCacheGeneratedSourceMap,
|
||||
} = require('internal/source_map/source_map_cache');
|
||||
@@ -333,6 +334,14 @@ process.emitWarning = emitWarning;
|
||||
setMaybeCacheGeneratedSourceMap,
|
||||
} = internalBinding('errors');
|
||||
|
||||
ObjectDefineProperty(process, 'sourceMapsEnabled', {
|
||||
__proto__: null,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
get() {
|
||||
return getSourceMapsEnabled();
|
||||
},
|
||||
});
|
||||
process.setSourceMapsEnabled = setSourceMapsEnabled;
|
||||
// The C++ land calls back to maybeCacheGeneratedSourceMap()
|
||||
// when code is generated by user with eval() or new Function()
|
||||
|
||||
Reference in new issue
Block a user