Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api-markdown-documenter): Make configuration properties readonly #23368

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tools/api-markdown-documenter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ Combines the separate "config" property bag parameters into a single "options" p

- `ConfigurationBase` -\> `LoggingConfiguration`.

#### Configuration properties made `readonly`

- `ApiItemTransformationConfiguration`
- `ApiItemTransformationOptions`
- `DocumentationSuiteOptions`
- `HtmlRenderer.RenderHtmlConfig`
- `LintApiModelConfiguration`
- `MarkdownRenderer.Renderers`
- `MarkdownRenderer.RenderContext`
- `ToHtmlTransformations`

##### Example

Before:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ export { ApiItemKind }

// @public
export interface ApiItemTransformationConfiguration extends ApiItemTransformationOptions, DocumentationSuiteOptions, LoggingConfiguration {
apiModel: ApiModel;
readonly apiModel: ApiModel;
readonly uriRoot: string;
}

// @public
export interface ApiItemTransformationOptions {
createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
transformApiClass?: TransformApiItemWithChildren<ApiClass>;
transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
readonly createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
readonly transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
readonly transformApiClass?: TransformApiItemWithChildren<ApiClass>;
readonly transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
readonly transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
readonly transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
readonly transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
readonly transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
readonly transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
readonly transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
readonly transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
readonly transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
readonly transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
readonly transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
readonly transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
readonly transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
}

