From 83c8239e49abd652f5148f34add9192c5bb4ad17 Mon Sep 17 00:00:00 2001 From: "Thomas.G" Date: Wed, 31 Jul 2024 23:03:13 +0200 Subject: [PATCH] fix: type issues in api.d.ts (#287) --- types/api.d.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/types/api.d.ts b/types/api.d.ts index 51d372f..90ce3d2 100644 --- a/types/api.d.ts +++ b/types/api.d.ts @@ -1,5 +1,8 @@ -import { Warning } from "./warnings.js"; -import { Statement } from "meriyah/dist/src/estree.js"; +import { + Warning, + WarningName +} from "./warnings.js"; +import { Statement } from "meriyah"; export { AstAnalyser, @@ -114,6 +117,15 @@ interface EntryFilesAnalyserOptions { loadExtensions?: (defaults: string[]) => string[]; } +declare class SourceFile { + constructor(source: string, options: any); + addDependency(name: string, location?: string | null, unsafe?: boolean): void; + addWarning(name: WarningName, value: string, location?: any): void; + analyzeLiteral(node: any, inArrayExpr?: boolean): void; + getResult(isMinified: boolean): any; + walk(node: any): "skip" | null; +} + declare class EntryFilesAnalyser { constructor(options?: EntryFilesAnalyserOptions); @@ -123,7 +135,9 @@ declare class EntryFilesAnalyser { analyse(entryFiles: (string | URL)[]): AsyncGenerator; } -declare class JsSourceParser implements SourceParser {} +declare class JsSourceParser implements SourceParser { + parse(source: string, options: unknown): Statement[]; +} declare function runASTAnalysis(str: string, options?: RuntimeOptions & AstAnalyserOptions): Report; declare function runASTAnalysisOnFile(pathToFile: string, options?: RuntimeFileOptions & AstAnalyserOptions): Promise;