1 | import * as fs from 'fs-extra';
|
2 | import * as util from './util';
|
3 | /**
|
4 | * Traverses the dependency graph and invokes the provided callback method for
|
5 | * each individual dependency root directory (including the current package).
|
6 | * The dependency roots are de-duplicated based on their absolute path on the
|
7 | * file system.
|
8 | *
|
9 | * @param packageDir the current package's root directory (i.e: where the
|
10 | * `package.json` file is located)
|
11 | * @param callback the function to invoke with each package's informations
|
12 | * @param host the dependency graph traversal host to use (this parameter
|
13 | * should typically not be provided unless this module is
|
14 | * being unit tested)
|
15 | */
|
16 | export declare function traverseDependencyGraph(packageDir: string, callback: Callback, host?: TraverseDependencyGraphHost): Promise<void>;
|
17 | /**
|
18 | * A callback invoked for each node in a NPM module's dependency graph.
|
19 | *
|
20 | * @param packageDir the directory where the current package is located.
|
21 | * @param meta the contents of the `package.json` file for this package.
|
22 | * @param root whether this package is the root that was provided to the
|
23 | * `traverseDependencyGraph` call.
|
24 | *
|
25 | * @returns `true` if this package's own dependencies should be processed,
|
26 | * `false` otherwise.
|
27 | */
|
28 | export declare type Callback = (packageDir: string, meta: PackageJson, root: boolean) => boolean | Promise<boolean>;
|
29 | /**
|
30 | * Host methods for traversing dependency graphs.
|
31 | */
|
32 | export interface TraverseDependencyGraphHost {
|
33 | readonly readJson: typeof fs.readJson;
|
34 | readonly findDependencyDirectory: typeof util.findDependencyDirectory;
|
35 | }
|
36 | /**
|
37 | * Contents of the `package.json` file.
|
38 | */
|
39 | export interface PackageJson {
|
40 | readonly dependencies?: {
|
41 | readonly [name: string]: string;
|
42 | };
|
43 | readonly peerDependencies?: {
|
44 | readonly [name: string]: string;
|
45 | };
|
46 | readonly bundleDependencies?: string[];
|
47 | readonly bundledDependencies?: string[];
|
48 | readonly [key: string]: unknown;
|
49 | }
|
50 | //# sourceMappingURL=dependency-graph.d.ts.map |
\ | No newline at end of file |