From 0612155f911e192d8c4cac877a29a6567ca6a8ef Mon Sep 17 00:00:00 2001 From: Abdou-Raouf ATARMLA <achilleatarmla@gmail.com> Date: Tue, 25 Jun 2024 11:43:53 +0000 Subject: [PATCH] chore: add deprecation warnings for legacy `runASTAnalysis` and `runASTAnalysisOnFile`. (#276) These warnings are added to inform users that these APIs will be removed in v8 and encourage them to use `AstAnalyser` instead. Fixes #266 --- index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.js b/index.js index 9241d2d..8e2225d 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,14 @@ function runASTAnalysis( str, options = Object.create(null) ) { + process.emitWarning( + 'The runASTAnalysis API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.', + { + code: 'DeprecationWarning', + detail: 'The runASTAnalysis API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.' + } + ); + const { customParser = new JsSourceParser(), customProbes = [], @@ -28,6 +36,14 @@ async function runASTAnalysisOnFile( pathToFile, options = {} ) { + process.emitWarning( + 'The runASTAnalysisOnFile API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.', + { + code: 'DeprecationWarning', + detail: 'The runASTAnalysisOnFile API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.' + } + ); + const { customProbes = [], customParser = new JsSourceParser(),