1 | import * as glob from 'glob';
|
2 | import { BuildResolverOptions } from './resolvers';
|
3 | import { LifetimeType } from './awilix';
|
4 | /**
|
5 | * The options when invoking listModules().
|
6 | * @interface ListModulesOptions
|
7 | */
|
8 | export interface ListModulesOptions {
|
9 | cwd?: string;
|
10 | glob?: typeof glob.sync;
|
11 | }
|
12 | /**
|
13 | * An object containing the module name and path (full path to module).
|
14 | *
|
15 | * @interface ModuleDescriptor
|
16 | */
|
17 | export interface ModuleDescriptor {
|
18 | name: string;
|
19 | path: string;
|
20 | opts: any;
|
21 | }
|
22 | /**
|
23 | * Metadata of the module as well as the loaded module itself.
|
24 | */
|
25 | export interface LoadedModuleDescriptor extends ModuleDescriptor {
|
26 | value: unknown;
|
27 | }
|
28 | /**
|
29 | * A glob pattern with associated registration options.
|
30 | */
|
31 | export declare type GlobWithOptions = [string] | [string, BuildResolverOptions<any> | LifetimeType];
|
32 | /**
|
33 | * Returns a list of {name, path} pairs,
|
34 | * where the name is the module name, and path is the actual
|
35 | * full path to the module.
|
36 | *
|
37 | * @param {String|Array<String>} globPatterns
|
38 | * The glob pattern as a string or an array of strings.
|
39 | *
|
40 | * @param {String} opts.cwd
|
41 | * Current working directory, used for resolving filepaths.
|
42 | * Defaults to `process.cwd()`.
|
43 | *
|
44 | * @return {[{name, path}]}
|
45 | * An array of objects with the module names and paths.
|
46 | */
|
47 | export declare function listModules(globPatterns: string | Array<string | GlobWithOptions>, opts?: ListModulesOptions): ModuleDescriptor[];
|