Skip to content

Commit 73289c5

Browse files
committed
Introduce a simple plugin contract for API Documenter
1 parent dd7de42 commit 73289c5

6 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
4+
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
5+
6+
"apiReport": {
7+
"enabled": true,
8+
"reportFolder": "../../../common/reviews/api"
9+
},
10+
11+
"docModel": {
12+
"enabled": true,
13+
"apiJsonFilePath": "../../../common/temp/api/<unscopedPackageName>.api.json"
14+
},
15+
16+
"dtsRollup": {
17+
"enabled": true,
18+
"untrimmedFilePath": "<projectFolder>/dist/rollup.d.ts",
19+
}
20+
}

apps/api-documenter/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"bin": {
1515
"api-documenter": "./bin/api-documenter"
1616
},
17+
"main": "lib/index.js",
18+
"typings": "dist/rollup.d.ts",
1719
"dependencies": {
1820
"@microsoft/api-extractor-model": "7.3.4",
1921
"@microsoft/node-core-library": "3.14.1",

apps/api-documenter/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
export { MarkdownDocumenterExtension } from './plugin/MarkdownDocumenterExtension';
5+
export { IExtensionDefinition, IApiDocumenterPluginManifest } from './plugin/IApiDocumenterPluginManifest';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import { MarkdownDocumenterExtension } from './MarkdownDocumenterExtension';
5+
6+
export interface IExtensionDefinition {
7+
/**
8+
* The name of this extension, as it will appear in the config file.
9+
*
10+
* The name should consist of one or more words separated by hyphens. Each word should consist of lower case
11+
* letters and numbers. Example: `my-extension`
12+
*/
13+
name: string;
14+
15+
/**
16+
* The name of the base class.
17+
*/
18+
kind: 'MarkdownDocumenterExtension';
19+
20+
/**
21+
* Your subclass that extends from the base class.
22+
*/
23+
subclass: { new(): MarkdownDocumenterExtension };
24+
}
25+
26+
export interface IApiDocumenterPluginManifest {
27+
extensions: IExtensionDefinition[];
28+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
/**
5+
* @public
6+
*/
7+
export class MarkdownDocumenterExtension {
8+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## API Report File for "@microsoft/api-documenter"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
// @public (undocumented)
8+
export interface IApiDocumenterPluginManifest {
9+
// (undocumented)
10+
extensions: IExtensionDefinition[];
11+
}
12+
13+
// @public (undocumented)
14+
export interface IExtensionDefinition {
15+
kind: 'MarkdownDocumenterExtension';
16+
name: string;
17+
subclass: {
18+
new (): MarkdownDocumenterExtension;
19+
};
20+
}
21+
22+
// @public (undocumented)
23+
export class MarkdownDocumenterExtension {
24+
}
25+
26+
27+
// (No @packageDocumentation comment for this package)
28+
29+
```

0 commit comments

Comments
 (0)