Skip to content

Commit 3c7ffc1

Browse files
committed
Format
1 parent de8562b commit 3c7ffc1

File tree

5 files changed

+79
-71
lines changed

5 files changed

+79
-71
lines changed

.editorconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,3 @@ trim_trailing_whitespace = true
1212
[*.yml]
1313
indent_style = space
1414
indent_size = 4
15-
16-
[package.json]
17-
indent_style = space
18-
indent_size = 2

dprint.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"useTabs": true,
3+
"excludes": [
4+
"**/node_modules",
5+
"**/*-lock.json"
6+
],
7+
"plugins": [
8+
"https://plugins.dprint.dev/typescript-0.94.0.wasm",
9+
"https://plugins.dprint.dev/json-0.20.0.wasm",
10+
"https://plugins.dprint.dev/markdown-0.18.0.wasm"
11+
]
12+
}

index.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { relative } from "path";
22
import {
33
Application,
4+
ContainerReflection,
45
Context,
56
Converter,
6-
ReflectionKind,
7-
TypeScript as ts,
8-
Reflection,
97
DeclarationReflection,
10-
ProjectReflection,
11-
ParameterType,
12-
ContainerReflection,
138
JSX,
9+
ParameterType,
10+
ProjectReflection,
11+
Reflection,
12+
ReflectionKind,
1413
Renderer,
14+
TypeScript as ts,
1515
} from "typedoc";
1616

