UNPKG

p5-analysis

Version:

API to find, create, and analyze p5.js sketch files.

38 lines (37 loc) 1.44 kB
declare type DefinitionType = 'function' | 'class' | 'variable'; interface ScriptAnalysis { /** Names that are defined in the script. This is a map of symbols to definitions types. */ defs: ReadonlyMap<string, DefinitionType>; /** Free variables that the script references. */ refs: ReadonlySet<string>; /** String arguments that occur in the first position to calls `loadImage()`, * etc. */ loadCallArguments: ReadonlySet<string>; p5propRefs: ReadonlySet<string>; } export declare class Script implements ScriptAnalysis { readonly source: string; readonly filename?: string | undefined; private _analysis?; private _syntaxError?; private _ast?; constructor(source: string, filename?: string | undefined); static set options({ cacheSize }: { cacheSize?: number; }); static fromSource(source: string, filePath?: string): Script; static fromFile(filePath: string): Script; private get cacheKey(); private get cacheDigest(); private get analysis(); private get ast(); get defs(): ReadonlyMap<string, DefinitionType>; get refs(): ReadonlySet<string>; get loadCallArguments(): ReadonlySet<string>; get p5propRefs(): ReadonlySet<string>; findMatchingComments(pattern: RegExp): readonly string[]; getErrors(): SyntaxError[]; getAssociatedFiles(): string[]; static getAssociatedFiles(file: string): string[]; } export {};