UNPKG

1.14 kBTypeScriptView Raw
1import { Constructor } from '@loopback/core';
2/**
3 * Returns all files matching the given glob pattern relative to root
4 *
5 * @param pattern - A glob pattern
6 * @param root - Root folder to start searching for matching files
7 * @returns Array of discovered files
8 */
9export declare function discoverFiles(pattern: string, root: string): Promise<string[]>;
10/**
11 * Given a function, returns true if it is a class, false otherwise.
12 *
13 * @param target - The function to check if it's a class or not.
14 * @returns True if target is a class. False otherwise.
15 */
16export declare function isClass(target: any): target is Constructor<any>;
17/**
18 * Returns an Array of Classes from given files. Works by requiring the file,
19 * identifying the exports from the file by getting the keys of the file
20 * and then testing each exported member to see if it's a class or not.
21 *
22 * @param files - An array of string of absolute file paths
23 * @param projectRootDir - The project root directory
24 * @returns An array of Class constructors from a file
25 */
26export declare function loadClassesFromFiles(files: string[], projectRootDir: string): Constructor<{}>[];