From 5d8d8594b1a3dba20c2da6f2d3b74423d4a6494b Mon Sep 17 00:00:00 2001 From: fraxken Date: Wed, 31 Jul 2024 21:36:20 +0200 Subject: [PATCH] fix: type issues in api.d.ts --- 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;