Skip to content

Commit

Permalink
feat(graphing): Make injection tokens stand out
Browse files Browse the repository at this point in the history
  • Loading branch information
Iku-turso committed Mar 11, 2022
1 parent a1523cf commit 17796b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ exports[`createContainer.dependency-graph given dependency graphing, dependencie
"@startuml
hide members
hide circle
class \\"some-token-injectable\\" as someTokenInjectable<Singleton> $some-token-injectable $some-sync-setuppable $some-sync-child-injectable $some-injection-token $setup $some-parent-injectable
class \\"some-injection-token\\" as someInjectionToken<Transient> $some-injection-token $some-sync-setuppable $some-sync-child-injectable $setup $some-parent-injectable
class \\"some-sync-child-injectable\\" as someSyncChildInjectable<Transient> $some-sync-child-injectable $some-sync-setuppable $setup $some-parent-injectable
class \\"some-sync-setuppable\\" as someSyncSetuppable<Singleton> $some-sync-setuppable $setup
class \\"some-async-child-injectable\\" as someAsyncChildInjectable<Singleton\\\\nAsync> $some-async-child-injectable $some-async-setuppable $setup $some-parent-injectable
class \\"some-parent-injectable\\" as someParentInjectable<Singleton\\\\nAsync> $some-parent-injectable
class \\"some-token-injectable\\" as someTokenInjectable<Singleton> $some-token-injectable $some-sync-setuppable $some-sync-child-injectable $some-injection-token $setup $some-parent-injectable #line:darkRed
class \\"some-injection-token\\" as someInjectionToken<Transient\\\\nToken> $some-injection-token $some-sync-setuppable $some-sync-child-injectable $setup $some-parent-injectable #line:orange
class \\"some-sync-child-injectable\\" as someSyncChildInjectable<Transient> $some-sync-child-injectable $some-sync-setuppable $setup $some-parent-injectable #line:darkRed
class \\"some-sync-setuppable\\" as someSyncSetuppable<Singleton> $some-sync-setuppable $setup #line:darkRed
class \\"some-async-child-injectable\\" as someAsyncChildInjectable<Singleton\\\\nAsync> $some-async-child-injectable $some-async-setuppable $setup $some-parent-injectable #line:darkRed
class \\"some-parent-injectable\\" as someParentInjectable<Singleton\\\\nAsync> $some-parent-injectable #line:darkRed
someInjectionToken --[#black,dashed,thickness=1]up* someTokenInjectable : Setup
someSyncChildInjectable --[#black,dashed,thickness=1]up* someInjectionToken : Setup
someSyncSetuppable --[#black,dashed,thickness=1]up* someSyncChildInjectable : Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const plantUmlExtractorInjectable = getInjectable({
if (alias.aliasType === injectionTokenSymbol) {
node.isInjectionToken = true;
node.lifecycleName = lifecycleEnum.transient.name;
node.infos.add('Token');
} else {
node.lifecycleName = alias.lifecycle.name;
}
Expand Down Expand Up @@ -139,12 +140,12 @@ const toPlantUmlNode = ({
infos,
}) => {
const infosString = [lifecycleName, ...infos.values()].join('\\n');
const classPuml = `class "${name}" as ${id}<${infosString}>`;
const tagPuml = [...tags].map(tag => `$${tag}`).join(' ');
const borderColor = isInjectionToken ? 'orange' : 'darkRed';
const stylePuml = `#line:${borderColor}`;

const mainPuml = `class "${name}" as ${id}<${infosString}>`;

const tagPuml = [...tags].map(tag => ` $${tag}`).join('');

return mainPuml + tagPuml;
return `${classPuml} ${tagPuml} ${stylePuml}`;
};

const toPlantUmlLink = ({
Expand Down

0 comments on commit 17796b5

Please sign in to comment.