Skip to content

Commit

Permalink
chore: Update TypeDoc and TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
personalizedrefrigerator committed Dec 20, 2023
1 parent 1678e0d commit aee5d42
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"lerna": "7.3.1",
"lint-staged": "13.2.3",
"ts-jest": "29.1.1",
"typedoc": "0.25.2"
"typedoc": "0.25.4"
}
}
2 changes: 1 addition & 1 deletion packages/build-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"terser-webpack-plugin": "5.3.9",
"ts-loader": "9.5.0",
"ts-node": "10.9.1",
"typescript": "5.2.2",
"typescript": "5.3.3",
"webpack": "5.89.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/typedoc-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"katex": "0.16.9",
"react": "18.2.0",
"typescript": "5.2.2"
"typescript": "5.3.3"
},
"peerDependencies": {
"typedoc": "0.25.x"
Expand Down
13 changes: 9 additions & 4 deletions packages/typedoc-extensions/src/browser/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@ const fixImageURLs = () => {

// Works around a TypeDoc bug where cross-module links don't work.
const replaceInternalPackageToPackageLinks = () => {
const linksToReplace = document.querySelectorAll('a[data--module]');
const linksToReplace = [
...document.querySelectorAll('a[href^="data:text/plain;utf-8,corrected-link="]'),
];

for (const link of linksToReplace) {
const moduleTarget = link.getAttribute('data--module');
const propertyName = link.getAttribute('data--name');
const hrefRegex = /data:text\/plain;utf-8,corrected-link=([^,]+),([^,]+)$/;
const hrefMatch = (link.getAttribute('href') ?? '').match(hrefRegex);

if (hrefMatch) {
const moduleTarget = hrefMatch[1];
const propertyName = hrefMatch[2];

if (moduleTarget) {
const href = join(basePath, 'modules', moduleTarget + '.html') + `?find-name=${propertyName}`;

link.setAttribute('target', '');
Expand Down
5 changes: 2 additions & 3 deletions packages/typedoc-extensions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ export const load = (app: Application) => {
const moduleValue = toTypeDocName(moduleSource);
const nameValue = toTypeDocName(name);

// TODO: This is extremely fragile. Relies on "s not being properly escaped by
// TypeDoc.
// TODO: This is extremely fragile.
return {
target: `#" data--module=${moduleValue} data--name=${nameValue} id="`,
target: `data:text/plain;utf-8,corrected-link=${moduleValue},${nameValue}`,
name,
};
}
Expand Down

0 comments on commit aee5d42

Please sign in to comment.