@ayanaware/bento
Version:
Modular runtime framework designed to solve complex tasks
57 lines (56 loc) • 2.34 kB
TypeScript
import { PluginAPI } from '../../entities/api/PluginAPI';
import { Entity, EntityType } from '../../entities/interfaces/Entity';
import { InstanceType } from '../../types/InstanceType';
import { EntityLoader } from './EntityLoader';
/**
* FSEntityLoader is a recursive entity loader for Bento.
* Be sure to carefully read function documentation for potential gotchas
*/
export declare class FSEntityLoader extends EntityLoader {
name: string;
api: PluginAPI;
files: Set<string>;
protected findEntity(item: any): Entity | InstanceType<Entity>;
protected getFileList(directory: string, recursive?: boolean, accululator?: Array<string>): Promise<Array<string>>;
protected checkFile(file: string): Promise<boolean>;
/**
* Bulk Instantiate Files and add them to Bento
* @param files Path Array
* @param type EntityType
*/
addFiles(files: Array<string> | Array<Array<string>>, type?: EntityType): Promise<void>;
/**
* Instantiate File and add it to Bento
* @param file Path
* @param type EntityType
*/
addFile(file: string | Array<string>, type?: EntityType): Promise<void>;
/**
* Bulk addDirectory(), please see that function documentation for more details
* @param directories Array of Directory Paths
* @param type EntityType
* @param recursive recursive?
*/
addDirectories(directories: Array<string | Array<string>>, type?: EntityType, recursive?: boolean): Promise<void>;
/**
* Find Entity Files in a directory and add them to Bento
*
* A file will be eligiable for loading in the following circumstances:
*
* - Extension ends with `.e.ts` or `.e.js`
* - File contents include `@fs-entity`
* - File contents include `@ayanaware/bento`
* - Associated types file `.d.ts` contents include `@ayanaware/bento`
*
* If none of these conditions are met then the file will be skipped.
*
* **If all else fails, add the comment `// @fs-entity` and it will be loaded**
*
* **To prevent loading add the comment `// @fs-entity-ignore`**
*
* @param directory Directory Path
* @param type EntityType
* @param recursive recursive?
*/
addDirectory(directory: string | Array<string>, type?: EntityType, recursive?: boolean): Promise<void>;
}