Skip to content

Commit

Permalink
fix: type issues in api.d.ts (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken authored Jul 31, 2024
1 parent 7aec5d9 commit 83c8239
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions types/api.d.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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);

Expand All @@ -123,7 +135,9 @@ declare class EntryFilesAnalyser {
analyse(entryFiles: (string | URL)[]): AsyncGenerator<ReportOnFile & { url: string }>;
}

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<ReportOnFile>;

0 comments on commit 83c8239

Please sign in to comment.