From bb79d61efe88d71879f57be114e9fb50312146d9 Mon Sep 17 00:00:00 2001 From: Patrick Eriksson Date: Mon, 4 Oct 2021 22:10:29 +0200 Subject: [PATCH 1/2] Print the ignoreList-values in a more helpful way than the default --- packages/babel-core/src/config/config-chain.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/babel-core/src/config/config-chain.ts b/packages/babel-core/src/config/config-chain.ts index 0ebf606312f7..527caab83ac4 100644 --- a/packages/babel-core/src/config/config-chain.ts +++ b/packages/babel-core/src/config/config-chain.ts @@ -1,4 +1,5 @@ import path from "path"; +import { inspect } from "util"; import buildDebug from "debug"; import type { Handler } from "gensync"; import { validate } from "./validation/options"; @@ -779,6 +780,20 @@ function configFieldIsApplicable( return matchesPatterns(context, patterns, dirname); } +/** + * Print the ignoreList-values in a more helpful way than the default. + */ +function ignoreListReplacer( + _key: string, + value: IgnoreList | IgnoreItem, +): IgnoreList | IgnoreItem | string { + if (value instanceof RegExp) { + return inspect(value); + } + + return value; +} + /** * Tests if a filename should be ignored based on "ignore" and "only" options. */ @@ -793,6 +808,7 @@ function shouldIgnore( context.filename ?? "(unknown)" }" because it matches one of \`ignore: ${JSON.stringify( ignore, + ignoreListReplacer, )}\` from "${dirname}"`; debug(message); if (context.showConfig) { @@ -806,6 +822,7 @@ function shouldIgnore( context.filename ?? "(unknown)" }" because it fails to match one of \`only: ${JSON.stringify( only, + ignoreListReplacer, )}\` from "${dirname}"`; debug(message); if (context.showConfig) { From f0dc8d2df9a48a4e0f276d3a9c950a4ca57e05e3 Mon Sep 17 00:00:00 2001 From: Patrick Eriksson Date: Wed, 6 Oct 2021 11:45:55 +0200 Subject: [PATCH 2/2] Replace util.inspect() with String() --- packages/babel-core/src/config/config-chain.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/babel-core/src/config/config-chain.ts b/packages/babel-core/src/config/config-chain.ts index 527caab83ac4..ab93397c75ca 100644 --- a/packages/babel-core/src/config/config-chain.ts +++ b/packages/babel-core/src/config/config-chain.ts @@ -1,5 +1,4 @@ import path from "path"; -import { inspect } from "util"; import buildDebug from "debug"; import type { Handler } from "gensync"; import { validate } from "./validation/options"; @@ -788,7 +787,7 @@ function ignoreListReplacer( value: IgnoreList | IgnoreItem, ): IgnoreList | IgnoreItem | string { if (value instanceof RegExp) { - return inspect(value); + return String(value); } return value;