-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linking-tool): get module name from dynamic import
- Loading branch information
1 parent
c199b5b
commit d9dfae2
Showing
6 changed files
with
35 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
libs/linking-tool/src/lib/schematics/generate-links/resources/utils/angular.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ArrowFunction, PropertyAccessExpression, SyntaxKind } from 'ts-morph'; | ||
import { TypescriptApiUtil } from './typescript-api.util'; | ||
|
||
export namespace AngularUtil { | ||
export function getLazyLoadedModuleName(loader: ArrowFunction) { | ||
const loaderReturns = TypescriptApiUtil.getCallExpressionFromArrowFunction(loader); | ||
const moduleExtractionExpression = loaderReturns | ||
.getChildrenOfKind(SyntaxKind.ArrowFunction)[0] | ||
.getBody() as PropertyAccessExpression; | ||
|
||
return moduleExtractionExpression.getName(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
libs/linking-tool/src/lib/schematics/generate-links/resources/utils/array.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export namespace ArrayUtil { | ||
export function joinToTitleCase(arr: string[]): string { | ||
return arr.map(w => w[0].toUpperCase() + w.substr(1).toLowerCase()).join(''); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
libs/linking-tool/src/lib/schematics/generate-links/resources/utils/string.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Node } from 'ts-morph'; | ||
|
||
export namespace StringUtil { | ||
export function getStringArgumentValue(node: Node): string { | ||
return node.getText().slice(1, -1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters