Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relevant Issues:
#1108, #403, #885
Reasoning for PR
Compodoc has had this long-standing issue for quite some time now, and it's baring the entry for a lot of companies to utilize this library. The majority of mid-sized+ companies will utilize aliases for imports. Previously, the current work-around was to simply use relative imports for the routes:
../core/components/somecomponent/somecomponent.route.ts
instead of a nice import path of:
app/core/components/somecomponent/somecomponent.route.ts
This doesn't look like that big of a deal, but when you're importing sibling & nested routes, it becomes quite the hassle at scale.
In my case, I was originally receiving a path with the value of:
C:/Users/Benge/Documents/GitHub/@myclient/src/app/app/core/components/patients-list/patients-list.routes.ts
With the issue being
.../app/app/...
because while
.../app/core/...
is a existing file path,.../app/app/core/...
is not.Cause of issue
With
path.dirname(file.getFilePath()
having a value ofC:/Users/Benge/Documents/GitHub/@myclient/src/app
andsearchedImport.getModuleSpecifierValue()
having a value ofapp/core/components/patients-list/patients-list.routes.ts
Solution
My solution is simply a bandaid until a more long-term fix of the route-parser can be implemented, but to break it down:
And bam! You have a working Compodoc with route aliases.