File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1212- TypeDoc will now attempt to cache icons when ` DefaultThemeRenderContext.icons ` is overwritten by a custom theme.
1313 Note: To perform this optimization, TypeDoc relies on ` DefaultThemeRenderContext.iconCache ` being rendered within
1414 each page. TypeDoc does it in the ` defaultLayout ` template.
15+ - Cache URL derivation during generation, #2386 .
1516
1617### Bug Fixes
1718
2425
2526### Thanks!
2627
28+ - @ajesshope
2729- @HemalPatil
2830- @hrueger
2931- @typhonrt
Original file line number Diff line number Diff line change @@ -46,9 +46,12 @@ export abstract class ContextAwareRendererComponent extends RendererComponent {
4646 this . listenTo ( this . owner , {
4747 [ RendererEvent . BEGIN ] : this . onBeginRenderer ,
4848 [ PageEvent . BEGIN ] : this . onBeginPage ,
49+ [ RendererEvent . END ] : ( ) => this . absoluteToRelativePathMap . clear ( ) ,
4950 } ) ;
5051 }
5152
53+ private absoluteToRelativePathMap = new Map < string , string > ( ) ;
54+
5255 /**
5356 * Transform the given absolute path into a relative path.
5457 *
@@ -59,7 +62,12 @@ export abstract class ContextAwareRendererComponent extends RendererComponent {
5962 if ( this . urlPrefix . test ( absolute ) ) {
6063 return absolute ;
6164 } else {
62- return Path . posix . relative ( this . location , absolute ) || "." ;
65+ const key = `${ this . location } :${ absolute } ` ;
66+ let path = this . absoluteToRelativePathMap . get ( key ) ;
67+ if ( path ) return path ;
68+ path = Path . posix . relative ( this . location , absolute ) || "." ;
69+ this . absoluteToRelativePathMap . set ( key , path ) ;
70+ return path ;
6371 }
6472 }
6573
You can’t perform that action at this time.
0 commit comments