Skip to content

Commit 06828cf

Browse files
committed
Add collapseInternalModule option
Closes #25
1 parent 4c1b70c commit 06828cf

File tree

5 files changed

+107
-71
lines changed

5 files changed

+107
-71
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.3.0 (2024-06-12)
2+
3+
- Added `--collapseInternalModule` option.
4+
15
### 2.2.0 (2024-01-14)
26

37
- Fixed an issue where if a re-exported symbol referenced an internal symbol, and more than one entry point was provided to TypeDoc,

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ npx typedoc --plugin typedoc-plugin-missing-exports
1919

2020
### Options
2121

22-
- `internalModule` - Define the name of the module that internal symbols which are not exported should be placed into.
23-
- `placeInternalsInOwningModule` - Disable creating a module for internal symbols, and instead place them into the referencing module
22+
- `internalModule` - Define the name of the module that internal symbols which are not exported should be placed into, defaults to `<internal>`.
23+
- `collapseInternalModule` - Include JS in the page to collapse all `<internal>` entries in the navigation on page load.
24+
- `placeInternalsInOwningModule` - Disable creating a module for internal symbols, and instead place them into the referencing module.
2425

2526
### Additional Reading
2627

index.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ import {
1010
ProjectReflection,
1111
ParameterType,
1212
ContainerReflection,
13+
JSX,
14+
Renderer,
1315
} from "typedoc";
1416

