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

[api-extractor] Rename source file #1218

Merged
merged 3 commits into from
Apr 9, 2019
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
6 changes: 3 additions & 3 deletions apps/api-extractor/src/api/Extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Collector } from '../collector/Collector';
import { DtsRollupGenerator, DtsRollupKind } from '../generators/DtsRollupGenerator';
import { ApiModelGenerator } from '../generators/ApiModelGenerator';
import { ApiPackage } from '@microsoft/api-extractor-model';
import { ReviewFileGenerator } from '../generators/ReviewFileGenerator';
import { ApiReportGenerator } from '../generators/ApiReportGenerator';
import { PackageMetadataManager } from '../analyzer/PackageMetadataManager';
import { ValidationEnhancer } from '../enhancers/ValidationEnhancer';
import { DocCommentEnhancer } from '../enhancers/DocCommentEnhancer';
Expand Down Expand Up @@ -216,7 +216,7 @@ export class Extractor {
const expectedApiReportPath: string = extractorConfig.reportFilePath;
const expectedApiReportShortPath: string = extractorConfig._getShortFilePath(extractorConfig.reportFilePath);

const actualApiReportContent: string = ReviewFileGenerator.generateReviewFileContent(collector);
const actualApiReportContent: string = ApiReportGenerator.generateReviewFileContent(collector);

// Write the actual file
FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {
Expand All @@ -228,7 +228,7 @@ export class Extractor {
if (FileSystem.exists(expectedApiReportPath)) {
const expectedApiReportContent: string = FileSystem.readFile(expectedApiReportPath);

if (!ReviewFileGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
if (!ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
apiReportChanged = true;

if (!localBuild) {
Expand Down
2 changes: 1 addition & 1 deletion apps/api-extractor/src/collector/Collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface ICollectorOptions {

/**
* The `Collector` manages the overall data set that is used by `ApiModelGenerator`,
* `DtsRollupGenerator`, and `ReviewFileGenerator`. Starting from the working package's entry point,
* `DtsRollupGenerator`, and `ApiReportGenerator`. Starting from the working package's entry point,
* the `Collector` collects all exported symbols, determines how to import any symbols they reference,
* assigns unique names, and sorts everything into a normalized alphabetical ordering.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ExtractorMessage } from '../api/ExtractorMessage';
import { StringWriter } from './StringWriter';
import { DtsEmitHelpers } from './DtsEmitHelpers';

export class ReviewFileGenerator {
export class ApiReportGenerator {
/**
* Compares the contents of two API files that were created using ApiFileGenerator,
* and returns true if they are equivalent. Note that these files are not normally edited
Expand Down Expand Up @@ -101,15 +101,15 @@ export class ReviewFileGenerator {
messagesToReport.push(message);
}

stringWriter.write(ReviewFileGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));
stringWriter.write(ApiReportGenerator._getAedocSynopsis(collector, astDeclaration, messagesToReport));

const span: Span = new Span(astDeclaration.declaration);

const declarationMetadata: DeclarationMetadata = collector.fetchMetadata(astDeclaration);
if (declarationMetadata.isPreapproved) {
ReviewFileGenerator._modifySpanForPreapproved(span);
ApiReportGenerator._modifySpanForPreapproved(span);
} else {
ReviewFileGenerator._modifySpan(collector, span, entity, astDeclaration, false);
ApiReportGenerator._modifySpan(collector, span, entity, astDeclaration, false);
}

span.writeModifiedText(stringWriter.stringBuilder);
Expand All @@ -121,7 +121,7 @@ export class ReviewFileGenerator {
for (const exportToEmit of exportsToEmit.values()) {
// Write any associated messages
for (const message of exportToEmit.associatedMessages) {
ReviewFileGenerator._writeLineAsComments(stringWriter,
ApiReportGenerator._writeLineAsComments(stringWriter,
'Warning: ' + message.formatMessageWithoutLocation());
}

Expand All @@ -138,18 +138,18 @@ export class ReviewFileGenerator {
.fetchUnassociatedMessagesForReviewFile();
if (unassociatedMessages.length > 0) {
stringWriter.writeLine();
ReviewFileGenerator._writeLineAsComments(stringWriter, 'Warnings were encountered during analysis:');
ReviewFileGenerator._writeLineAsComments(stringWriter, '');
ApiReportGenerator._writeLineAsComments(stringWriter, 'Warnings were encountered during analysis:');
ApiReportGenerator._writeLineAsComments(stringWriter, '');
for (const unassociatedMessage of unassociatedMessages) {
ReviewFileGenerator._writeLineAsComments(stringWriter, unassociatedMessage.formatMessageWithLocation(
ApiReportGenerator._writeLineAsComments(stringWriter, unassociatedMessage.formatMessageWithLocation(
collector.workingPackage.packageFolder
));
}
}

if (collector.workingPackage.tsdocComment === undefined) {
stringWriter.writeLine();
ReviewFileGenerator._writeLineAsComments(stringWriter, '(No @packageDocumentation comment for this package)');
ApiReportGenerator._writeLineAsComments(stringWriter, '(No @packageDocumentation comment for this package)');
}

// Write the closing delimiter for the Markdown code fence
Expand Down Expand Up @@ -294,16 +294,16 @@ export class ReviewFileGenerator {
if (!insideTypeLiteral) {
const messagesToReport: ExtractorMessage[] = collector.messageRouter
.fetchAssociatedMessagesForReviewFile(childAstDeclaration);
const aedocSynopsis: string = ReviewFileGenerator._getAedocSynopsis(collector, childAstDeclaration,
const aedocSynopsis: string = ApiReportGenerator._getAedocSynopsis(collector, childAstDeclaration,
messagesToReport);
const indentedAedocSynopsis: string = ReviewFileGenerator._addIndentAfterNewlines(aedocSynopsis,
const indentedAedocSynopsis: string = ApiReportGenerator._addIndentAfterNewlines(aedocSynopsis,
child.getIndent());

child.modification.prefix = indentedAedocSynopsis + child.modification.prefix;
}
}

ReviewFileGenerator._modifySpan(collector, child, entity, childAstDeclaration, insideTypeLiteral);
ApiReportGenerator._modifySpan(collector, child, entity, childAstDeclaration, insideTypeLiteral);
}
}
}
Expand Down Expand Up @@ -369,7 +369,7 @@ export class ReviewFileGenerator {
const stringWriter: StringWriter = new StringWriter();

for (const message of messagesToReport) {
ReviewFileGenerator._writeLineAsComments(stringWriter, 'Warning: ' + message.formatMessageWithoutLocation());
ApiReportGenerator._writeLineAsComments(stringWriter, 'Warning: ' + message.formatMessageWithoutLocation());
}

const declarationMetadata: DeclarationMetadata = collector.fetchMetadata(astDeclaration);
Expand Down Expand Up @@ -411,10 +411,10 @@ export class ReviewFileGenerator {

if (footerParts.length > 0) {
if (messagesToReport.length > 0) {
ReviewFileGenerator._writeLineAsComments(stringWriter, ''); // skip a line after the warnings
ApiReportGenerator._writeLineAsComments(stringWriter, ''); // skip a line after the warnings
}

ReviewFileGenerator._writeLineAsComments(stringWriter, footerParts.join(' '));
ApiReportGenerator._writeLineAsComments(stringWriter, footerParts.join(' '));
}

return stringWriter.toString();
Expand Down
2 changes: 1 addition & 1 deletion apps/api-extractor/src/generators/DtsEmitHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { StringWriter } from './StringWriter';
import { Collector } from '../collector/Collector';

/**
* Some common code shared between DtsRollupGenerator and ReviewFileGenerator.
* Some common code shared between DtsRollupGenerator and ApiReportGenerator.
*/
export class DtsEmitHelpers {
public static emitImport(stringWriter: StringWriter, collectorEntity: CollectorEntity, astImport: AstImport): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "",
"packageName": "@microsoft/api-extractor",
"type": "none"
}
],
"packageName": "@microsoft/api-extractor",
"email": "[email protected]"
}