declare namespace ApiItemUtilities {
Expand Down Expand Up @@ -275,17 +275,17 @@ export abstract class DocumentationParentNodeBase<TDocumentationNode extends Doc

// @public
export interface DocumentationSuiteOptions {
documentBoundaries?: DocumentBoundaries;
getAlertsForItem?: (apiItem: ApiItem) => string[];
getFileNameForItem?: (apiItem: ApiItem) => string;
getHeadingTextForItem?: (apiItem: ApiItem) => string;
getLinkTextForItem?: (apiItem: ApiItem) => string;
getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
hierarchyBoundaries?: HierarchyBoundaries;
includeBreadcrumb?: boolean;
includeTopLevelDocumentHeading?: boolean;
minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
skipPackage?: (apiPackage: ApiPackage) => boolean;
readonly documentBoundaries?: DocumentBoundaries;
readonly getAlertsForItem?: (apiItem: ApiItem) => string[];
readonly getFileNameForItem?: (apiItem: ApiItem) => string;
readonly getHeadingTextForItem?: (apiItem: ApiItem) => string;
readonly getLinkTextForItem?: (apiItem: ApiItem) => string;
readonly getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
readonly hierarchyBoundaries?: HierarchyBoundaries;
readonly includeBreadcrumb?: boolean;
readonly includeTopLevelDocumentHeading?: boolean;
readonly minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
readonly skipPackage?: (apiPackage: ApiPackage) => boolean;
}

// @public
Expand Down Expand Up @@ -504,7 +504,7 @@ export function lintApiModel(configuration: LintApiModelConfiguration): Promise<

// @beta
export interface LintApiModelConfiguration extends LoggingConfiguration {
apiModel: ApiModel;
readonly apiModel: ApiModel;
}

// @beta
Expand Down Expand Up @@ -554,8 +554,8 @@ export interface MarkdownRenderConfiguration extends LoggingConfiguration {

// @public
export interface MarkdownRenderContext extends TextFormatting {
customRenderers?: MarkdownRenderers;
headingLevel: number;
readonly customRenderers?: MarkdownRenderers;
readonly headingLevel: number;
readonly insideCodeBlock?: boolean;
readonly insideTable?: boolean;
}
Expand All @@ -575,7 +575,7 @@ export { MarkdownRenderer }

// @public
export interface MarkdownRenderers {
[documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
readonly [documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
}

// @public
Expand Down Expand Up @@ -661,7 +661,7 @@ function renderHtml(html: Nodes, { prettyFormatting }: {

// @public @sealed
export interface RenderHtmlConfig {
prettyFormatting?: boolean;
readonly prettyFormatting?: boolean;
}

// @public
Expand Down Expand Up @@ -792,7 +792,7 @@ export type ToHtmlTransformation = (node: DocumentationNode, context: ToHtmlCont

// @public
export interface ToHtmlTransformations {
[documentationNodeKind: string]: ToHtmlTransformation;
readonly [documentationNodeKind: string]: ToHtmlTransformation;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ export { ApiItemKind }

// @public
export interface ApiItemTransformationConfiguration extends ApiItemTransformationOptions, DocumentationSuiteOptions, LoggingConfiguration {
apiModel: ApiModel;
readonly apiModel: ApiModel;
readonly uriRoot: string;
}

// @public
export interface ApiItemTransformationOptions {
createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
transformApiClass?: TransformApiItemWithChildren<ApiClass>;
transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
readonly createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
readonly transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
readonly transformApiClass?: TransformApiItemWithChildren<ApiClass>;
readonly transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
readonly transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
readonly transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
readonly transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
readonly transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
readonly transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
readonly transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
readonly transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
readonly transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
readonly transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
readonly transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
readonly transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
readonly transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
}

declare namespace ApiItemUtilities {
Expand Down Expand Up @@ -275,17 +275,17 @@ export abstract class DocumentationParentNodeBase<TDocumentationNode extends Doc

// @public
export interface DocumentationSuiteOptions {
documentBoundaries?: DocumentBoundaries;
getAlertsForItem?: (apiItem: ApiItem) => string[];
getFileNameForItem?: (apiItem: ApiItem) => string;
getHeadingTextForItem?: (apiItem: ApiItem) => string;
getLinkTextForItem?: (apiItem: ApiItem) => string;
getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
hierarchyBoundaries?: HierarchyBoundaries;
includeBreadcrumb?: boolean;
includeTopLevelDocumentHeading?: boolean;
minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
skipPackage?: (apiPackage: ApiPackage) => boolean;
readonly documentBoundaries?: DocumentBoundaries;
readonly getAlertsForItem?: (apiItem: ApiItem) => string[];
readonly getFileNameForItem?: (apiItem: ApiItem) => string;
readonly getHeadingTextForItem?: (apiItem: ApiItem) => string;
readonly getLinkTextForItem?: (apiItem: ApiItem) => string;
readonly getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
readonly hierarchyBoundaries?: HierarchyBoundaries;
readonly includeBreadcrumb?: boolean;
readonly includeTopLevelDocumentHeading?: boolean;
readonly minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
readonly skipPackage?: (apiPackage: ApiPackage) => boolean;
}

// @public
Expand Down Expand Up @@ -504,7 +504,7 @@ export function lintApiModel(configuration: LintApiModelConfiguration): Promise<

// @beta
export interface LintApiModelConfiguration extends LoggingConfiguration {
apiModel: ApiModel;
readonly apiModel: ApiModel;
}

// @beta
Expand Down Expand Up @@ -554,8 +554,8 @@ export interface MarkdownRenderConfiguration extends LoggingConfiguration {

// @public
export interface MarkdownRenderContext extends TextFormatting {
customRenderers?: MarkdownRenderers;
headingLevel: number;
readonly customRenderers?: MarkdownRenderers;
readonly headingLevel: number;
readonly insideCodeBlock?: boolean;
readonly insideTable?: boolean;
}
Expand All @@ -575,7 +575,7 @@ export { MarkdownRenderer }

// @public
export interface MarkdownRenderers {
[documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
readonly [documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
}

// @public
Expand Down Expand Up @@ -655,7 +655,7 @@ function renderHtml(html: Nodes, { prettyFormatting }: {

// @public @sealed
export interface RenderHtmlConfig {
prettyFormatting?: boolean;
readonly prettyFormatting?: boolean;
}

// @public
Expand Down Expand Up @@ -786,7 +786,7 @@ export type ToHtmlTransformation = (node: DocumentationNode, context: ToHtmlCont

// @public
export interface ToHtmlTransformations {
[documentationNodeKind: string]: ToHtmlTransformation;
readonly [documentationNodeKind: string]: ToHtmlTransformation;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ export { ApiItemKind }

// @public
export interface ApiItemTransformationConfiguration extends ApiItemTransformationOptions, DocumentationSuiteOptions, LoggingConfiguration {
apiModel: ApiModel;
readonly apiModel: ApiModel;
readonly uriRoot: string;
}

// @public
export interface ApiItemTransformationOptions {
createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
transformApiClass?: TransformApiItemWithChildren<ApiClass>;
transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
readonly createDefaultLayout?: (apiItem: ApiItem, childSections: SectionNode[] | undefined, config: Required<ApiItemTransformationConfiguration>) => SectionNode[];
readonly transformApiCallSignature?: TransformApiItemWithoutChildren<ApiCallSignature>;
readonly transformApiClass?: TransformApiItemWithChildren<ApiClass>;
readonly transformApiConstructor?: TransformApiItemWithoutChildren<ApiConstructSignature | ApiConstructor>;
readonly transformApiEntryPoint?: TransformApiItemWithChildren<ApiEntryPoint>;
readonly transformApiEnum?: TransformApiItemWithChildren<ApiEnum>;
readonly transformApiEnumMember?: TransformApiItemWithoutChildren<ApiEnumMember>;
readonly transformApiFunction?: TransformApiItemWithoutChildren<ApiFunction>;
readonly transformApiIndexSignature?: TransformApiItemWithoutChildren<ApiIndexSignature>;
readonly transformApiInterface?: TransformApiItemWithChildren<ApiInterface>;
readonly transformApiMethod?: TransformApiItemWithoutChildren<ApiMethod | ApiMethodSignature>;
readonly transformApiModel?: TransformApiItemWithoutChildren<ApiModel>;
readonly transformApiNamespace?: TransformApiItemWithChildren<ApiNamespace>;
readonly transformApiProperty?: TransformApiItemWithoutChildren<ApiPropertyItem>;
readonly transformApiTypeAlias?: TransformApiItemWithoutChildren<ApiTypeAlias>;
readonly transformApiVariable?: TransformApiItemWithoutChildren<ApiVariable>;
}

declare namespace ApiItemUtilities {
Expand Down Expand Up @@ -275,17 +275,17 @@ export abstract class DocumentationParentNodeBase<TDocumentationNode extends Doc

// @public
export interface DocumentationSuiteOptions {
documentBoundaries?: DocumentBoundaries;
getAlertsForItem?: (apiItem: ApiItem) => string[];
getFileNameForItem?: (apiItem: ApiItem) => string;
getHeadingTextForItem?: (apiItem: ApiItem) => string;
getLinkTextForItem?: (apiItem: ApiItem) => string;
getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
hierarchyBoundaries?: HierarchyBoundaries;
includeBreadcrumb?: boolean;
includeTopLevelDocumentHeading?: boolean;
minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
skipPackage?: (apiPackage: ApiPackage) => boolean;
readonly documentBoundaries?: DocumentBoundaries;
readonly getAlertsForItem?: (apiItem: ApiItem) => string[];
readonly getFileNameForItem?: (apiItem: ApiItem) => string;
readonly getHeadingTextForItem?: (apiItem: ApiItem) => string;
readonly getLinkTextForItem?: (apiItem: ApiItem) => string;
readonly getUriBaseOverrideForItem?: (apiItem: ApiItem) => string | undefined;
readonly hierarchyBoundaries?: HierarchyBoundaries;
readonly includeBreadcrumb?: boolean;
readonly includeTopLevelDocumentHeading?: boolean;
readonly minimumReleaseLevel?: Omit<ReleaseTag, ReleaseTag.None>;
readonly skipPackage?: (apiPackage: ApiPackage) => boolean;
}

// @public
Expand Down Expand Up @@ -532,8 +532,8 @@ export interface MarkdownRenderConfiguration extends LoggingConfiguration {

// @public
export interface MarkdownRenderContext extends TextFormatting {
customRenderers?: MarkdownRenderers;
headingLevel: number;
readonly customRenderers?: MarkdownRenderers;
readonly headingLevel: number;
readonly insideCodeBlock?: boolean;
readonly insideTable?: boolean;
}
Expand All @@ -553,7 +553,7 @@ export { MarkdownRenderer }

// @public
export interface MarkdownRenderers {
[documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
readonly [documentationNodeKind: string]: (node: DocumentationNode, writer: DocumentWriter, context: MarkdownRenderContext) => void;
}

// @public
Expand Down Expand Up @@ -633,7 +633,7 @@ function renderHtml(html: Nodes, { prettyFormatting }: {

// @public @sealed
export interface RenderHtmlConfig {
prettyFormatting?: boolean;
readonly prettyFormatting?: boolean;
}

// @public
Expand Down Expand Up @@ -764,7 +764,7 @@ export type ToHtmlTransformation = (node: DocumentationNode, context: ToHtmlCont

// @public
export interface ToHtmlTransformations {
[documentationNodeKind: string]: ToHtmlTransformation;
readonly [documentationNodeKind: string]: ToHtmlTransformation;
}

// @public
Expand Down
2 changes: 1 addition & 1 deletion tools/api-markdown-documenter/src/LintApiModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface LintApiModelConfiguration extends LoggingConfiguration {
/**
* The API model to lint.
*/
apiModel: ApiModel;
readonly apiModel: ApiModel;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface ApiItemTransformationConfiguration
*
* If you need to generate a model from API reports on disk, see {@link loadModel}.
*/
apiModel: ApiModel;
readonly apiModel: ApiModel;

/**
* Default root URI used when generating content links.
Expand Down
Loading
Loading