1517
declare module "typedoc" {
1618
export interface TypeDocOptionMap {
1719
internalModule: string;
1820
placeInternalsInOwningModule: boolean;
21+
collapseInternalModule: boolean;
1922
}
2023

2124
export interface Reflection {
@@ -28,6 +31,10 @@ const ModuleLike: ReflectionKind =
2831
ReflectionKind.Project | ReflectionKind.Module;
2932
const InternalModule = Symbol();
3033

34+
const HOOK_JS = `
35+
<script>for (let k in localStorage) if (k.includes("tsd-accordion-") && k.includes(NAME)) localStorage.setItem(k, "false");</script>
36+
`.trim();
37+
3138
export function load(app: Application) {
3239
if (hasMonkeyPatched) {
3340
throw new Error(
@@ -83,6 +90,13 @@ export function load(app: Application) {
8390
defaultValue: "<internal>",
8491
});
8592

93+
app.options.addDeclaration({
94+
name: "collapseInternalModule",
95+
help: "[typedoc-plugin-missing-exports] Include JS in the page to collapse all <internal> entries in the navigation on page load.",
96+
defaultValue: false,
97+
type: ParameterType.Boolean,
98+
});
99+
86100
app.options.addDeclaration({
87101
name: "placeInternalsInOwningModule",
88102
help: "[typedoc-plugin-missing-exports] If set internal symbols will not be placed into an internals module, but directly into the module which references them.",
@@ -184,6 +198,19 @@ export function load(app: Application) {
184198
void 0,
185199
1e9,
186200
);
201+
202+
app.renderer.on(Renderer.EVENT_BEGIN, () => {
203+
if (app.options.getValue("collapseInternalModule")) {
204+
app.renderer.hooks.on("head.end", () =>
205+
JSX.createElement(JSX.Raw, {
206+
html: HOOK_JS.replace(
207+
"NAME",
208+
JSON.stringify(app.options.getValue("internalModule")),
209+
),
210+
}),
211+
);
212+
}
213+
});
187214
}
188215

189216
function getOwningModule(context: Context): Reflection {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"devDependencies": {
1010
"@types/node": "18",
1111
"outdent": "^0.8.0",
12-
"prettier": "3.2.1",
13-
"typedoc": "^0.25.7",
14-
"typescript": "^5.3.3",
15-
"vitest": "^1.2.0"
12+
"prettier": "3.3.2",
13+
"typedoc": "^0.25.13",
14+
"typescript": "^5.4.5",
15+
"vitest": "^1.6.0"
1616
},
1717
"repository": {
1818
"type": "git",

yarn.lock

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -211,56 +211,56 @@
211211
dependencies:
212212
undici-types "~5.26.4"
213213

214-
"@vitest/expect@1.2.0":
215-
version "1.2.0"
216-
resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.2.0.tgz#de93f5c32c2781c41415a8c3a6e48e1c023d6613"
217-
integrity sha512-H+2bHzhyvgp32o7Pgj2h9RTHN0pgYaoi26Oo3mE+dCi1PAqV31kIIVfTbqMO3Bvshd5mIrJLc73EwSRrbol9Lw==
214+
"@vitest/expect@1.6.0":
215+
version "1.6.0"
216+
resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.6.0.tgz#0b3ba0914f738508464983f4d811bc122b51fb30"
217+
integrity sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==
218218
dependencies:
219-
"@vitest/spy" "1.2.0"
220-
"@vitest/utils" "1.2.0"
219+
"@vitest/spy" "1.6.0"
220+
"@vitest/utils" "1.6.0"
221221
chai "^4.3.10"
222222

223-
"@vitest/runner@1.2.0":
224-
version "1.2.0"
225-
resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.2.0.tgz#84775f0f5c48620ff1943a45c19863355791c6d9"
226-
integrity sha512-vaJkDoQaNUTroT70OhM0NPznP7H3WyRwt4LvGwCVYs/llLaqhoSLnlIhUClZpbF5RgAee29KRcNz0FEhYcgxqA==
223+
"@vitest/runner@1.6.0":
224+
version "1.6.0"
225+
resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.6.0.tgz#a6de49a96cb33b0e3ba0d9064a3e8d6ce2f08825"
226+
integrity sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==
227227
dependencies:
228-
"@vitest/utils" "1.2.0"
228+
"@vitest/utils" "1.6.0"
229229
p-limit "^5.0.0"
230230
pathe "^1.1.1"
231231

232-
"@vitest/snapshot@1.2.0":
233-
version "1.2.0"
234-
resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.2.0.tgz#2fcddb5c6e8a9d2fc9f18ea2f8fd39b1b6e691b4"
235-
integrity sha512-P33EE7TrVgB3HDLllrjK/GG6WSnmUtWohbwcQqmm7TAk9AVHpdgf7M3F3qRHKm6vhr7x3eGIln7VH052Smo6Kw==
232+
"@vitest/snapshot@1.6.0":
233+
version "1.6.0"
234+
resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.6.0.tgz#deb7e4498a5299c1198136f56e6e0f692e6af470"
235+
integrity sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==
236236
dependencies:
237237
magic-string "^0.30.5"
238238
pathe "^1.1.1"
239239
pretty-format "^29.7.0"
240240

241-
"@vitest/spy@1.2.0":
242-
version "1.2.0"
243-
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.2.0.tgz#61104de4c19a3addefff021d884c9e20dc17ebcd"
244-
integrity sha512-MNxSAfxUaCeowqyyGwC293yZgk7cECZU9wGb8N1pYQ0yOn/SIr8t0l9XnGRdQZvNV/ZHBYu6GO/W3tj5K3VN1Q==
241+
"@vitest/spy@1.6.0":
242+
version "1.6.0"
243+
resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.6.0.tgz#362cbd42ccdb03f1613798fde99799649516906d"
244+
integrity sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==
245245
dependencies:
246246
tinyspy "^2.2.0"
247247

248-
"@vitest/utils@1.2.0":
249-
version "1.2.0"
250-
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.2.0.tgz#deb9bdc3d094bf47f93a592a6a0b3946aa575e7a"
251-
integrity sha512-FyD5bpugsXlwVpTcGLDf3wSPYy8g541fQt14qtzo8mJ4LdEpDKZ9mQy2+qdJm2TZRpjY5JLXihXCgIxiRJgi5g==
248+
"@vitest/utils@1.6.0":
249+
version "1.6.0"
250+
resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.6.0.tgz#5c5675ca7d6f546a7b4337de9ae882e6c57896a1"
251+
integrity sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==
252252
dependencies:
253253
diff-sequences "^29.6.3"
254254
estree-walker "^3.0.3"
255255
loupe "^2.3.7"
256256
pretty-format "^29.7.0"
257257

258-
acorn-walk@^8.3.1:
258+
acorn-walk@^8.3.2:
259259
version "8.3.2"
260260
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa"
261261
integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==
262262

263-
acorn@^8.10.0, acorn@^8.11.3:
263+
acorn@^8.11.3:
264264
version "8.11.3"
265265
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
266266
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==
@@ -441,6 +441,11 @@ isexe@^2.0.0:
441441
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
442442
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
443443

444+
js-tokens@^9.0.0:
445+
version "9.0.0"
446+
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-9.0.0.tgz#0f893996d6f3ed46df7f0a3b12a03f5fd84223c1"
447+
integrity sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==
448+
444449
jsonc-parser@^3.2.0:
445450
version "3.2.0"
446451
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
@@ -620,10 +625,10 @@ postcss@^8.4.32:
620625
picocolors "^1.0.0"
621626
source-map-js "^1.0.2"
622627

623-
prettier@3.2.1:
624-
version "3.2.1"
625-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.1.tgz#babf33580e16c796a9740b9fae551624f7bfeaab"
626-
integrity sha512-qSUWshj1IobVbKc226Gw2pync27t0Kf0EdufZa9j7uBSJay1CC+B3K5lAAZoqgX3ASiKuWsk6OmzKRetXNObWg==
628+
prettier@3.3.2:
629+
version "3.3.2"
630+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a"
631+
integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==
627632

628633
pretty-format@^29.7.0:
629634
version "29.7.0"
@@ -713,22 +718,22 @@ strip-final-newline@^3.0.0:
713718
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd"
714719
integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==
715720

716-
strip-literal@^1.3.0:
717-
version "1.3.0"
718-
resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-1.3.0.tgz#db3942c2ec1699e6836ad230090b84bb458e3a07"
719-
integrity sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==
721+
strip-literal@^2.0.0:
722+
version "2.1.0"
723+
resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-2.1.0.tgz#6d82ade5e2e74f5c7e8739b6c84692bd65f0bd2a"
724+
integrity sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==
720725
dependencies:
721-
acorn "^8.10.0"
726+
js-tokens "^9.0.0"
722727

723728
tinybench@^2.5.1:
724729
version "2.5.1"
725730
resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.5.1.tgz#3408f6552125e53a5a48adee31261686fd71587e"
726731
integrity sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==
727732

728-
tinypool@^0.8.1:
729-
version "0.8.1"
730-
resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.1.tgz#b6c4e4972ede3e3e5cda74a3da1679303d386b03"
731-
integrity sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg==
733+
tinypool@^0.8.3:
734+
version "0.8.4"
735+
resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.4.tgz#e217fe1270d941b39e98c625dcecebb1408c9aa8"
736+
integrity sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==
732737

733738
tinyspy@^2.2.0:
734739
version "2.2.0"
@@ -740,20 +745,20 @@ type-detect@^4.0.0, type-detect@^4.0.8:
740745
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
741746
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
742747

743-
typedoc@^0.25.7:
744-
version "0.25.7"
745-
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.7.tgz#11e3f527ca80ca3c029cb8e15f362e6d9f715e25"
746-
integrity sha512-m6A6JjQRg39p2ZVRIN3NKXgrN8vzlHhOS+r9ymUYtcUP/TIQPvWSq7YgE5ZjASfv5Vd5BW5xrir6Gm2XNNcOow==
748+
typedoc@^0.25.13:
749+
version "0.25.13"
750+
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.13.tgz#9a98819e3b2d155a6d78589b46fa4c03768f0922"
751+
integrity sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==
747752
dependencies:
748753
lunr "^2.3.9"
749754
marked "^4.3.0"
750755
minimatch "^9.0.3"
751756
shiki "^0.14.7"
752757

753-
typescript@^5.3.3:
754-
version "5.3.3"
755-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37"
756-
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
758+
typescript@^5.4.5:
759+
version "5.4.5"
760+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
761+
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
757762

758763
ufo@^1.1.1:
759764
version "1.1.1"
@@ -770,10 +775,10 @@ undici-types@~5.26.4:
770775
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
771776
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
772777

773-
vite-node@1.2.0:
774-
version "1.2.0"
775-
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.2.0.tgz#9a359804469203a54ac49daad3065f2fd0bfb9c3"
776-
integrity sha512-ETnQTHeAbbOxl7/pyBck9oAPZZZo+kYnFt1uQDD+hPReOc+wCjXw4r4jHriBRuVDB5isHmPXxrfc1yJnfBERqg==
778+
vite-node@1.6.0:
779+
version "1.6.0"
780+
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.6.0.tgz#2c7e61129bfecc759478fa592754fd9704aaba7f"
781+
integrity sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==
777782
dependencies:
778783
cac "^6.7.14"
779784
debug "^4.3.4"
@@ -792,18 +797,17 @@ vite@^5.0.0:
792797
optionalDependencies:
793798
fsevents "~2.3.3"
794799

795-
vitest@^1.2.0:
796-
version "1.2.0"
797-
resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.2.0.tgz#2ddff4a32ed992339655f243525c0e187b5af6d9"
798-
integrity sha512-Ixs5m7BjqvLHXcibkzKRQUvD/XLw0E3rvqaCMlrm/0LMsA0309ZqYvTlPzkhh81VlEyVZXFlwWnkhb6/UMtcaQ==
799-
dependencies:
800-
"@vitest/expect" "1.2.0"
801-
"@vitest/runner" "1.2.0"
802-
"@vitest/snapshot" "1.2.0"
803-
"@vitest/spy" "1.2.0"
804-
"@vitest/utils" "1.2.0"
805-
acorn-walk "^8.3.1"
806-
cac "^6.7.14"
800+
vitest@^1.6.0:
801+
version "1.6.0"
802+
resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.6.0.tgz#9d5ad4752a3c451be919e412c597126cffb9892f"
803+
integrity sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==
804+
dependencies:
805+
"@vitest/expect" "1.6.0"
806+
"@vitest/runner" "1.6.0"
807+
"@vitest/snapshot" "1.6.0"
808+
"@vitest/spy" "1.6.0"
809+
"@vitest/utils" "1.6.0"
810+
acorn-walk "^8.3.2"
807811
chai "^4.3.10"
808812
debug "^4.3.4"
809813
execa "^8.0.1"
@@ -812,11 +816,11 @@ vitest@^1.2.0:
812816
pathe "^1.1.1"
813817
picocolors "^1.0.0"
814818
std-env "^3.5.0"
815-
strip-literal "^1.3.0"
819+
strip-literal "^2.0.0"
816820
tinybench "^2.5.1"
817-
tinypool "^0.8.1"
821+
tinypool "^0.8.3"
818822
vite "^5.0.0"
819-
vite-node "1.2.0"
823+
vite-node "1.6.0"
820824
why-is-node-running "^2.2.2"
821825

822826
vscode-oniguruma@^1.7.0:

0 commit comments

Comments
 (0)