Skip to content

Commit 0612155

Browse files
authored
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
1 parent a3af86a commit 0612155

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ function runASTAnalysis(
88
str,
99
options = Object.create(null)
1010
) {
11+
process.emitWarning(
12+
'The runASTAnalysis API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.',
13+
{
14+
code: 'DeprecationWarning',
15+
detail: 'The runASTAnalysis API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.'
16+
}
17+
);
18+
1119
const {
1220
customParser = new JsSourceParser(),
1321
customProbes = [],
@@ -28,6 +36,14 @@ async function runASTAnalysisOnFile(
2836
pathToFile,
2937
options = {}
3038
) {
39+
process.emitWarning(
40+
'The runASTAnalysisOnFile API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.',
41+
{
42+
code: 'DeprecationWarning',
43+
detail: 'The runASTAnalysisOnFile API is deprecated and will be removed in v8. Please use the AstAnalyser class instead.'
44+
}
45+
);
46+
3147
const {
3248
customProbes = [],
3349
customParser = new JsSourceParser(),

0 commit comments

Comments
 (0)