Members
(constant) NAMESPACES :Array.<string>
Tag-dictionary namespaces: `module:foo` becomes `module-foo.html`.
Type:
- Array.<string>
- Source:
(constant) OUTPUT_TYPES :Array.<string>
Values accepted as `outputType`: the dependency-cruiser reporters that emit
Graphviz dot, named as `depcruise --output-type` takes them.
Type:
- Array.<string>
- Source:
(constant) PLACEMENTS :Object.<string, function(string, string): string>
Values accepted as `placement`, each with the way it combines the README
HTML and the fragment.
Type:
- Object.<string, function(string, string): string>
- Source:
Methods
buildFragment(input) → {string}
Assemble the HTML fragment for the Home page: heading, counts, graph, stylesheet and script.
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
input |
object |
Properties
|
- Source:
Returns:
- Type
- string
commonPrefix(paths, cwd) → {string}
Common directory prefix of a set of paths, trailing separator included
(jsdoc/path.commonPrefix). Templates strip it to get the "shortened" path
that names source pages.
Parameters:
| Name | Type | Description |
|---|---|---|
paths |
Array.<string> | |
cwd |
string |
- Source:
Returns:
- Type
- string
deepMerge(base, override) → {*}
Lay one value over another. Plain objects are merged key by key, all the way
down; any other value, arrays included, replaces the one underneath.
Parameters:
| Name | Type | Description |
|---|---|---|
base |
* | |
override |
* |
- Source:
Returns:
- Type
- *
dropExternalModules(result, keepopt) → {object}
Remove Node.js built-ins and unresolvable imports from a dependency-cruiser
result, together with the dependencies that point at them.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
result |
object | Cruise result, as returned by dependency-cruiser's `cruise()`. | |||||||||||||
keep |
object |
<optional> |
Properties
|
- Source:
Returns:
A copy of the result.
- Type
- object
fragmentId(doclet) → {string}
Fragment id of a doclet inside its container page (templateHelper.formatNameForLink).
Parameters:
| Name | Type | Description |
|---|---|---|
doclet |
object |
- Source:
Returns:
- Type
- string
linkNodes(svg, prefix, urls) → {string}
Point the SVG's placeholder links at the generated pages. Nodes whose file has
no page lose their `href` and render as plain text.
Parameters:
| Name | Type | Description |
|---|---|---|
svg |
string | |
prefix |
string | Placeholder scheme the links start with. |
urls |
Map.<string, string> | Source path → page URL. |
- Source:
Returns:
- Type
- string
pageFileName(longname) → {string}
File name of the page generated for a longname, following
templateHelper.getUniqueFilename minus the de-duplication cache.
Parameters:
| Name | Type | Description |
|---|---|---|
longname |
string |
- Source:
Returns:
- Type
- string
pageUrls(input) → {Map.<string, string>}
Map every documented source file to the URL of the page that documents it.
Preference order per file: its `@module` page; any other container (class,
namespace, ...); the global page anchored at a global whose name matches the
file name (or the first global); the container page of a member defined in
another file; finally the file's own source page. Files without published
doclets are absent from the map, because templates do not emit pages for them.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
input |
object |
Properties
|
- Source:
Returns:
Source path relative to `cwd` with forward slashes → URL relative to the output directory.
- Type
- Map.<string, string>
placeFragment(readme, fragment, placement) → {string}
Combine the fragment with the README HTML JSDoc already prepared.
Parameters:
| Name | Type | Description |
|---|---|---|
readme |
string | undefined | |
fragment |
string | |
placement |
string | One of the keys of `PLACEMENTS`. |
- Source:
Returns:
- Type
- string
render(job) → {Promise.<RenderResult>}
Cruise the given files with dependency-cruiser and draw the result with Graphviz.
The files and the config file are resolved against the working directory.
Parameters:
| Name | Type | Description |
|---|---|---|
job |
RenderJob |
- Source:
Returns:
- Type
- Promise.<RenderResult>
withDefaultOptions(options, context) → {Object}
Lay dependency-cruiser options over the plugin's defaults: node links that
start with the given prefix, no third-party packages, and orthogonal edges.
The filter and the edges go where dependency-cruiser looks for them when it
draws the graph. A theme that replaces dependency-cruiser's own is left as
it is.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | dependency-cruiser options, as read from a config file. | |||||||||
context |
object |
Properties
|
- Source:
Returns:
The merged options, and whether
the orthogonal edges come from the defaults.
- Type
- Object
Type Definitions
RenderJob
Type:
- object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
files |
Array.<string> | Source files to start cruising from, relative to the working directory. | |
config |
string |
<optional> |
Path to a dependency-cruiser config file, resolved against the working directory. When omitted, the first of `CONFIG_FILES` found there is used. |
prefix |
string |
<optional> |
Prefix for node links, used unless the dependency-cruiser config sets one. Each node links to `prefix + source path`. |
outputType |
string | dependency-cruiser reporter that draws the graph, named as in `depcruise --output-type`. | |
coreModules |
boolean |
<optional> |
Whether Node.js built-ins stay in the graph. |
unresolvableModules |
boolean |
<optional> |
Whether unresolvable imports stay in the graph. |
- Source:
RenderResult
Type:
- object
Properties:
| Name | Type | Description |
|---|---|---|
svg |
string | The graph, starting at ` |
prefix |
string | Prefix the node links were drawn with: the one from the dependency-cruiser config, or else the job's. |
stats |
Object | Node and edge counts of the drawn graph. |
violations |
Object | null | dependency-cruiser rule violations, if any: what the `err` reporter writes about them, and the exit code it advises. |
- Source: