docs: fix cross-project links to use base path in production (#8160)

This commit is contained in:
Shahed Nasser
2024-07-17 15:31:23 +03:00
committed by GitHub
parent b1964a0384
commit 0aac0f8bac
6 changed files with 25 additions and 49 deletions
@@ -18,7 +18,7 @@ const PROJECT_REGEX = /^!(?<area>[\w-]+)!/
function matchAndFixLinks(
link: string,
{ baseUrl, projectUrls }: CrossProjectLinksOptions
{ baseUrl, projectUrls, useBaseUrl = false }: CrossProjectLinksOptions
): string {
const projectArea = PROJECT_REGEX.exec(link)
@@ -29,6 +29,7 @@ function matchAndFixLinks(
const actualUrl = link.replace(PROJECT_REGEX, "")
const base =
!useBaseUrl &&
projectUrls &&
Object.hasOwn(projectUrls, projectArea.groups.area) &&
projectUrls[projectArea.groups.area]?.url
@@ -115,6 +115,7 @@ export declare type CrossProjectLinksOptions = {
path?: string
}
}
useBaseUrl?: boolean
}
export declare type TypeListLinkFixerOptions = {
@@ -8,6 +8,7 @@
"lib": ["es2022"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ESNext",
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,