From 1940114ac323695c758f21a00394b958a68d8428 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 2 Apr 2019 07:56:14 +0200 Subject: util: highlight stack frames Using `util.inspect` on errors is going to highlight userland and node_module stack frames from now on. This is done by marking Node.js core frames grey and frames that contain `node_modules` in their path yellow. That way it's easy to grasp what frames belong to what code. PR-URL: https://github.com/nodejs/node/pull/27052 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- lib/internal/util/inspect.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'lib/internal/util/inspect.js') diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index a31ee5b8eb..08f627db88 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -86,6 +86,8 @@ const { const assert = require('internal/assert'); +const { NativeModule } = require('internal/bootstrap/loaders'); + let hexSlice; const inspectDefaultOptions = Object.seal({ @@ -115,6 +117,9 @@ const strEscapeSequencesReplacerSingle = /[\x00-\x1f\x5c]/g; const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/; const numberRegExp = /^(0|[1-9][0-9]*)$/; +const coreModuleRegExp = /^ at (?:[^/\\(]+ \(|)((?