From acc2950736b858a6f46e33373d71e59c56a6838a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 11 Dec 2023 09:29:59 -0500 Subject: [PATCH] [mv3] Fine tuning ruleset output --- platform/mv3/make-rulesets.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/platform/mv3/make-rulesets.js b/platform/mv3/make-rulesets.js index 99663dcf9..6b608bf6f 100644 --- a/platform/mv3/make-rulesets.js +++ b/platform/mv3/make-rulesets.js @@ -297,9 +297,9 @@ function pruneHostnameArray(hostnames) { /******************************************************************************* * - * One rule per line for compromise between size and readability. This also - * means that the number of lines in resulting file representative of the - * number of rules in the ruleset. + * For large rulesets, one rule per line for compromise between size and + * readability. This also means that the number of lines in resulting file + * representative of the number of rules in the ruleset. * * */ @@ -318,9 +318,10 @@ function toJSONRuleset(ruleset) { } return v; }; + const indent = ruleset.length > 10 ? undefined : 1; const out = []; for ( const rule of ruleset ) { - out.push(JSON.stringify(rule, replacer)); + out.push(JSON.stringify(rule, replacer, indent)); } return `[\n${out.join(',\n')}\n]\n`; }