UNPKG

4.11 kBTypeScriptView Raw
1import { IReporterOptions } from "./reporter-options";
2import { IFlattenedRuleSet } from "./rule-set";
3import { ModuleSystemType, OutputType } from "./shared-types";
4import {
5 IDoNotFollowType,
6 IExcludeType,
7 IFocusType,
8 IIncludeOnlyType,
9} from "./filter-types";
10
11export type ExternalModuleResolutionStrategyType = "node_modules" | "yarn-pnp";
12
13export interface ICruiseOptions {
14 /**
15 * if true, will attempt to validate with the rules in ruleSet.
16 * Default false.
17 */
18 validate?: boolean;
19 /**
20 * An object containing the rules to validate against.
21 *
22 * This ain't in none of the json schemas, but is used internally _instead_
23 * of the rule set defined on global configuration level. Judo
24 * (a.o. flattening out extended rule sets) done in ../src/cli/normalize-options.js
25 */
26 ruleSet?: IFlattenedRuleSet;
27 /**
28 * The (root) configuration file the cruise options came from.
29 */
30 rulesFile?: string;
31 /**
32 * regular expression describing which dependencies the function
33 * should cruise, but not resolve or follow any further
34 *
35 * ... or conditions that describe what dependencies not to follow
36 */
37 doNotFollow?: string | IDoNotFollowType;
38 /**
39 * regular expression describing which dependencies the function
40 * should not cruise
41 */
42 exclude?: string | IExcludeType;
43 /**
44 * regular expression describing which dependencies the function
45 * should cruise - anything not matching this will be skipped
46 */
47 includeOnly?: string | IIncludeOnlyType;
48 /**
49 * dependency-cruiser will include modules matching this regular expression
50 * in its output, as well as their neighbours (direct dependencies and
51 * dependents)
52 */
53 focus?: string | IFocusType;
54 /**
55 * the maximum depth to cruise; 0 <= n <= 99
56 * (default: 0, which means 'infinite depth')
57 */
58 maxDepth?: number;
59 /**
60 * an array of module systems to use for following dependencies;
61 * defaults to ["es6", "cjs", "amd"]
62 */
63 moduleSystems?: ModuleSystemType[];
64 /**
65 * one of "json", "html", "dot", "csv" or "err". When left
66 * out the function will return a javascript object as dependencies
67 */
68 outputType?: OutputType;
69 /**
70 * Where the output of the cruise is to be sent to. '-' (the default)
71 * denotes stdout.
72 *
73 * Echoed in the result schema, but not used internally otherwise.
74 */
75 outputTo?: string;
76 /**
77 * The arguments used on the command line
78 *
79 * Echoed in the result schema, but not used internally otherwise.
80 */
81 args?: string;
82 /**
83 * a string to insert before links (in dot/ svg output) so with
84 * cruising local dependencies it is possible to point to sources
85 * elsewhere (e.g. in an online repository)
86 */
87 prefix?: string;
88 /**
89 * if true detect dependencies that only exist before
90 * typescript-to-javascript compilation.
91 */
92 tsPreCompilationDeps?: boolean | "specify";
93 /**
94 * if true leave symlinks untouched, otherwise use the realpath.
95 * Defaults to `false` (which is also nodejs's default behavior
96 * since version 6)
97 */
98 preserveSymlinks?: boolean;
99 /**
100 * The way to resolve external modules - either via node_modules
101 * ('node_modules') or yarn plug and play ('yarn-pnp').
102 * Might later also include npm's tink (?)
103 *
104 * Defaults to 'node_modules'
105 */
106 externalModuleResolutionStrategy?: ExternalModuleResolutionStrategyType;
107 /**
108 * if true combines the package.jsons found from the module up to the base
109 * folder the cruise is initiated from. Useful for how (some) mono-repos
110 * manage dependencies & dependency definitions.
111 *
112 * Defaults to `false`.
113 */
114 combinedDependencies?: boolean;
115 /*
116 * List of strings you have in use in addition to cjs/ es6 requires
117 * & imports to declare module dependencies. Use this e.g. if you've
118 * redeclared require (`const want = require`), use a require-wrapper
119 * (like semver-try-require) or use window.require as a hack
120 *
121 * Defaults to `[]`
122 */
123 exoticRequireStrings?: string[];
124 /**
125 * Options to tweak the output of reporters
126 */
127 reporterOptions?: IReporterOptions;
128}