Skip to content

Commit 604585d

Browse files
committed
Update changelog for bootstrap event, tweaks
1 parent f4345a6 commit 604585d

File tree

8 files changed

+445
-551
lines changed

8 files changed

+445
-551
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Unreleased
22

3+
### Features
4+
5+
- Added a new `ParameterType.Object` for declaring object options which will be shallowly merged when read from user configuration.
6+
- Added a new `Application.EVENT_BOOTSTRAP_END` event emitted when `Application.bootstrap` is called.
7+
38
### Bug Fixes
49

510
- TypeDoc will now work properly in packages mode when converting packages outside the current working directory, #2043.
611
- Fixed deprecation warning for `isIdentifierOrPrivateIdentifier`.
712
- Fixed centering of title bar on wide displays, #2046.
813

14+
### Thanks!
15+
16+
- @citkane
17+
918
## v0.23.11 (2022-08-26)
1019

1120
### Features

package-lock.json

Lines changed: 409 additions & 505 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
"devDependencies": {
3636
"@types/lunr": "^2.3.4",
3737
"@types/marked": "^4.0.6",
38-
"@types/minimatch": "5.1.0",
38+
"@types/minimatch": "5.1.1",
3939
"@types/mocha": "^9.1.1",
4040
"@types/node": "14",
41-
"@typescript-eslint/eslint-plugin": "^5.35.1",
42-
"@typescript-eslint/parser": "^5.35.1",
41+
"@typescript-eslint/eslint-plugin": "^5.36.1",
42+
"@typescript-eslint/parser": "^5.36.1",
4343
"@typestrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#b88cd06fe814614a0d924af9d10d04ff95a551de",
4444
"c8": "^7.12.0",
45-
"esbuild": "^0.15.5",
46-
"eslint": "^8.22.0",
45+
"esbuild": "^0.15.6",
46+
"eslint": "^8.23.0",
4747
"mocha": "^10.0.0",
4848
"prettier": "2.7.1",
4949
"puppeteer": "^13.5.2",

src/lib/application.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ export class Application extends ChildableComponent<
100100
*/
101101
static VERSION = packageInfo.version;
102102

103+
/**
104+
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
105+
* The listener will be given an instance of {@link Application} and the {@link TypeDocOptions | Partial<TypeDocOptions>}
106+
* passed to `bootstrap`.
107+
*/
108+
static readonly EVENT_BOOTSTRAP_END = ApplicationEvents.BOOTSTRAP_END;
109+
103110
/**
104111
* Create a new TypeDoc application instance.
105112
*

src/lib/utils/fs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ export function glob(
166166
if (
167167
mini.set.some((row) =>
168168
mini.matchOne(
169-
// @ts-expect-error childPath really should be an array of strings, not a string.
170-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/61956
171169
childPath,
170+
// @ts-expect-error https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62049
172171
row,
173172
/* partial */ true
174173
)

src/test/converter2/issues/gh2024.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/test/issueTests.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import {
2-
deepStrictEqual,
32
deepStrictEqual as equal,
43
notDeepStrictEqual as notEqual,
54
ok,
65
} from "assert";
7-
import { Application } from "../lib/application";
8-
import { ApplicationEvents } from "../lib/application-events";
6+
import type { Application } from "../lib/application";
97
import {
108
DeclarationReflection,
119
ProjectReflection,
@@ -20,7 +18,6 @@ import {
2018
IntrinsicType,
2119
} from "../lib/models";
2220
import type { InlineTagDisplayPart } from "../lib/models/comments/comment";
23-
import { ParameterType, TypeDocOptionMap } from "../lib/utils";
2421
import { getConverter2App } from "./programs";
2522
import type { TestLogger } from "./TestLogger";
2623

@@ -728,40 +725,6 @@ export const issueTests: {
728725
);
729726
},
730727

731-
gh2024() {
732-
const name = "objectOptions" as keyof TypeDocOptionMap;
733-
const defaultValue = {
734-
neverChange: "ok",
735-
foo: "foo",
736-
};
737-
const app = new Application();
738-
app.options.addDeclaration({
739-
help: "Test option parsing with default values from plugins",
740-
name,
741-
type: ParameterType.Object,
742-
defaultValue,
743-
});
744-
deepStrictEqual(app.options.getValue(name), defaultValue);
745-
app.options.setValue(name, { foo: "bar" });
746-
const newVal = app.options.getValue(name) as typeof defaultValue;
747-
equal(newVal.foo, "bar");
748-
equal(newVal.neverChange, "ok");
749-
app.options.setValue("out", "testOutString");
750-
app.on(ApplicationEvents.BOOTSTRAP_END, () => {
751-
equal(app.options.getValue("out"), "");
752-
app.options.setValue("out", "testOutString");
753-
app.options.setValue(name, { foo: "foo" });
754-
});
755-
app.bootstrap();
756-
app.options.setValue(name, {});
757-
app.convert();
758-
deepStrictEqual(app.options.getValue(name), defaultValue);
759-
equal(
760-
app.options.getValue("out").trim().endsWith("testOutString"),
761-
true
762-
);
763-
},
764-
765728
gh2031(project, logger) {
766729
const sig = query(project, "MyClass.aMethod").signatures![0];
767730
const summaryLink = sig.comment?.summary[0];

src/test/utils/options/declaration.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,19 @@ describe("Options - conversions", () => {
345345
new Error("test must be an object")
346346
);
347347
});
348+
349+
it("Converts object options", () => {
350+
const declaration: ObjectDeclarationOption = {
351+
name: "test",
352+
help: "",
353+
type: ParameterType.Object,
354+
defaultValue: { a: 1, b: 2 },
355+
};
356+
equal(convert({ b: 3 }, declaration, "", declaration.defaultValue), {
357+
a: 1,
358+
b: 3,
359+
});
360+
});
348361
});
349362

350363
describe("Options - default values", () => {

0 commit comments

Comments
 (0)