mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
util: preserve function names without source map names
Signed-off-by: Hiroki Osame <hiroki.osame@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65108 Fixes: https://github.com/nodejs/node/issues/65104 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
1 parent
5fbbad6e82
commit
ed019e4854
3 files changed
+10
-2
No files matched your search
+1
-2
@@ -537,8 +537,7 @@ function reconstructCallSite(callSite) {
|
||||
if (!entry?.originalSource) return;
|
||||
return {
|
||||
__proto__: null,
|
||||
// If the name is not found, it is an empty string to match the behavior of `util.getCallSite()`
|
||||
functionName: entry.name ?? '',
|
||||
functionName: entry.name || callSite.functionName,
|
||||
scriptName: entry.originalSource,
|
||||
lineNumber: entry.originalLine + 1,
|
||||
column: entry.originalColumn + 1,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
const{getCallSites}=require('node:util');function foo(){process.stdout.write(JSON.stringify(getCallSites({sourceMap:true})[0]))}foo();
|
||||
//# sourceMappingURL=get-call-sites-function-name-mapped.map
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["get-call-sites-function-name-original.js"],
|
||||
"sourcesContent": ["const { getCallSites } = require('node:util'); function foo() { process.stdout.write(JSON.stringify(getCallSites({ sourceMap: true })[0])); } foo();"],
|
||||
"mappings": "AAAA,KAAM,CAAE,YAAa,EAAI,QAAQ,WAAW,EAAG,SAAS,KAAM,CAAE,QAAQ,OAAO,MAAM,KAAK,UAAU,aAAa,CAAE,UAAW,EAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAG,CAAE,IAAI",
|
||||
"names": []
|
||||
}
|
||||
Reference in new issue
Block a user