UNPKG

p5-analysis

Version:

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

62 lines (61 loc) 2.4 kB
import { Category } from './Category'; export declare const p5Version = "1.4.0"; export declare namespace Library { type Properties = { name: string; categoryKey?: string; description: string; homepage: string; packageName?: string; repository?: string; importPath?: string; defines?: Record<'globals' | 'p5', string[]>; }; } /** A library that can be used with p5.js sketches. */ export declare class Library implements Library.Properties { private static _all; static get categories(): readonly Category[]; /** The human-readable name of the library. */ readonly name: string; /** The human-readable description of the library. */ readonly description: string; /** The library's home page. */ readonly homepage: string; /** The npm package name of the library. */ readonly packageName?: string; readonly repository?: string; readonly categoryKey?: string; /** Global variables (functions and classes) and p5.* properties that the * library defines. */ readonly defines?: Record<'globals' | 'p5', string[]>; private _importPath?; private constructor(); toJSON(): unknown; /** Adds a library from a record in a library.json file. */ static fromProperties(props: Library.Properties, { ifExists }?: { ifExists?: 'error' | 'replace'; }): Library; /** Adds all the libraries in the given library specification JSON file to the * global library array `Library.all`. */ static addFromJsonFile(jsonPath: string, defaultProps: Partial<Library.Properties>): readonly Library[]; static fromUrl(importPath: string): Library; static fromPackageName(packageName: string): Library; static get all(): readonly Library[]; /** Find a library by its name or import path. */ static find({ name, importPath, packageName }: { name?: string; importPath?: string; packageName?: string; }): Library | null; static inferFromScripts(scriptPaths: string[], { ifNotExists }?: { ifNotExists?: string | undefined; }): readonly Library[]; get globals(): readonly string[]; get repositoryUrl(): string | null; /** A path that can be used to load the library. */ get importPath(): string | undefined; private set importPath(value); private matchesImportPath; }