1717
declare module "typedoc" {
@@ -27,8 +27,7 @@ declare module "typedoc" {
2727
}
2828

2929
let hasMonkeyPatched = false;
30-
const ModuleLike: ReflectionKind =
31-
ReflectionKind.Project | ReflectionKind.Module;
30+
const ModuleLike: ReflectionKind = ReflectionKind.Project | ReflectionKind.Module;
3231
const InternalModule = Symbol();
3332

3433
const HOOK_JS = `
@@ -71,8 +70,8 @@ export function load(app: Application) {
7170
}
7271

7372
// Monkey patch the constructor for references so that we can get every
74-
const origCreateSymbolReference = Context.prototype.createSymbolReference;;
75-
Context.prototype.createSymbolReference = function (symbol, context, name) {
73+
const origCreateSymbolReference = Context.prototype.createSymbolReference;
74+
Context.prototype.createSymbolReference = function(symbol, context, name) {
7675
const owningModule = getOwningModule(context);
7776
const set = referencedSymbols.get(context.program);
7877
symbolToOwningModule.set(symbol, owningModule);
@@ -86,28 +85,31 @@ export function load(app: Application) {
8685

8786
app.options.addDeclaration({
8887
name: "internalModule",
89-
help: "[typedoc-plugin-missing-exports] Define the name of the module that internal symbols which are not exported should be placed into.",
88+
help:
89+
"[typedoc-plugin-missing-exports] Define the name of the module that internal symbols which are not exported should be placed into.",
9090
defaultValue: "<internal>",
9191
});
9292

9393
app.options.addDeclaration({
9494
name: "collapseInternalModule",
95-
help: "[typedoc-plugin-missing-exports] Include JS in the page to collapse all <internal> entries in the navigation on page load.",
95+
help:
96+
"[typedoc-plugin-missing-exports] Include JS in the page to collapse all <internal> entries in the navigation on page load.",
9697
defaultValue: false,
9798
type: ParameterType.Boolean,
9899
});
99100

100101
app.options.addDeclaration({
101102
name: "placeInternalsInOwningModule",
102-
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.",
103+
help:
104+
"[typedoc-plugin-missing-exports] If set internal symbols will not be placed into an internals module, but directly into the module which references them.",
103105
defaultValue: false,
104106
type: ParameterType.Boolean,
105107
});
106108

107109
app.converter.on(Converter.EVENT_BEGIN, () => {
108110
if (
109-
app.options.getValue("placeInternalsInOwningModule") &&
110-
app.options.isSet("internalModule")
111+
app.options.getValue("placeInternalsInOwningModule")
112+
&& app.options.isSet("internalModule")
111113
) {
112114
app.logger.warn(
113115
`[typedoc-plugin-missing-exports] Both placeInternalsInOwningModule and internalModule are set, the internalModule option will be ignored.`,
@@ -146,8 +148,9 @@ export function load(app: Application) {
146148
app.converter.on(
147149
Converter.EVENT_RESOLVE_BEGIN,
148150
function onResolveBegin(context: Context) {
149-
const modules: (DeclarationReflection | ProjectReflection)[] =
150-
context.project.getChildrenByKind(ReflectionKind.Module);
151+
const modules: (DeclarationReflection | ProjectReflection)[] = context.project.getChildrenByKind(
152+
ReflectionKind.Module,
153+
);
151154
if (modules.length === 0) {
152155
// Single entry point, just target the project.
153156
modules.push(context.project);
@@ -205,8 +208,8 @@ export function load(app: Application) {
205208

206209
// If we added a module and all the missing symbols were excluded, get rid of our namespace.
207210
if (
208-
internalContext.scope[InternalModule] &&
209-
!(internalContext.scope as ContainerReflection).children?.length
211+
internalContext.scope[InternalModule]
212+
&& !(internalContext.scope as ContainerReflection).children?.length
210213
) {
211214
context.project.removeReflection(internalContext.scope);
212215
}
@@ -229,8 +232,7 @@ export function load(app: Application) {
229232
"NAME",
230233
JSON.stringify(app.options.getValue("internalModule")),
231234
),
232-
}),
233-
);
235+
}));
234236
}
235237
});
236238
}

package.json

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
{
2-
"name": "typedoc-plugin-missing-exports",
3-
"version": "3.1.0",
4-
"description": "Include non-exported types in TypeDoc documentation",
5-
"exports": "./index.js",
6-
"type": "module",
7-
"author": "Gerrit Birkeland",
8-
"license": "MIT",
9-
"devDependencies": {
10-
"@types/node": "18",
11-
"dprint": "^0.49.0",
12-
"outdent": "^0.8.0",
13-
"typedoc": "^0.28.1",
14-
"typescript": "^5.8.2",
15-
"vitest": "^3.0.8"
16-
},
17-
"repository": {
18-
"type": "git",
19-
"url": "https://github.com/Gerrit0/typedoc-plugin-missing-exports.git"
20-
},
21-
"files": [
22-
"index.js"
23-
],
24-
"keywords": [
25-
"typedoc-plugin"
26-
],
27-
"peerDependencies": {
28-
"typedoc": "^0.28.1"
29-
},
30-
"scripts": {
31-
"test": "vitest run test/packages.test.ts",
32-
"test:doc": "typedoc --plugin ./index.js --tsconfig ./test/packages",
33-
"build": "tsc",
34-
"lint": "dprint check"
35-
},
36-
"pnpm": {
37-
"onlyBuiltDependencies": [
38-
"dprint"
39-
]
40-
}
2+
"name": "typedoc-plugin-missing-exports",
3+
"version": "3.1.0",
4+
"description": "Include non-exported types in TypeDoc documentation",
5+
"exports": "./index.js",
6+
"type": "module",
7+
"author": "Gerrit Birkeland",
8+
"license": "MIT",
9+
"devDependencies": {
10+
"@types/node": "18",
11+
"dprint": "^0.49.0",
12+
"outdent": "^0.8.0",
13+
"typedoc": "^0.28.1",
14+
"typescript": "^5.8.2",
15+
"vitest": "^3.0.8"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/Gerrit0/typedoc-plugin-missing-exports.git"
20+
},
21+
"files": [
22+
"index.js"
23+
],
24+
"keywords": [
25+
"typedoc-plugin"
26+
],
27+
"peerDependencies": {
28+
"typedoc": "^0.28.1"
29+
},
30+
"scripts": {
31+
"test": "vitest run test/packages.test.ts",
32+
"test:doc": "typedoc --plugin ./index.js --tsconfig ./test/packages",
33+
"build": "tsc",
34+
"lint": "dprint check"
35+
},
36+
"pnpm": {
37+
"onlyBuiltDependencies": [
38+
"dprint"
39+
]
40+
}
4141
}

test/packages.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import * as ts from "typescript";
2-
import { join } from "path/posix";
31
import { outdent } from "outdent";
2+
import { join } from "path/posix";
43
import {
54
Application,
65
ContainerReflection,
7-
LogLevel,
86
Logger,
7+
LogLevel,
98
Reflection,
109
ReflectionKind,
1110
TSConfigReader,
1211
} from "typedoc";
13-
import { test, expect, beforeAll, afterEach } from "vitest";
12+
import * as ts from "typescript";
13+
import { afterEach, beforeAll, expect, test } from "vitest";
1414
import { load } from "../index.js";
1515

1616
let app: Application;
@@ -25,9 +25,7 @@ function toStringHierarchy(refl: Reflection, indent = 0) {
2525
increment = 0;
2626
} else {
2727
text.push(
28-
`${"\t".repeat(indent)}${ReflectionKind.singularString(refl.kind)} ${
29-
refl.name
30-
}`,
28+
`${"\t".repeat(indent)}${ReflectionKind.singularString(refl.kind)} ${refl.name}`,
3129
);
3230
}
3331

0 commit comments

Comments
 (0)