@microsoft/api-extractor 7.53.3 → 7.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "@microsoft/api-extractor",
3
3
  "entries": [
4
+ {
5
+ "version": "7.54.0",
6
+ "tag": "@microsoft/api-extractor_v7.54.0",
7
+ "date": "Tue, 04 Nov 2025 07:31:54 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Add a new setting `IExtractorInvokeOptions.printApiReportDiff` that makes build logs easier to diagnose by printing a diff of any changes to API report files (*.api.md)."
12
+ },
13
+ {
14
+ "comment": "Add a `--print-api-report-diff` CLI flag that causes a diff of any changes to API report files (*.api.md) to be printed."
15
+ }
16
+ ]
17
+ }
18
+ },
4
19
  {
5
20
  "version": "7.53.3",
6
21
  "tag": "@microsoft/api-extractor_v7.53.3",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log - @microsoft/api-extractor
2
2
 
3
- This log was last generated on Fri, 24 Oct 2025 00:13:38 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 04 Nov 2025 07:31:54 GMT and should not be manually modified.
4
+
5
+ ## 7.54.0
6
+ Tue, 04 Nov 2025 07:31:54 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Add a new setting `IExtractorInvokeOptions.printApiReportDiff` that makes build logs easier to diagnose by printing a diff of any changes to API report files (*.api.md).
11
+ - Add a `--print-api-report-diff` CLI flag that causes a diff of any changes to API report files (*.api.md) to be printed.
4
12
 
5
13
  ## 7.53.3
6
14
  Fri, 24 Oct 2025 00:13:38 GMT
package/dist/rollup.d.ts CHANGED
@@ -110,6 +110,11 @@ export declare enum ConsoleMessageId {
110
110
  * See the Git repo documentation for more info."
111
111
  */
112
112
  ApiReportNotCopied = "console-api-report-not-copied",
113
+ /**
114
+ * Changes to the API report:
115
+ * ___
116
+ */
117
+ ApiReportDiff = "console-api-report-diff",
113
118
  /**
114
119
  * "You have changed the public API signature for this project. Updating ___"
115
120
  */
@@ -163,6 +168,7 @@ export declare class Extractor {
163
168
  * @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
164
169
  * which the new report will be written post-comparison.
165
170
  * @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
171
+ * @param printApiReportDiff - {@link IExtractorInvokeOptions.printApiReportDiff}
166
172
  *
167
173
  * @returns Whether or not the newly generated report differs from the existing report (if one exists).
168
174
  */
@@ -1337,6 +1343,14 @@ export declare interface IExtractorInvokeOptions {
1337
1343
  * the STDERR/STDOUT console.
1338
1344
  */
1339
1345
  messageCallback?: (message: ExtractorMessage) => void;
1346
+ /**
1347
+ * If true, then any differences between the actual and expected API reports will be
1348
+ * printed on the console.
1349
+ *
1350
+ * @remarks
1351
+ * The diff is not printed if the expected API report file has not been created yet.
1352
+ */
1353
+ printApiReportDiff?: boolean;
1340
1354
  }
1341
1355
 
1342
1356
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.53.1"
8
+ "packageVersion": "7.53.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -50,6 +50,11 @@ export declare enum ConsoleMessageId {
50
50
  * See the Git repo documentation for more info."
51
51
  */
52
52
  ApiReportNotCopied = "console-api-report-not-copied",
53
+ /**
54
+ * Changes to the API report:
55
+ * ___
56
+ */
57
+ ApiReportDiff = "console-api-report-diff",
53
58
  /**
54
59
  * "You have changed the public API signature for this project. Updating ___"
55
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleMessageId.d.ts","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,QAAQ,qBAAqB;IAE7B;;;OAGG;IACH,qBAAqB,oCAAoC;IAEzD;;OAEG;IACH,sBAAsB,sCAAsC;IAE5D;;OAEG;IACH,kBAAkB,iCAAiC;IAEnD;;OAEG;IACH,mBAAmB,mCAAmC;IAEtD;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;;;;;;;;;OAUG;IACH,kBAAkB,kCAAkC;IAEpD;;OAEG;IACH,eAAe,8BAA8B;IAE7C;;OAEG;IACH,kBAAkB,iCAAiC;IAEnD;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;OAEG;IACH,sBAAsB,sCAAsC;IAE5D;;OAEG;IACH,WAAW,wBAAwB;CACpC"}
1
+ {"version":3,"file":"ConsoleMessageId.d.ts","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,oBAAY,gBAAgB;IAC1B;;OAEG;IACH,QAAQ,qBAAqB;IAE7B;;;OAGG;IACH,qBAAqB,oCAAoC;IAEzD;;OAEG;IACH,sBAAsB,sCAAsC;IAE5D;;OAEG;IACH,kBAAkB,iCAAiC;IAEnD;;OAEG;IACH,mBAAmB,mCAAmC;IAEtD;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;;;;;;;;;OAUG;IACH,kBAAkB,kCAAkC;IAEpD;;;OAGG;IACH,aAAa,4BAA4B;IAEzC;;OAEG;IACH,eAAe,8BAA8B;IAE7C;;OAEG;IACH,kBAAkB,iCAAiC;IAEnD;;OAEG;IACH,gBAAgB,+BAA+B;IAE/C;;OAEG;IACH,sBAAsB,sCAAsC;IAE5D;;OAEG;IACH,WAAW,wBAAwB;CACpC"}
@@ -56,6 +56,11 @@ var ConsoleMessageId;
56
56
  * See the Git repo documentation for more info."
57
57
  */
58
58
  ConsoleMessageId["ApiReportNotCopied"] = "console-api-report-not-copied";
59
+ /**
60
+ * Changes to the API report:
61
+ * ___
62
+ */
63
+ ConsoleMessageId["ApiReportDiff"] = "console-api-report-diff";
59
64
  /**
60
65
  * "You have changed the public API signature for this project. Updating ___"
61
66
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleMessageId.js","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;GASG;AACH,IAAY,gBA0EX;AA1ED,WAAY,gBAAgB;IAC1B;;OAEG;IACH,iDAA6B,CAAA;IAE7B;;;OAGG;IACH,6EAAyD,CAAA;IAEzD;;OAEG;IACH,gFAA4D,CAAA;IAE5D;;OAEG;IACH,uEAAmD,CAAA;IAEnD;;OAEG;IACH,0EAAsD,CAAA;IAEtD;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;;;;;;;;;OAUG;IACH,wEAAoD,CAAA;IAEpD;;OAEG;IACH,iEAA6C,CAAA;IAE7C;;OAEG;IACH,uEAAmD,CAAA;IAEnD;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;OAEG;IACH,gFAA4D,CAAA;IAE5D;;OAEG;IACH,uDAAmC,CAAA;AACrC,CAAC,EA1EW,gBAAgB,gCAAhB,gBAAgB,QA0E3B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Unique identifiers for console messages reported by API Extractor.\n *\n * @remarks\n *\n * These strings are possible values for the {@link ExtractorMessage.messageId} property\n * when the `ExtractorMessage.category` is {@link ExtractorMessageCategory.Console}.\n *\n * @public\n */\nexport enum ConsoleMessageId {\n /**\n * \"Analysis will use the bundled TypeScript version ___\"\n */\n Preamble = 'console-preamble',\n\n /**\n * \"The target project appears to use TypeScript ___ which is newer than the bundled compiler engine;\n * consider upgrading API Extractor.\"\n */\n CompilerVersionNotice = 'console-compiler-version-notice',\n\n /**\n * \"Using custom TSDoc config from ___\"\n */\n UsingCustomTSDocConfig = 'console-using-custom-tsdoc-config',\n\n /**\n * \"Found metadata in ___\"\n */\n FoundTSDocMetadata = 'console-found-tsdoc-metadata',\n\n /**\n * \"Writing: ___\"\n */\n WritingDocModelFile = 'console-writing-doc-model-file',\n\n /**\n * \"Writing package typings: ___\"\n */\n WritingDtsRollup = 'console-writing-dts-rollup',\n\n /**\n * \"Generating ___ API report: ___\"\n */\n WritingApiReport = 'console-writing-api-report',\n\n /**\n * \"You have changed the public API signature for this project.\n * Please copy the file ___ to ___, or perform a local build (which does this automatically).\n * See the Git repo documentation for more info.\"\n *\n * OR\n *\n * \"The API report file is missing.\n * Please copy the file ___ to ___, or perform a local build (which does this automatically).\n * See the Git repo documentation for more info.\"\n */\n ApiReportNotCopied = 'console-api-report-not-copied',\n\n /**\n * \"You have changed the public API signature for this project. Updating ___\"\n */\n ApiReportCopied = 'console-api-report-copied',\n\n /**\n * \"The API report is up to date: ___\"\n */\n ApiReportUnchanged = 'console-api-report-unchanged',\n\n /**\n * \"The API report file was missing, so a new file was created. Please add this file to Git: ___\"\n */\n ApiReportCreated = 'console-api-report-created',\n\n /**\n * \"Unable to create the API report file. Please make sure the target folder exists: ___\"\n */\n ApiReportFolderMissing = 'console-api-report-folder-missing',\n\n /**\n * Used for the information printed when the \"--diagnostics\" flag is enabled.\n */\n Diagnostics = 'console-diagnostics'\n}\n"]}
1
+ {"version":3,"file":"ConsoleMessageId.js","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;GASG;AACH,IAAY,gBAgFX;AAhFD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,iDAA6B,CAAA;IAE7B;;;OAGG;IACH,6EAAyD,CAAA;IAEzD;;OAEG;IACH,gFAA4D,CAAA;IAE5D;;OAEG;IACH,uEAAmD,CAAA;IAEnD;;OAEG;IACH,0EAAsD,CAAA;IAEtD;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;;;;;;;;;OAUG;IACH,wEAAoD,CAAA;IAEpD;;;OAGG;IACH,6DAAyC,CAAA;IAEzC;;OAEG;IACH,iEAA6C,CAAA;IAE7C;;OAEG;IACH,uEAAmD,CAAA;IAEnD;;OAEG;IACH,mEAA+C,CAAA;IAE/C;;OAEG;IACH,gFAA4D,CAAA;IAE5D;;OAEG;IACH,uDAAmC,CAAA;AACrC,CAAC,EAhFW,gBAAgB,gCAAhB,gBAAgB,QAgF3B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/**\n * Unique identifiers for console messages reported by API Extractor.\n *\n * @remarks\n *\n * These strings are possible values for the {@link ExtractorMessage.messageId} property\n * when the `ExtractorMessage.category` is {@link ExtractorMessageCategory.Console}.\n *\n * @public\n */\nexport enum ConsoleMessageId {\n /**\n * \"Analysis will use the bundled TypeScript version ___\"\n */\n Preamble = 'console-preamble',\n\n /**\n * \"The target project appears to use TypeScript ___ which is newer than the bundled compiler engine;\n * consider upgrading API Extractor.\"\n */\n CompilerVersionNotice = 'console-compiler-version-notice',\n\n /**\n * \"Using custom TSDoc config from ___\"\n */\n UsingCustomTSDocConfig = 'console-using-custom-tsdoc-config',\n\n /**\n * \"Found metadata in ___\"\n */\n FoundTSDocMetadata = 'console-found-tsdoc-metadata',\n\n /**\n * \"Writing: ___\"\n */\n WritingDocModelFile = 'console-writing-doc-model-file',\n\n /**\n * \"Writing package typings: ___\"\n */\n WritingDtsRollup = 'console-writing-dts-rollup',\n\n /**\n * \"Generating ___ API report: ___\"\n */\n WritingApiReport = 'console-writing-api-report',\n\n /**\n * \"You have changed the public API signature for this project.\n * Please copy the file ___ to ___, or perform a local build (which does this automatically).\n * See the Git repo documentation for more info.\"\n *\n * OR\n *\n * \"The API report file is missing.\n * Please copy the file ___ to ___, or perform a local build (which does this automatically).\n * See the Git repo documentation for more info.\"\n */\n ApiReportNotCopied = 'console-api-report-not-copied',\n\n /**\n * Changes to the API report:\n * ___\n */\n ApiReportDiff = 'console-api-report-diff',\n\n /**\n * \"You have changed the public API signature for this project. Updating ___\"\n */\n ApiReportCopied = 'console-api-report-copied',\n\n /**\n * \"The API report is up to date: ___\"\n */\n ApiReportUnchanged = 'console-api-report-unchanged',\n\n /**\n * \"The API report file was missing, so a new file was created. Please add this file to Git: ___\"\n */\n ApiReportCreated = 'console-api-report-created',\n\n /**\n * \"Unable to create the API report file. Please make sure the target folder exists: ___\"\n */\n ApiReportFolderMissing = 'console-api-report-folder-missing',\n\n /**\n * Used for the information printed when the \"--diagnostics\" flag is enabled.\n */\n Diagnostics = 'console-diagnostics'\n}\n"]}
@@ -55,6 +55,14 @@ export interface IExtractorInvokeOptions {
55
55
  * the STDERR/STDOUT console.
56
56
  */
57
57
  messageCallback?: (message: ExtractorMessage) => void;
58
+ /**
59
+ * If true, then any differences between the actual and expected API reports will be
60
+ * printed on the console.
61
+ *
62
+ * @remarks
63
+ * The diff is not printed if the expected API report file has not been created yet.
64
+ */
65
+ printApiReportDiff?: boolean;
58
66
  }
59
67
  /**
60
68
  * This object represents the outcome of an invocation of API Extractor.
@@ -133,6 +141,7 @@ export declare class Extractor {
133
141
  * @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
134
142
  * which the new report will be written post-comparison.
135
143
  * @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
144
+ * @param printApiReportDiff - {@link IExtractorInvokeOptions.printApiReportDiff}
136
145
  *
137
146
  * @returns Whether or not the newly generated report differs from the existing report (if one exists).
138
147
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAkC,MAAM,mBAAmB,CAAC;AAQpF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK3D;;;;GAIG;AACH,MAAM,WA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ED;;OAEG;IACH,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED,OAAO,CAAC,MAAM,CAAC,eAAe;IAI9B;;OAEG;WACW,mBAAmB,CAC/B,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,uBAAuB,GAChC,eAAe;IAMlB;;OAEG;WACW,MAAM,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,eAAe;IAsL1G;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAoI9B,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAsC1C,OAAO,CAAC,MAAM,CAAC,sBAAsB;CActC"}
@@ -102,30 +102,21 @@ class Extractor {
102
102
  * Invoke API Extractor using an already prepared `ExtractorConfig` object.
103
103
  */
104
104
  static invoke(extractorConfig, options) {
105
- if (!options) {
106
- options = {};
107
- }
108
- const localBuild = options.localBuild || false;
109
- let compilerState;
110
- if (options.compilerState) {
111
- compilerState = options.compilerState;
112
- }
113
- else {
114
- compilerState = CompilerState_1.CompilerState.create(extractorConfig, options);
115
- }
105
+ const { packageFolder, messages, tsdocConfiguration, tsdocConfigFile: { filePath: tsdocConfigFilePath, fileNotFound: tsdocConfigFileNotFound }, apiJsonFilePath, newlineKind, reportTempFolder, reportFolder, apiReportEnabled, reportConfigs, testMode, rollupEnabled, publicTrimmedFilePath, alphaTrimmedFilePath, betaTrimmedFilePath, untrimmedFilePath, tsdocMetadataEnabled, tsdocMetadataFilePath } = extractorConfig;
106
+ const { localBuild = false, compilerState = CompilerState_1.CompilerState.create(extractorConfig, options), messageCallback, showVerboseMessages = false, showDiagnostics = false, printApiReportDiff = false } = options !== null && options !== void 0 ? options : {};
116
107
  const sourceMapper = new SourceMapper_1.SourceMapper();
117
108
  const messageRouter = new MessageRouter_1.MessageRouter({
118
- workingPackageFolder: extractorConfig.packageFolder,
119
- messageCallback: options.messageCallback,
120
- messagesConfig: extractorConfig.messages || {},
121
- showVerboseMessages: !!options.showVerboseMessages,
122
- showDiagnostics: !!options.showDiagnostics,
123
- tsdocConfiguration: extractorConfig.tsdocConfiguration,
109
+ workingPackageFolder: packageFolder,
110
+ messageCallback,
111
+ messagesConfig: messages || {},
112
+ showVerboseMessages,
113
+ showDiagnostics,
114
+ tsdocConfiguration,
124
115
  sourceMapper
125
116
  });
126
- if (extractorConfig.tsdocConfigFile.filePath && !extractorConfig.tsdocConfigFile.fileNotFound) {
127
- if (!node_core_library_1.Path.isEqual(extractorConfig.tsdocConfigFile.filePath, ExtractorConfig_1.ExtractorConfig._tsdocBaseFilePath)) {
128
- messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.UsingCustomTSDocConfig, 'Using custom TSDoc config from ' + extractorConfig.tsdocConfigFile.filePath);
117
+ if (tsdocConfigFilePath && !tsdocConfigFileNotFound) {
118
+ if (!node_core_library_1.Path.isEqual(tsdocConfigFilePath, ExtractorConfig_1.ExtractorConfig._tsdocBaseFilePath)) {
119
+ messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.UsingCustomTSDocConfig, `Using custom TSDoc config from ${tsdocConfigFilePath}`);
129
120
  }
130
121
  }
131
122
  this._checkCompilerCompatibility(extractorConfig, messageRouter);
@@ -140,7 +131,7 @@ class Extractor {
140
131
  messageRouter.logDiagnosticFooter();
141
132
  messageRouter.logDiagnosticHeader('TSDoc configuration');
142
133
  // Convert the TSDocConfiguration into a tsdoc.json representation
143
- const combinedConfigFile = tsdoc_config_1.TSDocConfigFile.loadFromParser(extractorConfig.tsdocConfiguration);
134
+ const combinedConfigFile = tsdoc_config_1.TSDocConfigFile.loadFromParser(tsdocConfiguration);
144
135
  const serializedTSDocConfig = MessageRouter_1.MessageRouter.buildJsonDumpObject(combinedConfigFile.saveToObject());
145
136
  messageRouter.logDiagnostic(JSON.stringify(serializedTSDocConfig, undefined, 2));
146
137
  messageRouter.logDiagnosticFooter();
@@ -160,33 +151,33 @@ class Extractor {
160
151
  messageRouter.logDiagnostic(''); // skip a line after any diagnostic messages
161
152
  }
162
153
  if (modelBuilder.docModelEnabled) {
163
- messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.WritingDocModelFile, 'Writing: ' + extractorConfig.apiJsonFilePath);
164
- apiPackage.saveToJsonFile(extractorConfig.apiJsonFilePath, {
154
+ messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.WritingDocModelFile, `Writing: ${apiJsonFilePath}`);
155
+ apiPackage.saveToJsonFile(apiJsonFilePath, {
165
156
  toolPackage: Extractor.packageName,
166
157
  toolVersion: Extractor.version,
167
- newlineConversion: extractorConfig.newlineKind,
158
+ newlineConversion: newlineKind,
168
159
  ensureFolderExists: true,
169
- testMode: extractorConfig.testMode
160
+ testMode
170
161
  });
171
162
  }
172
163
  function writeApiReport(reportConfig) {
173
- return Extractor._writeApiReport(collector, extractorConfig, messageRouter, extractorConfig.reportTempFolder, extractorConfig.reportFolder, reportConfig, localBuild);
164
+ return Extractor._writeApiReport(collector, extractorConfig, messageRouter, reportTempFolder, reportFolder, reportConfig, localBuild, printApiReportDiff);
174
165
  }
175
166
  let anyReportChanged = false;
176
- if (extractorConfig.apiReportEnabled) {
177
- for (const reportConfig of extractorConfig.reportConfigs) {
167
+ if (apiReportEnabled) {
168
+ for (const reportConfig of reportConfigs) {
178
169
  anyReportChanged = writeApiReport(reportConfig) || anyReportChanged;
179
170
  }
180
171
  }
181
- if (extractorConfig.rollupEnabled) {
182
- Extractor._generateRollupDtsFile(collector, extractorConfig.publicTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.PublicRelease, extractorConfig.newlineKind);
183
- Extractor._generateRollupDtsFile(collector, extractorConfig.alphaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.AlphaRelease, extractorConfig.newlineKind);
184
- Extractor._generateRollupDtsFile(collector, extractorConfig.betaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.BetaRelease, extractorConfig.newlineKind);
185
- Extractor._generateRollupDtsFile(collector, extractorConfig.untrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.InternalRelease, extractorConfig.newlineKind);
172
+ if (rollupEnabled) {
173
+ Extractor._generateRollupDtsFile(collector, publicTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.PublicRelease, newlineKind);
174
+ Extractor._generateRollupDtsFile(collector, alphaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.AlphaRelease, newlineKind);
175
+ Extractor._generateRollupDtsFile(collector, betaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.BetaRelease, newlineKind);
176
+ Extractor._generateRollupDtsFile(collector, untrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.InternalRelease, newlineKind);
186
177
  }
187
- if (extractorConfig.tsdocMetadataEnabled) {
178
+ if (tsdocMetadataEnabled) {
188
179
  // Write the tsdoc-metadata.json file for this project
189
- PackageMetadataManager_1.PackageMetadataManager.writeTsdocMetadataFile(extractorConfig.tsdocMetadataFilePath, extractorConfig.newlineKind);
180
+ PackageMetadataManager_1.PackageMetadataManager.writeTsdocMetadataFile(tsdocMetadataFilePath, newlineKind);
190
181
  }
191
182
  // Show all the messages that we collected during analysis
192
183
  messageRouter.handleRemainingNonConsoleMessages();
@@ -218,10 +209,11 @@ class Extractor {
218
209
  * @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
219
210
  * which the new report will be written post-comparison.
220
211
  * @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
212
+ * @param printApiReportDiff - {@link IExtractorInvokeOptions.printApiReportDiff}
221
213
  *
222
214
  * @returns Whether or not the newly generated report differs from the existing report (if one exists).
223
215
  */
224
- static _writeApiReport(collector, extractorConfig, messageRouter, reportTempDirectoryPath, reportDirectoryPath, reportConfig, localBuild) {
216
+ static _writeApiReport(collector, extractorConfig, messageRouter, reportTempDirectoryPath, reportDirectoryPath, reportConfig, localBuild, printApiReportDiff) {
225
217
  let apiReportChanged = false;
226
218
  const actualApiReportPath = path.resolve(reportTempDirectoryPath, reportConfig.fileName);
227
219
  const actualApiReportShortPath = extractorConfig._getShortFilePath(actualApiReportPath);
@@ -236,7 +228,9 @@ class Extractor {
236
228
  });
237
229
  // Compare it against the expected file
238
230
  if (node_core_library_1.FileSystem.exists(expectedApiReportPath)) {
239
- const expectedApiReportContent = node_core_library_1.FileSystem.readFile(expectedApiReportPath);
231
+ const expectedApiReportContent = node_core_library_1.FileSystem.readFile(expectedApiReportPath, {
232
+ convertLineEndings: node_core_library_1.NewlineKind.Lf
233
+ });
240
234
  if (!ApiReportGenerator_1.ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
241
235
  apiReportChanged = true;
242
236
  if (!localBuild) {
@@ -254,6 +248,14 @@ class Extractor {
254
248
  convertLineEndings: extractorConfig.newlineKind
255
249
  });
256
250
  }
251
+ if (messageRouter.showVerboseMessages || printApiReportDiff) {
252
+ const Diff = require('diff');
253
+ const patch = Diff.structuredPatch(expectedApiReportShortPath, actualApiReportShortPath, expectedApiReportContent, actualApiReportContent);
254
+ const logFunction = printApiReportDiff
255
+ ? messageRouter.logWarning.bind(messageRouter)
256
+ : messageRouter.logVerbose.bind(messageRouter);
257
+ logFunction(ConsoleMessageId_1.ConsoleMessageId.ApiReportDiff, 'Changes to the API report:\n\n' + Diff.formatPatch(patch));
258
+ }
257
259
  }
258
260
  else {
259
261
  messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.ApiReportUnchanged, `The API report is up to date: ${actualApiReportShortPath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"Extractor.js","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAElC,+CAAiC;AACjC,+CAAiC;AACjC,iDAAmC;AAGnC,0DAA0D;AAC1D,oEAOsC;AAEtC,uDAAoF;AACpF,sDAAmD;AACnD,yEAAqF;AACrF,uEAAoE;AACpE,yEAA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AAsB,CACnC,SAAoB,EACpB,UAAkB,EAClB,OAAsB,EACtB,WAAwB;QAExB,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;YACtB,SAAS,CAAC,aAAa,CAAC,UAAU,CAChC,mCAAgB,CAAC,gBAAgB,EACjC,4BAA4B,UAAU,EAAE,CACzC,CAAC;YACF,uCAAkB,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA5XD,8BA4XC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\nimport * as resolve from 'resolve';\n\nimport type { ApiPackage } from '@microsoft/api-extractor-model';\nimport { TSDocConfigFile } from '@microsoft/tsdoc-config';\nimport {\n FileSystem,\n type NewlineKind,\n PackageJsonLookup,\n type IPackageJson,\n type INodePackageJson,\n Path\n} from '@rushstack/node-core-library';\n\nimport { ExtractorConfig, type IExtractorConfigApiReport } from './ExtractorConfig';\nimport { Collector } from '../collector/Collector';\nimport { DtsRollupGenerator, DtsRollupKind } from '../generators/DtsRollupGenerator';\nimport { ApiModelGenerator } from '../generators/ApiModelGenerator';\nimport { ApiReportGenerator } from '../generators/ApiReportGenerator';\nimport { PackageMetadataManager } from '../analyzer/PackageMetadataManager';\nimport { ValidationEnhancer } from '../enhancers/ValidationEnhancer';\nimport { DocCommentEnhancer } from '../enhancers/DocCommentEnhancer';\nimport { CompilerState } from './CompilerState';\nimport type { ExtractorMessage } from './ExtractorMessage';\nimport { MessageRouter } from '../collector/MessageRouter';\nimport { ConsoleMessageId } from './ConsoleMessageId';\nimport { SourceMapper } from '../collector/SourceMapper';\n\n/**\n * Runtime options for Extractor.\n *\n * @public\n */\nexport interface IExtractorInvokeOptions {\n /**\n * An optional TypeScript compiler state. This allows an optimization where multiple invocations of API Extractor\n * can reuse the same TypeScript compiler analysis.\n */\n compilerState?: CompilerState;\n\n /**\n * Indicates that API Extractor is running as part of a local build, e.g. on developer's\n * machine.\n *\n * @remarks\n * This disables certain validation that would normally be performed for a ship/production build. For example,\n * the *.api.md report file is automatically updated in a local build.\n *\n * The default value is false.\n */\n localBuild?: boolean;\n\n /**\n * If true, API Extractor will include {@link ExtractorLogLevel.Verbose} messages in its output.\n */\n showVerboseMessages?: boolean;\n\n /**\n * If true, API Extractor will print diagnostic information used for troubleshooting problems.\n * These messages will be included as {@link ExtractorLogLevel.Verbose} output.\n *\n * @remarks\n * Setting `showDiagnostics=true` forces `showVerboseMessages=true`.\n */\n showDiagnostics?: boolean;\n\n /**\n * Specifies an alternate folder path to be used when loading the TypeScript system typings.\n *\n * @remarks\n * API Extractor uses its own TypeScript compiler engine to analyze your project. If your project\n * is built with a significantly different TypeScript version, sometimes API Extractor may report compilation\n * errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the \"--typescriptCompilerFolder\"\n * option to specify the folder path where you installed the TypeScript package, and API Extractor's compiler will\n * use those system typings instead.\n */\n typescriptCompilerFolder?: string;\n\n /**\n * An optional callback function that will be called for each `ExtractorMessage` before it is displayed by\n * API Extractor. The callback can customize the message, handle it, or discard it.\n *\n * @remarks\n * If a `messageCallback` is not provided, then by default API Extractor will print the messages to\n * the STDERR/STDOUT console.\n */\n messageCallback?: (message: ExtractorMessage) => void;\n}\n\n/**\n * This object represents the outcome of an invocation of API Extractor.\n *\n * @public\n */\nexport class ExtractorResult {\n /**\n * The TypeScript compiler state that was used.\n */\n public readonly compilerState: CompilerState;\n\n /**\n * The API Extractor configuration that was used.\n */\n public readonly extractorConfig: ExtractorConfig;\n\n /**\n * Whether the invocation of API Extractor was successful. For example, if `succeeded` is false, then the build task\n * would normally return a nonzero process exit code, indicating that the operation failed.\n *\n * @remarks\n *\n * Normally the operation \"succeeds\" if `errorCount` and `warningCount` are both zero. However if\n * {@link IExtractorInvokeOptions.localBuild} is `true`, then the operation \"succeeds\" if `errorCount` is zero\n * (i.e. warnings are ignored).\n */\n public readonly succeeded: boolean;\n\n /**\n * Returns true if the API report was found to have changed.\n */\n public readonly apiReportChanged: boolean;\n\n /**\n * Reports the number of errors encountered during analysis.\n *\n * @remarks\n * This does not count exceptions, where unexpected issues prematurely abort the operation.\n */\n public readonly errorCount: number;\n\n /**\n * Reports the number of warnings encountered during analysis.\n *\n * @remarks\n * This does not count warnings that are emitted in the API report file.\n */\n public readonly warningCount: number;\n\n /** @internal */\n public constructor(properties: ExtractorResult) {\n this.compilerState = properties.compilerState;\n this.extractorConfig = properties.extractorConfig;\n this.succeeded = properties.succeeded;\n this.apiReportChanged = properties.apiReportChanged;\n this.errorCount = properties.errorCount;\n this.warningCount = properties.warningCount;\n }\n}\n\n/**\n * The starting point for invoking the API Extractor tool.\n * @public\n */\nexport class Extractor {\n /**\n * Returns the version number of the API Extractor NPM package.\n */\n public static get version(): string {\n return Extractor._getPackageJson().version;\n }\n\n /**\n * Returns the package name of the API Extractor NPM package.\n */\n public static get packageName(): string {\n return Extractor._getPackageJson().name;\n }\n\n private static _getPackageJson(): IPackageJson {\n return PackageJsonLookup.loadOwnPackageJson(__dirname);\n }\n\n /**\n * Load the api-extractor.json config file from the specified path, and then invoke API Extractor.\n */\n public static loadConfigAndInvoke(\n configFilePath: string,\n options?: IExtractorInvokeOptions\n ): ExtractorResult {\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(configFilePath);\n\n return Extractor.invoke(extractorConfig, options);\n }\n\n /**\n * Invoke API Extractor using an already prepared `ExtractorConfig` object.\n */\n public static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult {\n if (!options) {\n options = {};\n }\n\n const localBuild: boolean = options.localBuild || false;\n\n let compilerState: CompilerState | undefined;\n if (options.compilerState) {\n compilerState = options.compilerState;\n } else {\n compilerState = CompilerState.create(extractorConfig, options);\n }\n\n const sourceMapper: SourceMapper = new SourceMapper();\n\n const messageRouter: MessageRouter = new MessageRouter({\n workingPackageFolder: extractorConfig.packageFolder,\n messageCallback: options.messageCallback,\n messagesConfig: extractorConfig.messages || {},\n showVerboseMessages: !!options.showVerboseMessages,\n showDiagnostics: !!options.showDiagnostics,\n tsdocConfiguration: extractorConfig.tsdocConfiguration,\n sourceMapper\n });\n\n if (extractorConfig.tsdocConfigFile.filePath && !extractorConfig.tsdocConfigFile.fileNotFound) {\n if (!Path.isEqual(extractorConfig.tsdocConfigFile.filePath, ExtractorConfig._tsdocBaseFilePath)) {\n messageRouter.logVerbose(\n ConsoleMessageId.UsingCustomTSDocConfig,\n 'Using custom TSDoc config from ' + extractorConfig.tsdocConfigFile.filePath\n );\n }\n }\n\n this._checkCompilerCompatibility(extractorConfig, messageRouter);\n\n if (messageRouter.showDiagnostics) {\n messageRouter.logDiagnostic('');\n messageRouter.logDiagnosticHeader('Final prepared ExtractorConfig');\n messageRouter.logDiagnostic(extractorConfig.getDiagnosticDump());\n messageRouter.logDiagnosticFooter();\n\n messageRouter.logDiagnosticHeader('Compiler options');\n const serializedCompilerOptions: object = MessageRouter.buildJsonDumpObject(\n (compilerState.program as ts.Program).getCompilerOptions()\n );\n messageRouter.logDiagnostic(JSON.stringify(serializedCompilerOptions, undefined, 2));\n messageRouter.logDiagnosticFooter();\n\n messageRouter.logDiagnosticHeader('TSDoc configuration');\n // Convert the TSDocConfiguration into a tsdoc.json representation\n const combinedConfigFile: TSDocConfigFile = TSDocConfigFile.loadFromParser(\n extractorConfig.tsdocConfiguration\n );\n const serializedTSDocConfig: object = MessageRouter.buildJsonDumpObject(\n combinedConfigFile.saveToObject()\n );\n messageRouter.logDiagnostic(JSON.stringify(serializedTSDocConfig, undefined, 2));\n messageRouter.logDiagnosticFooter();\n }\n\n const collector: Collector = new Collector({\n program: compilerState.program as ts.Program,\n messageRouter,\n extractorConfig,\n sourceMapper\n });\n\n collector.analyze();\n\n DocCommentEnhancer.analyze(collector);\n ValidationEnhancer.analyze(collector);\n\n const modelBuilder: ApiModelGenerator = new ApiModelGenerator(collector, extractorConfig);\n const apiPackage: ApiPackage = modelBuilder.buildApiPackage();\n\n if (messageRouter.showDiagnostics) {\n messageRouter.logDiagnostic(''); // skip a line after any diagnostic messages\n }\n\n if (modelBuilder.docModelEnabled) {\n messageRouter.logVerbose(\n ConsoleMessageId.WritingDocModelFile,\n 'Writing: ' + extractorConfig.apiJsonFilePath\n );\n apiPackage.saveToJsonFile(extractorConfig.apiJsonFilePath, {\n toolPackage: Extractor.packageName,\n toolVersion: Extractor.version,\n\n newlineConversion: extractorConfig.newlineKind,\n ensureFolderExists: true,\n testMode: extractorConfig.testMode\n });\n }\n\n function writeApiReport(reportConfig: IExtractorConfigApiReport): boolean {\n return Extractor._writeApiReport(\n collector,\n extractorConfig,\n messageRouter,\n extractorConfig.reportTempFolder,\n extractorConfig.reportFolder,\n reportConfig,\n localBuild\n );\n }\n\n let anyReportChanged: boolean = false;\n if (extractorConfig.apiReportEnabled) {\n for (const reportConfig of extractorConfig.reportConfigs) {\n anyReportChanged = writeApiReport(reportConfig) || anyReportChanged;\n }\n }\n\n if (extractorConfig.rollupEnabled) {\n Extractor._generateRollupDtsFile(\n collector,\n extractorConfig.publicTrimmedFilePath,\n DtsRollupKind.PublicRelease,\n extractorConfig.newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n extractorConfig.alphaTrimmedFilePath,\n DtsRollupKind.AlphaRelease,\n extractorConfig.newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n extractorConfig.betaTrimmedFilePath,\n DtsRollupKind.BetaRelease,\n extractorConfig.newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n extractorConfig.untrimmedFilePath,\n DtsRollupKind.InternalRelease,\n extractorConfig.newlineKind\n );\n }\n\n if (extractorConfig.tsdocMetadataEnabled) {\n // Write the tsdoc-metadata.json file for this project\n PackageMetadataManager.writeTsdocMetadataFile(\n extractorConfig.tsdocMetadataFilePath,\n extractorConfig.newlineKind\n );\n }\n\n // Show all the messages that we collected during analysis\n messageRouter.handleRemainingNonConsoleMessages();\n\n // Determine success\n let succeeded: boolean;\n if (localBuild) {\n // For a local build, fail if there were errors (but ignore warnings)\n succeeded = messageRouter.errorCount === 0;\n } else {\n // For a production build, fail if there were any errors or warnings\n succeeded = messageRouter.errorCount + messageRouter.warningCount === 0;\n }\n\n return new ExtractorResult({\n compilerState,\n extractorConfig,\n succeeded,\n apiReportChanged: anyReportChanged,\n errorCount: messageRouter.errorCount,\n warningCount: messageRouter.warningCount\n });\n }\n\n /**\n * Generates the API report at the specified release level, writes it to the specified file path, and compares\n * the output to the existing report (if one exists).\n *\n * @param reportTempDirectoryPath - The path to the directory under which the temp report file will be written prior\n * to comparison with an existing report.\n * @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to\n * which the new report will be written post-comparison.\n * @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.\n *\n * @returns Whether or not the newly generated report differs from the existing report (if one exists).\n */\n private static _writeApiReport(\n collector: Collector,\n extractorConfig: ExtractorConfig,\n messageRouter: MessageRouter,\n reportTempDirectoryPath: string,\n reportDirectoryPath: string,\n reportConfig: IExtractorConfigApiReport,\n localBuild: boolean\n ): boolean {\n let apiReportChanged: boolean = false;\n\n const actualApiReportPath: string = path.resolve(reportTempDirectoryPath, reportConfig.fileName);\n const actualApiReportShortPath: string = extractorConfig._getShortFilePath(actualApiReportPath);\n\n const expectedApiReportPath: string = path.resolve(reportDirectoryPath, reportConfig.fileName);\n const expectedApiReportShortPath: string = extractorConfig._getShortFilePath(expectedApiReportPath);\n\n collector.messageRouter.logVerbose(\n ConsoleMessageId.WritingApiReport,\n `Generating ${reportConfig.variant} API report: ${expectedApiReportPath}`\n );\n\n const actualApiReportContent: string = ApiReportGenerator.generateReviewFileContent(\n collector,\n reportConfig.variant\n );\n\n // Write the actual file\n FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {\n ensureFolderExists: true,\n convertLineEndings: extractorConfig.newlineKind\n });\n\n // Compare it against the expected file\n if (FileSystem.exists(expectedApiReportPath)) {\n const expectedApiReportContent: string = FileSystem.readFile(expectedApiReportPath);\n\n if (\n !ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)\n ) {\n apiReportChanged = true;\n\n if (!localBuild) {\n // For a production build, issue a warning that will break the CI build.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportNotCopied,\n 'You have changed the API signature for this project.' +\n ` Please copy the file \"${actualApiReportShortPath}\" to \"${expectedApiReportShortPath}\",` +\n ` or perform a local build (which does this automatically).` +\n ` See the Git repo documentation for more info.`\n );\n } else {\n // For a local build, just copy the file automatically.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportCopied,\n `You have changed the API signature for this project. Updating ${expectedApiReportShortPath}`\n );\n\n FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {\n ensureFolderExists: true,\n convertLineEndings: extractorConfig.newlineKind\n });\n }\n } else {\n messageRouter.logVerbose(\n ConsoleMessageId.ApiReportUnchanged,\n `The API report is up to date: ${actualApiReportShortPath}`\n );\n }\n } else {\n // The target file does not exist, so we are setting up the API review file for the first time.\n //\n // NOTE: People sometimes make a mistake where they move a project and forget to update the \"reportFolder\"\n // setting, which causes a new file to silently get written to the wrong place. This can be confusing.\n // Thus we treat the initial creation of the file specially.\n apiReportChanged = true;\n\n if (!localBuild) {\n // For a production build, issue a warning that will break the CI build.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportNotCopied,\n 'The API report file is missing.' +\n ` Please copy the file \"${actualApiReportShortPath}\" to \"${expectedApiReportShortPath}\",` +\n ` or perform a local build (which does this automatically).` +\n ` See the Git repo documentation for more info.`\n );\n } else {\n const expectedApiReportFolder: string = path.dirname(expectedApiReportPath);\n if (!FileSystem.exists(expectedApiReportFolder)) {\n messageRouter.logError(\n ConsoleMessageId.ApiReportFolderMissing,\n 'Unable to create the API report file. Please make sure the target folder exists:\\n' +\n expectedApiReportFolder\n );\n } else {\n FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {\n convertLineEndings: extractorConfig.newlineKind\n });\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportCreated,\n 'The API report file was missing, so a new file was created. Please add this file to Git:\\n' +\n expectedApiReportPath\n );\n }\n }\n }\n return apiReportChanged;\n }\n\n private static _checkCompilerCompatibility(\n extractorConfig: ExtractorConfig,\n messageRouter: MessageRouter\n ): void {\n messageRouter.logInfo(\n ConsoleMessageId.Preamble,\n `Analysis will use the bundled TypeScript version ${ts.version}`\n );\n\n try {\n const typescriptPath: string = resolve.sync('typescript', {\n basedir: extractorConfig.projectFolder,\n preserveSymlinks: false\n });\n const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();\n const packageJson: INodePackageJson | undefined =\n packageJsonLookup.tryLoadNodePackageJsonFor(typescriptPath);\n if (packageJson && packageJson.version && semver.valid(packageJson.version)) {\n // Consider a newer MINOR release to be incompatible\n const ourMajor: number = semver.major(ts.version);\n const ourMinor: number = semver.minor(ts.version);\n\n const theirMajor: number = semver.major(packageJson.version);\n const theirMinor: number = semver.minor(packageJson.version);\n\n if (theirMajor > ourMajor || (theirMajor === ourMajor && theirMinor > ourMinor)) {\n messageRouter.logInfo(\n ConsoleMessageId.CompilerVersionNotice,\n `*** The target project appears to use TypeScript ${packageJson.version} which is newer than the` +\n ` bundled compiler engine; consider upgrading API Extractor.`\n );\n }\n }\n } catch (e) {\n // The compiler detection heuristic is not expected to work in many configurations\n }\n }\n\n private static _generateRollupDtsFile(\n collector: Collector,\n outputPath: string,\n dtsKind: DtsRollupKind,\n newlineKind: NewlineKind\n ): void {\n if (outputPath !== '') {\n collector.messageRouter.logVerbose(\n ConsoleMessageId.WritingDtsRollup,\n `Writing package typings: ${outputPath}`\n );\n DtsRollupGenerator.writeTypingsFile(collector, outputPath, dtsKind, newlineKind);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Extractor.js","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D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AAC,OAAO,CAAC,CAAC;gBAElD,MAAM,UAAU,GAAW,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC7D,MAAM,UAAU,GAAW,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAE7D,IAAI,UAAU,GAAG,QAAQ,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC;oBAChF,aAAa,CAAC,OAAO,CACnB,mCAAgB,CAAC,qBAAqB,EACtC,oDAAoD,WAAW,CAAC,OAAO,0BAA0B;wBAC/F,6DAA6D,CAChE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,kFAAkF;QACpF,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,sBAAsB,CACnC,SAAoB,EACpB,UAAkB,EAClB,OAAsB,EACtB,WAAwB;QAExB,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;YACtB,SAAS,CAAC,aAAa,CAAC,UAAU,CAChC,mCAAgB,CAAC,gBAAgB,EACjC,4BAA4B,UAAU,EAAE,CACzC,CAAC;YACF,uCAAkB,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA7ZD,8BA6ZC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'node:path';\n\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\nimport * as resolve from 'resolve';\n\nimport type { ApiPackage } from '@microsoft/api-extractor-model';\nimport { TSDocConfigFile } from '@microsoft/tsdoc-config';\nimport {\n FileSystem,\n NewlineKind,\n PackageJsonLookup,\n type IPackageJson,\n type INodePackageJson,\n Path\n} from '@rushstack/node-core-library';\n\nimport { ExtractorConfig, type IExtractorConfigApiReport } from './ExtractorConfig';\nimport { Collector } from '../collector/Collector';\nimport { DtsRollupGenerator, DtsRollupKind } from '../generators/DtsRollupGenerator';\nimport { ApiModelGenerator } from '../generators/ApiModelGenerator';\nimport { ApiReportGenerator } from '../generators/ApiReportGenerator';\nimport { PackageMetadataManager } from '../analyzer/PackageMetadataManager';\nimport { ValidationEnhancer } from '../enhancers/ValidationEnhancer';\nimport { DocCommentEnhancer } from '../enhancers/DocCommentEnhancer';\nimport { CompilerState } from './CompilerState';\nimport type { ExtractorMessage } from './ExtractorMessage';\nimport { MessageRouter } from '../collector/MessageRouter';\nimport { ConsoleMessageId } from './ConsoleMessageId';\nimport { SourceMapper } from '../collector/SourceMapper';\n\n/**\n * Runtime options for Extractor.\n *\n * @public\n */\nexport interface IExtractorInvokeOptions {\n /**\n * An optional TypeScript compiler state. This allows an optimization where multiple invocations of API Extractor\n * can reuse the same TypeScript compiler analysis.\n */\n compilerState?: CompilerState;\n\n /**\n * Indicates that API Extractor is running as part of a local build, e.g. on developer's\n * machine.\n *\n * @remarks\n * This disables certain validation that would normally be performed for a ship/production build. For example,\n * the *.api.md report file is automatically updated in a local build.\n *\n * The default value is false.\n */\n localBuild?: boolean;\n\n /**\n * If true, API Extractor will include {@link ExtractorLogLevel.Verbose} messages in its output.\n */\n showVerboseMessages?: boolean;\n\n /**\n * If true, API Extractor will print diagnostic information used for troubleshooting problems.\n * These messages will be included as {@link ExtractorLogLevel.Verbose} output.\n *\n * @remarks\n * Setting `showDiagnostics=true` forces `showVerboseMessages=true`.\n */\n showDiagnostics?: boolean;\n\n /**\n * Specifies an alternate folder path to be used when loading the TypeScript system typings.\n *\n * @remarks\n * API Extractor uses its own TypeScript compiler engine to analyze your project. If your project\n * is built with a significantly different TypeScript version, sometimes API Extractor may report compilation\n * errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the \"--typescriptCompilerFolder\"\n * option to specify the folder path where you installed the TypeScript package, and API Extractor's compiler will\n * use those system typings instead.\n */\n typescriptCompilerFolder?: string;\n\n /**\n * An optional callback function that will be called for each `ExtractorMessage` before it is displayed by\n * API Extractor. The callback can customize the message, handle it, or discard it.\n *\n * @remarks\n * If a `messageCallback` is not provided, then by default API Extractor will print the messages to\n * the STDERR/STDOUT console.\n */\n messageCallback?: (message: ExtractorMessage) => void;\n\n /**\n * If true, then any differences between the actual and expected API reports will be\n * printed on the console.\n *\n * @remarks\n * The diff is not printed if the expected API report file has not been created yet.\n */\n printApiReportDiff?: boolean;\n}\n\n/**\n * This object represents the outcome of an invocation of API Extractor.\n *\n * @public\n */\nexport class ExtractorResult {\n /**\n * The TypeScript compiler state that was used.\n */\n public readonly compilerState: CompilerState;\n\n /**\n * The API Extractor configuration that was used.\n */\n public readonly extractorConfig: ExtractorConfig;\n\n /**\n * Whether the invocation of API Extractor was successful. For example, if `succeeded` is false, then the build task\n * would normally return a nonzero process exit code, indicating that the operation failed.\n *\n * @remarks\n *\n * Normally the operation \"succeeds\" if `errorCount` and `warningCount` are both zero. However if\n * {@link IExtractorInvokeOptions.localBuild} is `true`, then the operation \"succeeds\" if `errorCount` is zero\n * (i.e. warnings are ignored).\n */\n public readonly succeeded: boolean;\n\n /**\n * Returns true if the API report was found to have changed.\n */\n public readonly apiReportChanged: boolean;\n\n /**\n * Reports the number of errors encountered during analysis.\n *\n * @remarks\n * This does not count exceptions, where unexpected issues prematurely abort the operation.\n */\n public readonly errorCount: number;\n\n /**\n * Reports the number of warnings encountered during analysis.\n *\n * @remarks\n * This does not count warnings that are emitted in the API report file.\n */\n public readonly warningCount: number;\n\n /** @internal */\n public constructor(properties: ExtractorResult) {\n this.compilerState = properties.compilerState;\n this.extractorConfig = properties.extractorConfig;\n this.succeeded = properties.succeeded;\n this.apiReportChanged = properties.apiReportChanged;\n this.errorCount = properties.errorCount;\n this.warningCount = properties.warningCount;\n }\n}\n\n/**\n * The starting point for invoking the API Extractor tool.\n * @public\n */\nexport class Extractor {\n /**\n * Returns the version number of the API Extractor NPM package.\n */\n public static get version(): string {\n return Extractor._getPackageJson().version;\n }\n\n /**\n * Returns the package name of the API Extractor NPM package.\n */\n public static get packageName(): string {\n return Extractor._getPackageJson().name;\n }\n\n private static _getPackageJson(): IPackageJson {\n return PackageJsonLookup.loadOwnPackageJson(__dirname);\n }\n\n /**\n * Load the api-extractor.json config file from the specified path, and then invoke API Extractor.\n */\n public static loadConfigAndInvoke(\n configFilePath: string,\n options?: IExtractorInvokeOptions\n ): ExtractorResult {\n const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(configFilePath);\n\n return Extractor.invoke(extractorConfig, options);\n }\n\n /**\n * Invoke API Extractor using an already prepared `ExtractorConfig` object.\n */\n public static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult {\n const {\n packageFolder,\n messages,\n tsdocConfiguration,\n tsdocConfigFile: { filePath: tsdocConfigFilePath, fileNotFound: tsdocConfigFileNotFound },\n apiJsonFilePath,\n newlineKind,\n reportTempFolder,\n reportFolder,\n apiReportEnabled,\n reportConfigs,\n testMode,\n rollupEnabled,\n publicTrimmedFilePath,\n alphaTrimmedFilePath,\n betaTrimmedFilePath,\n untrimmedFilePath,\n tsdocMetadataEnabled,\n tsdocMetadataFilePath\n } = extractorConfig;\n const {\n localBuild = false,\n compilerState = CompilerState.create(extractorConfig, options),\n messageCallback,\n showVerboseMessages = false,\n showDiagnostics = false,\n printApiReportDiff = false\n } = options ?? {};\n\n const sourceMapper: SourceMapper = new SourceMapper();\n\n const messageRouter: MessageRouter = new MessageRouter({\n workingPackageFolder: packageFolder,\n messageCallback,\n messagesConfig: messages || {},\n showVerboseMessages,\n showDiagnostics,\n tsdocConfiguration,\n sourceMapper\n });\n\n if (tsdocConfigFilePath && !tsdocConfigFileNotFound) {\n if (!Path.isEqual(tsdocConfigFilePath, ExtractorConfig._tsdocBaseFilePath)) {\n messageRouter.logVerbose(\n ConsoleMessageId.UsingCustomTSDocConfig,\n `Using custom TSDoc config from ${tsdocConfigFilePath}`\n );\n }\n }\n\n this._checkCompilerCompatibility(extractorConfig, messageRouter);\n\n if (messageRouter.showDiagnostics) {\n messageRouter.logDiagnostic('');\n messageRouter.logDiagnosticHeader('Final prepared ExtractorConfig');\n messageRouter.logDiagnostic(extractorConfig.getDiagnosticDump());\n messageRouter.logDiagnosticFooter();\n\n messageRouter.logDiagnosticHeader('Compiler options');\n const serializedCompilerOptions: object = MessageRouter.buildJsonDumpObject(\n (compilerState.program as ts.Program).getCompilerOptions()\n );\n messageRouter.logDiagnostic(JSON.stringify(serializedCompilerOptions, undefined, 2));\n messageRouter.logDiagnosticFooter();\n\n messageRouter.logDiagnosticHeader('TSDoc configuration');\n // Convert the TSDocConfiguration into a tsdoc.json representation\n const combinedConfigFile: TSDocConfigFile = TSDocConfigFile.loadFromParser(tsdocConfiguration);\n const serializedTSDocConfig: object = MessageRouter.buildJsonDumpObject(\n combinedConfigFile.saveToObject()\n );\n messageRouter.logDiagnostic(JSON.stringify(serializedTSDocConfig, undefined, 2));\n messageRouter.logDiagnosticFooter();\n }\n\n const collector: Collector = new Collector({\n program: compilerState.program as ts.Program,\n messageRouter,\n extractorConfig,\n sourceMapper\n });\n\n collector.analyze();\n\n DocCommentEnhancer.analyze(collector);\n ValidationEnhancer.analyze(collector);\n\n const modelBuilder: ApiModelGenerator = new ApiModelGenerator(collector, extractorConfig);\n const apiPackage: ApiPackage = modelBuilder.buildApiPackage();\n\n if (messageRouter.showDiagnostics) {\n messageRouter.logDiagnostic(''); // skip a line after any diagnostic messages\n }\n\n if (modelBuilder.docModelEnabled) {\n messageRouter.logVerbose(ConsoleMessageId.WritingDocModelFile, `Writing: ${apiJsonFilePath}`);\n apiPackage.saveToJsonFile(apiJsonFilePath, {\n toolPackage: Extractor.packageName,\n toolVersion: Extractor.version,\n\n newlineConversion: newlineKind,\n ensureFolderExists: true,\n testMode\n });\n }\n\n function writeApiReport(reportConfig: IExtractorConfigApiReport): boolean {\n return Extractor._writeApiReport(\n collector,\n extractorConfig,\n messageRouter,\n reportTempFolder,\n reportFolder,\n reportConfig,\n localBuild,\n printApiReportDiff\n );\n }\n\n let anyReportChanged: boolean = false;\n if (apiReportEnabled) {\n for (const reportConfig of reportConfigs) {\n anyReportChanged = writeApiReport(reportConfig) || anyReportChanged;\n }\n }\n\n if (rollupEnabled) {\n Extractor._generateRollupDtsFile(\n collector,\n publicTrimmedFilePath,\n DtsRollupKind.PublicRelease,\n newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n alphaTrimmedFilePath,\n DtsRollupKind.AlphaRelease,\n newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n betaTrimmedFilePath,\n DtsRollupKind.BetaRelease,\n newlineKind\n );\n Extractor._generateRollupDtsFile(\n collector,\n untrimmedFilePath,\n DtsRollupKind.InternalRelease,\n newlineKind\n );\n }\n\n if (tsdocMetadataEnabled) {\n // Write the tsdoc-metadata.json file for this project\n PackageMetadataManager.writeTsdocMetadataFile(tsdocMetadataFilePath, newlineKind);\n }\n\n // Show all the messages that we collected during analysis\n messageRouter.handleRemainingNonConsoleMessages();\n\n // Determine success\n let succeeded: boolean;\n if (localBuild) {\n // For a local build, fail if there were errors (but ignore warnings)\n succeeded = messageRouter.errorCount === 0;\n } else {\n // For a production build, fail if there were any errors or warnings\n succeeded = messageRouter.errorCount + messageRouter.warningCount === 0;\n }\n\n return new ExtractorResult({\n compilerState,\n extractorConfig,\n succeeded,\n apiReportChanged: anyReportChanged,\n errorCount: messageRouter.errorCount,\n warningCount: messageRouter.warningCount\n });\n }\n\n /**\n * Generates the API report at the specified release level, writes it to the specified file path, and compares\n * the output to the existing report (if one exists).\n *\n * @param reportTempDirectoryPath - The path to the directory under which the temp report file will be written prior\n * to comparison with an existing report.\n * @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to\n * which the new report will be written post-comparison.\n * @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.\n * @param printApiReportDiff - {@link IExtractorInvokeOptions.printApiReportDiff}\n *\n * @returns Whether or not the newly generated report differs from the existing report (if one exists).\n */\n private static _writeApiReport(\n collector: Collector,\n extractorConfig: ExtractorConfig,\n messageRouter: MessageRouter,\n reportTempDirectoryPath: string,\n reportDirectoryPath: string,\n reportConfig: IExtractorConfigApiReport,\n localBuild: boolean,\n printApiReportDiff: boolean\n ): boolean {\n let apiReportChanged: boolean = false;\n\n const actualApiReportPath: string = path.resolve(reportTempDirectoryPath, reportConfig.fileName);\n const actualApiReportShortPath: string = extractorConfig._getShortFilePath(actualApiReportPath);\n\n const expectedApiReportPath: string = path.resolve(reportDirectoryPath, reportConfig.fileName);\n const expectedApiReportShortPath: string = extractorConfig._getShortFilePath(expectedApiReportPath);\n\n collector.messageRouter.logVerbose(\n ConsoleMessageId.WritingApiReport,\n `Generating ${reportConfig.variant} API report: ${expectedApiReportPath}`\n );\n\n const actualApiReportContent: string = ApiReportGenerator.generateReviewFileContent(\n collector,\n reportConfig.variant\n );\n\n // Write the actual file\n FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {\n ensureFolderExists: true,\n convertLineEndings: extractorConfig.newlineKind\n });\n\n // Compare it against the expected file\n if (FileSystem.exists(expectedApiReportPath)) {\n const expectedApiReportContent: string = FileSystem.readFile(expectedApiReportPath, {\n convertLineEndings: NewlineKind.Lf\n });\n\n if (\n !ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)\n ) {\n apiReportChanged = true;\n\n if (!localBuild) {\n // For a production build, issue a warning that will break the CI build.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportNotCopied,\n 'You have changed the API signature for this project.' +\n ` Please copy the file \"${actualApiReportShortPath}\" to \"${expectedApiReportShortPath}\",` +\n ` or perform a local build (which does this automatically).` +\n ` See the Git repo documentation for more info.`\n );\n } else {\n // For a local build, just copy the file automatically.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportCopied,\n `You have changed the API signature for this project. Updating ${expectedApiReportShortPath}`\n );\n\n FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {\n ensureFolderExists: true,\n convertLineEndings: extractorConfig.newlineKind\n });\n }\n\n if (messageRouter.showVerboseMessages || printApiReportDiff) {\n const Diff: typeof import('diff') = require('diff');\n const patch: import('diff').StructuredPatch = Diff.structuredPatch(\n expectedApiReportShortPath,\n actualApiReportShortPath,\n expectedApiReportContent,\n actualApiReportContent\n );\n const logFunction:\n | (typeof MessageRouter.prototype)['logWarning']\n | (typeof MessageRouter.prototype)['logVerbose'] = printApiReportDiff\n ? messageRouter.logWarning.bind(messageRouter)\n : messageRouter.logVerbose.bind(messageRouter);\n\n logFunction(\n ConsoleMessageId.ApiReportDiff,\n 'Changes to the API report:\\n\\n' + Diff.formatPatch(patch)\n );\n }\n } else {\n messageRouter.logVerbose(\n ConsoleMessageId.ApiReportUnchanged,\n `The API report is up to date: ${actualApiReportShortPath}`\n );\n }\n } else {\n // The target file does not exist, so we are setting up the API review file for the first time.\n //\n // NOTE: People sometimes make a mistake where they move a project and forget to update the \"reportFolder\"\n // setting, which causes a new file to silently get written to the wrong place. This can be confusing.\n // Thus we treat the initial creation of the file specially.\n apiReportChanged = true;\n\n if (!localBuild) {\n // For a production build, issue a warning that will break the CI build.\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportNotCopied,\n 'The API report file is missing.' +\n ` Please copy the file \"${actualApiReportShortPath}\" to \"${expectedApiReportShortPath}\",` +\n ` or perform a local build (which does this automatically).` +\n ` See the Git repo documentation for more info.`\n );\n } else {\n const expectedApiReportFolder: string = path.dirname(expectedApiReportPath);\n if (!FileSystem.exists(expectedApiReportFolder)) {\n messageRouter.logError(\n ConsoleMessageId.ApiReportFolderMissing,\n 'Unable to create the API report file. Please make sure the target folder exists:\\n' +\n expectedApiReportFolder\n );\n } else {\n FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {\n convertLineEndings: extractorConfig.newlineKind\n });\n messageRouter.logWarning(\n ConsoleMessageId.ApiReportCreated,\n 'The API report file was missing, so a new file was created. Please add this file to Git:\\n' +\n expectedApiReportPath\n );\n }\n }\n }\n return apiReportChanged;\n }\n\n private static _checkCompilerCompatibility(\n extractorConfig: ExtractorConfig,\n messageRouter: MessageRouter\n ): void {\n messageRouter.logInfo(\n ConsoleMessageId.Preamble,\n `Analysis will use the bundled TypeScript version ${ts.version}`\n );\n\n try {\n const typescriptPath: string = resolve.sync('typescript', {\n basedir: extractorConfig.projectFolder,\n preserveSymlinks: false\n });\n const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();\n const packageJson: INodePackageJson | undefined =\n packageJsonLookup.tryLoadNodePackageJsonFor(typescriptPath);\n if (packageJson && packageJson.version && semver.valid(packageJson.version)) {\n // Consider a newer MINOR release to be incompatible\n const ourMajor: number = semver.major(ts.version);\n const ourMinor: number = semver.minor(ts.version);\n\n const theirMajor: number = semver.major(packageJson.version);\n const theirMinor: number = semver.minor(packageJson.version);\n\n if (theirMajor > ourMajor || (theirMajor === ourMajor && theirMinor > ourMinor)) {\n messageRouter.logInfo(\n ConsoleMessageId.CompilerVersionNotice,\n `*** The target project appears to use TypeScript ${packageJson.version} which is newer than the` +\n ` bundled compiler engine; consider upgrading API Extractor.`\n );\n }\n }\n } catch (e) {\n // The compiler detection heuristic is not expected to work in many configurations\n }\n }\n\n private static _generateRollupDtsFile(\n collector: Collector,\n outputPath: string,\n dtsKind: DtsRollupKind,\n newlineKind: NewlineKind\n ): void {\n if (outputPath !== '') {\n collector.messageRouter.logVerbose(\n ConsoleMessageId.WritingDtsRollup,\n `Writing package typings: ${outputPath}`\n );\n DtsRollupGenerator.writeTypingsFile(collector, outputPath, dtsKind, newlineKind);\n }\n }\n}\n"]}
@@ -2,10 +2,11 @@ import { CommandLineAction } from '@rushstack/ts-command-line';
2
2
  import type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';
3
3
  export declare class RunAction extends CommandLineAction {
4
4
  private readonly _configFileParameter;
5
- private readonly _localParameter;
6
- private readonly _verboseParameter;
5
+ private readonly _localFlag;
6
+ private readonly _verboseFlag;
7
7
  private readonly _diagnosticsParameter;
8
- private readonly _typescriptCompilerFolder;
8
+ private readonly _typescriptCompilerFolderParameter;
9
+ private readonly _printApiReportDiffFlag;
9
10
  constructor(parser: ApiExtractorCommandLine);
10
11
  protected onExecuteAsync(): Promise<void>;
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RunAction.d.ts","sourceRoot":"","sources":["../../src/cli/RunAction.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGzE,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6B;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;IAC3D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;IAC7D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA2B;IACjE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA6B;gBAEpD,MAAM,EAAE,uBAAuB;cAiDzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA2EzD"}
1
+ {"version":3,"file":"RunAction.d.ts","sourceRoot":"","sources":["../../src/cli/RunAction.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGzE,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6B;IAClE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2B;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;IACxD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA2B;IACjE,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAA6B;IAChF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA2B;gBAEhD,MAAM,EAAE,uBAAuB;cAyDzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA4EzD"}
@@ -56,7 +56,7 @@ class RunAction extends ts_command_line_1.CommandLineAction {
56
56
  argumentName: 'FILE',
57
57
  description: `Use the specified ${ExtractorConfig_1.ExtractorConfig.FILENAME} file path, rather than guessing its location`
58
58
  });
59
- this._localParameter = this.defineFlagParameter({
59
+ this._localFlag = this.defineFlagParameter({
60
60
  parameterLongName: '--local',
61
61
  parameterShortName: '-l',
62
62
  description: 'Indicates that API Extractor is running as part of a local build,' +
@@ -64,7 +64,7 @@ class RunAction extends ts_command_line_1.CommandLineAction {
64
64
  ' normally be performed for a ship/production build. For example, the *.api.md' +
65
65
  ' report file is automatically copied in a local build.'
66
66
  });
67
- this._verboseParameter = this.defineFlagParameter({
67
+ this._verboseFlag = this.defineFlagParameter({
68
68
  parameterLongName: '--verbose',
69
69
  parameterShortName: '-v',
70
70
  description: 'Show additional informational messages in the output.'
@@ -74,7 +74,7 @@ class RunAction extends ts_command_line_1.CommandLineAction {
74
74
  description: 'Show diagnostic messages used for troubleshooting problems with API Extractor.' +
75
75
  ' This flag also enables the "--verbose" flag.'
76
76
  });
77
- this._typescriptCompilerFolder = this.defineStringParameter({
77
+ this._typescriptCompilerFolderParameter = this.defineStringParameter({
78
78
  parameterLongName: '--typescript-compiler-folder',
79
79
  argumentName: 'PATH',
80
80
  description: 'API Extractor uses its own TypeScript compiler engine to analyze your project. If your project' +
@@ -83,11 +83,17 @@ class RunAction extends ts_command_line_1.CommandLineAction {
83
83
  ' "--typescriptCompilerFolder" option to specify the folder path where you installed the TypeScript package,' +
84
84
  " and API Extractor's compiler will use those system typings instead."
85
85
  });
86
+ this._printApiReportDiffFlag = this.defineFlagParameter({
87
+ parameterLongName: '--print-api-report-diff',
88
+ description: 'If provided, then any differences between the actual and expected API reports will be ' +
89
+ 'printed on the console. Note that the diff is not printed if the expected API report file has not been ' +
90
+ 'created yet.'
91
+ });
86
92
  }
87
93
  async onExecuteAsync() {
88
94
  const lookup = new node_core_library_1.PackageJsonLookup();
89
95
  let configFilename;
90
- let typescriptCompilerFolder = this._typescriptCompilerFolder.value;
96
+ let typescriptCompilerFolder = this._typescriptCompilerFolderParameter.value;
91
97
  if (typescriptCompilerFolder) {
92
98
  typescriptCompilerFolder = path.normalize(typescriptCompilerFolder);
93
99
  if (node_core_library_1.FileSystem.exists(typescriptCompilerFolder)) {
@@ -96,15 +102,15 @@ class RunAction extends ts_command_line_1.CommandLineAction {
96
102
  ? lookup.tryLoadPackageJsonFor(typescriptCompilerFolder)
97
103
  : undefined;
98
104
  if (!typescriptCompilerPackageJson) {
99
- throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a package.`);
105
+ throw new Error(`The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter is not a package.`);
100
106
  }
101
107
  else if (typescriptCompilerPackageJson.name !== 'typescript') {
102
- throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a TypeScript` +
108
+ throw new Error(`The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter is not a TypeScript` +
103
109
  ' compiler package.');
104
110
  }
105
111
  }
106
112
  else {
107
- throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter does not exist.`);
113
+ throw new Error(`The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter does not exist.`);
108
114
  }
109
115
  }
110
116
  let extractorConfig;
@@ -130,10 +136,11 @@ class RunAction extends ts_command_line_1.CommandLineAction {
130
136
  extractorConfig = ExtractorConfig_1.ExtractorConfig.prepare(prepareOptions);
131
137
  }
132
138
  const extractorResult = Extractor_1.Extractor.invoke(extractorConfig, {
133
- localBuild: this._localParameter.value,
134
- showVerboseMessages: this._verboseParameter.value,
139
+ localBuild: this._localFlag.value,
140
+ showVerboseMessages: this._verboseFlag.value,
135
141
  showDiagnostics: this._diagnosticsParameter.value,
136
- typescriptCompilerFolder: typescriptCompilerFolder
142
+ typescriptCompilerFolder: typescriptCompilerFolder,
143
+ printApiReportDiff: this._printApiReportDiffFlag.value
137
144
  });
138
145
  if (extractorResult.succeeded) {
139
146
  console.log(os.EOL + 'API Extractor completed successfully');
@@ -1 +1 @@
1
- {"version":3,"file":"RunAction.js","sourceRoot":"","sources":["../../src/cli/RunAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,4CAA8B;AAC9B,gDAAkC;AAElC,oEAMsC;AACtC,kDAA+C;AAC/C,gEAIoC;AAEpC,gDAAmE;AAEnE,4DAA8F;AAE9F,MAAa,SAAU,SAAQ,mCAAiB;IAO9C,YAAmB,MAA+B;QAChD,KAAK,CAAC;YACJ,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,mCAAmC;YAC5C,aAAa,EAAE,mCAAmC;SACnD,CAAC,CAAC;QAEH,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,CAAC;YACrD,iBAAiB,EAAE,UAAU;YAC7B,kBAAkB,EAAE,IAAI;YACxB,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,qBAAqB,iCAAe,CAAC,QAAQ,+CAA+C;SAC1G,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EACT,mEAAmE;gBACnE,6EAA6E;gBAC7E,+EAA+E;gBAC/E,wDAAwD;SAC3D,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAChD,iBAAiB,EAAE,WAAW;YAC9B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,uDAAuD;SACrE,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,mBAAmB,CAAC;YACpD,iBAAiB,EAAE,eAAe;YAClC,WAAW,EACT,gFAAgF;gBAChF,gDAA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ACnD,CAAC,CAAC;QAEH,IAAI,eAAe,CAAC,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,sCAAsC,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,IAAI,eAAe,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,mBAAQ,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,mBAAQ,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC,CAAC;YACjF,CAAC;YACD,MAAM,IAAI,wCAAoB,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AAnID,8BAmIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\nimport {\n PackageJsonLookup,\n FileSystem,\n type IPackageJson,\n Path,\n AlreadyReportedError\n} from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\nimport {\n CommandLineAction,\n type CommandLineStringParameter,\n type CommandLineFlagParameter\n} from '@rushstack/ts-command-line';\n\nimport { Extractor, type ExtractorResult } from '../api/Extractor';\nimport type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';\nimport { ExtractorConfig, type IExtractorConfigPrepareOptions } from '../api/ExtractorConfig';\n\nexport class RunAction extends CommandLineAction {\n private readonly _configFileParameter: CommandLineStringParameter;\n private readonly _localParameter: CommandLineFlagParameter;\n private readonly _verboseParameter: CommandLineFlagParameter;\n private readonly _diagnosticsParameter: CommandLineFlagParameter;\n private readonly _typescriptCompilerFolder: CommandLineStringParameter;\n\n public constructor(parser: ApiExtractorCommandLine) {\n super({\n actionName: 'run',\n summary: 'Invoke API Extractor on a project',\n documentation: 'Invoke API Extractor on a project'\n });\n\n this._configFileParameter = this.defineStringParameter({\n parameterLongName: '--config',\n parameterShortName: '-c',\n argumentName: 'FILE',\n description: `Use the specified ${ExtractorConfig.FILENAME} file path, rather than guessing its location`\n });\n\n this._localParameter = this.defineFlagParameter({\n parameterLongName: '--local',\n parameterShortName: '-l',\n description:\n 'Indicates that API Extractor is running as part of a local build,' +\n \" e.g. on a developer's machine. This disables certain validation that would\" +\n ' normally be performed for a ship/production build. For example, the *.api.md' +\n ' report file is automatically copied in a local build.'\n });\n\n this._verboseParameter = this.defineFlagParameter({\n parameterLongName: '--verbose',\n parameterShortName: '-v',\n description: 'Show additional informational messages in the output.'\n });\n\n this._diagnosticsParameter = this.defineFlagParameter({\n parameterLongName: '--diagnostics',\n description:\n 'Show diagnostic messages used for troubleshooting problems with API Extractor.' +\n ' This flag also enables the \"--verbose\" flag.'\n });\n\n this._typescriptCompilerFolder = this.defineStringParameter({\n parameterLongName: '--typescript-compiler-folder',\n argumentName: 'PATH',\n description:\n 'API Extractor uses its own TypeScript compiler engine to analyze your project. If your project' +\n ' is built with a significantly different TypeScript version, sometimes API Extractor may report compilation' +\n ' errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the' +\n ' \"--typescriptCompilerFolder\" option to specify the folder path where you installed the TypeScript package,' +\n \" and API Extractor's compiler will use those system typings instead.\"\n });\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const lookup: PackageJsonLookup = new PackageJsonLookup();\n let configFilename: string;\n\n let typescriptCompilerFolder: string | undefined = this._typescriptCompilerFolder.value;\n if (typescriptCompilerFolder) {\n typescriptCompilerFolder = path.normalize(typescriptCompilerFolder);\n\n if (FileSystem.exists(typescriptCompilerFolder)) {\n typescriptCompilerFolder = lookup.tryGetPackageFolderFor(typescriptCompilerFolder);\n const typescriptCompilerPackageJson: IPackageJson | undefined = typescriptCompilerFolder\n ? lookup.tryLoadPackageJsonFor(typescriptCompilerFolder)\n : undefined;\n if (!typescriptCompilerPackageJson) {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a package.`\n );\n } else if (typescriptCompilerPackageJson.name !== 'typescript') {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a TypeScript` +\n ' compiler package.'\n );\n }\n } else {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolder.longName} parameter does not exist.`\n );\n }\n }\n\n let extractorConfig: ExtractorConfig;\n\n if (this._configFileParameter.value) {\n configFilename = path.normalize(this._configFileParameter.value);\n if (!FileSystem.exists(configFilename)) {\n throw new Error('Config file not found: ' + this._configFileParameter.value);\n }\n\n extractorConfig = ExtractorConfig.loadFileAndPrepare(configFilename);\n } else {\n const prepareOptions: IExtractorConfigPrepareOptions | undefined = ExtractorConfig.tryLoadForFolder({\n startingFolder: '.'\n });\n\n if (!prepareOptions || !prepareOptions.configObjectFullPath) {\n throw new Error(`Unable to find an ${ExtractorConfig.FILENAME} file`);\n }\n\n const configObjectShortPath: string = Path.formatConcisely({\n pathToConvert: prepareOptions.configObjectFullPath,\n baseFolder: process.cwd()\n });\n console.log(`Using configuration from ${configObjectShortPath}`);\n\n extractorConfig = ExtractorConfig.prepare(prepareOptions);\n }\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: this._localParameter.value,\n showVerboseMessages: this._verboseParameter.value,\n showDiagnostics: this._diagnosticsParameter.value,\n typescriptCompilerFolder: typescriptCompilerFolder\n });\n\n if (extractorResult.succeeded) {\n console.log(os.EOL + 'API Extractor completed successfully');\n } else {\n if (extractorResult.errorCount > 0) {\n console.log(os.EOL + Colorize.red('API Extractor completed with errors'));\n } else {\n console.log(os.EOL + Colorize.yellow('API Extractor completed with warnings'));\n }\n throw new AlreadyReportedError();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"RunAction.js","sourceRoot":"","sources":["../../src/cli/RunAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;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EH,IAAI,eAAe,CAAC,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,sCAAsC,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,IAAI,eAAe,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,mBAAQ,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,mBAAQ,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC,CAAC;YACjF,CAAC;YACD,MAAM,IAAI,wCAAoB,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AA7ID,8BA6IC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\nimport {\n PackageJsonLookup,\n FileSystem,\n type IPackageJson,\n Path,\n AlreadyReportedError\n} from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\nimport {\n CommandLineAction,\n type CommandLineStringParameter,\n type CommandLineFlagParameter\n} from '@rushstack/ts-command-line';\n\nimport { Extractor, type ExtractorResult } from '../api/Extractor';\nimport type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';\nimport { ExtractorConfig, type IExtractorConfigPrepareOptions } from '../api/ExtractorConfig';\n\nexport class RunAction extends CommandLineAction {\n private readonly _configFileParameter: CommandLineStringParameter;\n private readonly _localFlag: CommandLineFlagParameter;\n private readonly _verboseFlag: CommandLineFlagParameter;\n private readonly _diagnosticsParameter: CommandLineFlagParameter;\n private readonly _typescriptCompilerFolderParameter: CommandLineStringParameter;\n private readonly _printApiReportDiffFlag: CommandLineFlagParameter;\n\n public constructor(parser: ApiExtractorCommandLine) {\n super({\n actionName: 'run',\n summary: 'Invoke API Extractor on a project',\n documentation: 'Invoke API Extractor on a project'\n });\n\n this._configFileParameter = this.defineStringParameter({\n parameterLongName: '--config',\n parameterShortName: '-c',\n argumentName: 'FILE',\n description: `Use the specified ${ExtractorConfig.FILENAME} file path, rather than guessing its location`\n });\n\n this._localFlag = this.defineFlagParameter({\n parameterLongName: '--local',\n parameterShortName: '-l',\n description:\n 'Indicates that API Extractor is running as part of a local build,' +\n \" e.g. on a developer's machine. This disables certain validation that would\" +\n ' normally be performed for a ship/production build. For example, the *.api.md' +\n ' report file is automatically copied in a local build.'\n });\n\n this._verboseFlag = this.defineFlagParameter({\n parameterLongName: '--verbose',\n parameterShortName: '-v',\n description: 'Show additional informational messages in the output.'\n });\n\n this._diagnosticsParameter = this.defineFlagParameter({\n parameterLongName: '--diagnostics',\n description:\n 'Show diagnostic messages used for troubleshooting problems with API Extractor.' +\n ' This flag also enables the \"--verbose\" flag.'\n });\n\n this._typescriptCompilerFolderParameter = this.defineStringParameter({\n parameterLongName: '--typescript-compiler-folder',\n argumentName: 'PATH',\n description:\n 'API Extractor uses its own TypeScript compiler engine to analyze your project. If your project' +\n ' is built with a significantly different TypeScript version, sometimes API Extractor may report compilation' +\n ' errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the' +\n ' \"--typescriptCompilerFolder\" option to specify the folder path where you installed the TypeScript package,' +\n \" and API Extractor's compiler will use those system typings instead.\"\n });\n\n this._printApiReportDiffFlag = this.defineFlagParameter({\n parameterLongName: '--print-api-report-diff',\n description:\n 'If provided, then any differences between the actual and expected API reports will be ' +\n 'printed on the console. Note that the diff is not printed if the expected API report file has not been ' +\n 'created yet.'\n });\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const lookup: PackageJsonLookup = new PackageJsonLookup();\n let configFilename: string;\n\n let typescriptCompilerFolder: string | undefined = this._typescriptCompilerFolderParameter.value;\n if (typescriptCompilerFolder) {\n typescriptCompilerFolder = path.normalize(typescriptCompilerFolder);\n\n if (FileSystem.exists(typescriptCompilerFolder)) {\n typescriptCompilerFolder = lookup.tryGetPackageFolderFor(typescriptCompilerFolder);\n const typescriptCompilerPackageJson: IPackageJson | undefined = typescriptCompilerFolder\n ? lookup.tryLoadPackageJsonFor(typescriptCompilerFolder)\n : undefined;\n if (!typescriptCompilerPackageJson) {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter is not a package.`\n );\n } else if (typescriptCompilerPackageJson.name !== 'typescript') {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter is not a TypeScript` +\n ' compiler package.'\n );\n }\n } else {\n throw new Error(\n `The path specified in the ${this._typescriptCompilerFolderParameter.longName} parameter does not exist.`\n );\n }\n }\n\n let extractorConfig: ExtractorConfig;\n\n if (this._configFileParameter.value) {\n configFilename = path.normalize(this._configFileParameter.value);\n if (!FileSystem.exists(configFilename)) {\n throw new Error('Config file not found: ' + this._configFileParameter.value);\n }\n\n extractorConfig = ExtractorConfig.loadFileAndPrepare(configFilename);\n } else {\n const prepareOptions: IExtractorConfigPrepareOptions | undefined = ExtractorConfig.tryLoadForFolder({\n startingFolder: '.'\n });\n\n if (!prepareOptions || !prepareOptions.configObjectFullPath) {\n throw new Error(`Unable to find an ${ExtractorConfig.FILENAME} file`);\n }\n\n const configObjectShortPath: string = Path.formatConcisely({\n pathToConvert: prepareOptions.configObjectFullPath,\n baseFolder: process.cwd()\n });\n console.log(`Using configuration from ${configObjectShortPath}`);\n\n extractorConfig = ExtractorConfig.prepare(prepareOptions);\n }\n\n const extractorResult: ExtractorResult = Extractor.invoke(extractorConfig, {\n localBuild: this._localFlag.value,\n showVerboseMessages: this._verboseFlag.value,\n showDiagnostics: this._diagnosticsParameter.value,\n typescriptCompilerFolder: typescriptCompilerFolder,\n printApiReportDiff: this._printApiReportDiffFlag.value\n });\n\n if (extractorResult.succeeded) {\n console.log(os.EOL + 'API Extractor completed successfully');\n } else {\n if (extractorResult.errorCount > 0) {\n console.log(os.EOL + Colorize.red('API Extractor completed with errors'));\n } else {\n console.log(os.EOL + Colorize.yellow('API Extractor completed with warnings'));\n }\n throw new AlreadyReportedError();\n }\n }\n}\n"]}
@@ -89,7 +89,7 @@ export declare class MessageRouter {
89
89
  fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[];
90
90
  /**
91
91
  * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not
92
- * retreieved using `fetchAssociatedMessagesForReviewFile()`.
92
+ * retrieved using `fetchAssociatedMessagesForReviewFile()`.
93
93
  */
94
94
  fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[];
95
95
  /**
@@ -319,7 +319,7 @@ class MessageRouter {
319
319
  }
320
320
  /**
321
321
  * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not
322
- * retreieved using `fetchAssociatedMessagesForReviewFile()`.
322
+ * retrieved using `fetchAssociatedMessagesForReviewFile()`.
323
323
  */
324
324
  fetchUnassociatedMessagesForReviewFile() {
325
325
  const messagesForApiReportFile = [];
@@ -1 +1 @@
1
- {"version":3,"file":"MessageRouter.js","sourceRoot":"","sources":["../../src/collector/MessageRouter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,+CAAiC;AAGjC,oEAAmE;AACnE,kDAA+C;AAE/C,+DAA4D;AAE5D,8DAKiC;AACjC,kEAA4F;AAG5F,gEAA6D;AAC7D,8DAA2D;AAwB3D,MAAa,aAAa;IA0CxB,YAAmB,OAA8B;QAzBjD,yEAAyE;QACjE,8BAAyB,GAAgC,IAAI,GAAG,EAA0B,CAAC;QAC3F,yBAAoB,GAAmB;YAC7C,QAAQ,EAAE,qCAAiB,CAAC,IAAI;YAChC,kBAAkB,EAAE,KAAK;SAC1B,CAAC;QACM,0BAAqB,GAAmB;YAC9C,QAAQ,EAAE,qCAAiB,CAAC,IAAI;YAChC,kBAAkB,EAAE,KAAK;SAC1B,CAAC;QACM,sBA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gB,GACrC,8DAA8D,AADzB,CAC0B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport { Sort, InternalError } from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\n\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { AstSymbol } from '../analyzer/AstSymbol';\nimport {\n ExtractorMessage,\n ExtractorMessageCategory,\n type IExtractorMessageOptions,\n type IExtractorMessageProperties\n} from '../api/ExtractorMessage';\nimport { type ExtractorMessageId, allExtractorMessageIds } from '../api/ExtractorMessageId';\nimport type { IExtractorMessagesConfig, IConfigMessageReportingRule } from '../api/IConfigFile';\nimport type { ISourceLocation, SourceMapper } from './SourceMapper';\nimport { ExtractorLogLevel } from '../api/ExtractorLogLevel';\nimport { ConsoleMessageId } from '../api/ConsoleMessageId';\n\ninterface IReportingRule {\n logLevel: ExtractorLogLevel;\n addToApiReportFile: boolean;\n}\n\nexport interface IMessageRouterOptions {\n workingPackageFolder: string | undefined;\n messageCallback: ((message: ExtractorMessage) => void) | undefined;\n messagesConfig: IExtractorMessagesConfig;\n showVerboseMessages: boolean;\n showDiagnostics: boolean;\n tsdocConfiguration: tsdoc.TSDocConfiguration;\n sourceMapper: SourceMapper;\n}\n\nexport interface IBuildJsonDumpObjectOptions {\n /**\n * {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.\n */\n keyNamesToOmit?: string[];\n}\n\nexport class MessageRouter {\n public static readonly DIAGNOSTICS_LINE: string =\n '============================================================';\n\n private readonly _workingPackageFolder: string | undefined;\n private readonly _messageCallback: ((message: ExtractorMessage) => void) | undefined;\n\n // All messages\n private readonly _messages: ExtractorMessage[];\n\n // For each AstDeclaration, the messages associated with it. This is used when addToApiReportFile=true\n private readonly _associatedMessagesForAstDeclaration: Map<AstDeclaration, ExtractorMessage[]>;\n\n private readonly _sourceMapper: SourceMapper;\n\n private readonly _tsdocConfiguration: tsdoc.TSDocConfiguration;\n\n // Normalized representation of the routing rules from api-extractor.json\n private _reportingRuleByMessageId: Map<string, IReportingRule> = new Map<string, IReportingRule>();\n private _compilerDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _extractorDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _tsdocDefaultRule: IReportingRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };\n\n public errorCount: number = 0;\n public warningCount: number = 0;\n\n /**\n * See {@link IExtractorInvokeOptions.showVerboseMessages}\n */\n public readonly showVerboseMessages: boolean;\n\n /**\n * See {@link IExtractorInvokeOptions.showDiagnostics}\n */\n public readonly showDiagnostics: boolean;\n\n public constructor(options: IMessageRouterOptions) {\n this._workingPackageFolder = options.workingPackageFolder;\n this._messageCallback = options.messageCallback;\n\n this._messages = [];\n this._associatedMessagesForAstDeclaration = new Map<AstDeclaration, ExtractorMessage[]>();\n this._sourceMapper = options.sourceMapper;\n this._tsdocConfiguration = options.tsdocConfiguration;\n\n // showDiagnostics implies showVerboseMessages\n this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;\n this.showDiagnostics = options.showDiagnostics;\n\n this._applyMessagesConfig(options.messagesConfig);\n }\n\n /**\n * Read the api-extractor.json configuration and build up the tables of routing rules.\n */\n private _applyMessagesConfig(messagesConfig: IExtractorMessagesConfig): void {\n if (messagesConfig.compilerMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.compilerMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._compilerDefaultRule = reportingRule;\n } else if (!/^TS[0-9]+$/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.compilerMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The identifier format is \"TS\" followed by an integer.`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.extractorMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.extractorMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._extractorDefaultRule = reportingRule;\n } else if (!/^ae-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"ae-\" prefix.`\n );\n } else if (!allExtractorMessageIds.has(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.tsdocMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.tsdocMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._tsdocDefaultRule = reportingRule;\n } else if (!/^tsdoc-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"tsdoc-\" prefix.`\n );\n } else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n }\n\n private static _getNormalizedRule(rule: IConfigMessageReportingRule): IReportingRule {\n return {\n logLevel: rule.logLevel || 'none',\n addToApiReportFile: rule.addToApiReportFile || false\n };\n }\n\n public get messages(): ReadonlyArray<ExtractorMessage> {\n return this._messages;\n }\n\n /**\n * Add a diagnostic message reported by the TypeScript compiler\n */\n public addCompilerDiagnostic(diagnostic: ts.Diagnostic): void {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n return; // ignore noise\n }\n\n const messageText: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Compiler,\n messageId: `TS${diagnostic.code}`,\n text: messageText\n };\n\n if (diagnostic.file) {\n // NOTE: Since compiler errors pertain to issues specific to the .d.ts files,\n // we do not apply source mappings for them.\n const sourceFile: ts.SourceFile = diagnostic.file;\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: diagnostic.start || 0,\n useDtsLocation: true\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n }\n\n this._messages.push(new ExtractorMessage(options));\n }\n\n /**\n * Add a message from the API Extractor analysis\n */\n public addAnalyzerIssue(\n messageId: ExtractorMessageId,\n messageText: string,\n astDeclarationOrSymbol: AstDeclaration | AstSymbol,\n properties?: IExtractorMessageProperties\n ): void {\n let astDeclaration: AstDeclaration;\n if (astDeclarationOrSymbol instanceof AstDeclaration) {\n astDeclaration = astDeclarationOrSymbol;\n } else {\n astDeclaration = astDeclarationOrSymbol.astDeclarations[0];\n }\n\n const extractorMessage: ExtractorMessage = this.addAnalyzerIssueForPosition(\n messageId,\n messageText,\n astDeclaration.declaration.getSourceFile(),\n astDeclaration.declaration.getStart(),\n properties\n );\n\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n /**\n * Add all messages produced from an invocation of the TSDoc parser, assuming they refer to\n * code in the specified source file.\n */\n public addTsdocMessages(\n parserContext: tsdoc.ParserContext,\n sourceFile: ts.SourceFile,\n astDeclaration?: AstDeclaration\n ): void {\n for (const message of parserContext.log.messages) {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.TSDoc,\n messageId: message.messageId,\n text: message.unformattedText\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: message.textRange.pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n if (astDeclaration) {\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n this._messages.push(extractorMessage);\n }\n }\n\n /**\n * Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that\n * is JSON serializable. This is used by the \"--diagnostics\" feature to dump the state of configuration objects.\n *\n * @returns a JSON serializable object (possibly including `null` values)\n * or `undefined` if the input cannot be represented as JSON\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined {\n if (!options) {\n options = {};\n }\n\n const keyNamesToOmit: Set<string> = new Set(options.keyNamesToOmit);\n\n return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _buildJsonDumpObject(input: any, keyNamesToOmit: Set<string>): any | undefined {\n if (input === null || input === undefined) {\n return null; // JSON uses null instead of undefined\n }\n\n switch (typeof input) {\n case 'boolean':\n case 'number':\n case 'string':\n return input;\n case 'object':\n if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputArray: any[] = [];\n for (const element of input) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedElement: any = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);\n if (serializedElement !== undefined) {\n outputArray.push(serializedElement);\n }\n }\n return outputArray;\n }\n\n const outputObject: object = {};\n for (const key of Object.getOwnPropertyNames(input)) {\n if (keyNamesToOmit.has(key)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value: any = input[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedValue: any = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);\n\n if (serializedValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (outputObject as any)[key] = serializedValue;\n }\n }\n return outputObject;\n }\n\n return undefined;\n }\n\n /**\n * Record this message in _associatedMessagesForAstDeclaration\n */\n private _associateMessageWithAstDeclaration(\n extractorMessage: ExtractorMessage,\n astDeclaration: AstDeclaration\n ): void {\n let associatedMessages: ExtractorMessage[] | undefined =\n this._associatedMessagesForAstDeclaration.get(astDeclaration);\n\n if (!associatedMessages) {\n associatedMessages = [];\n this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);\n }\n associatedMessages.push(extractorMessage);\n }\n\n /**\n * Add a message for a location in an arbitrary source file.\n */\n public addAnalyzerIssueForPosition(\n messageId: ExtractorMessageId,\n messageText: string,\n sourceFile: ts.SourceFile,\n pos: number,\n properties?: IExtractorMessageProperties\n ): ExtractorMessage {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Extractor,\n messageId,\n text: messageText,\n properties\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n this._messages.push(extractorMessage);\n return extractorMessage;\n }\n\n /**\n * This is used when writing the API report file. It looks up any messages that were configured to get emitted\n * in the API report file and returns them. It also records that they were emitted, which suppresses them from\n * being shown on the console.\n */\n public fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n const associatedMessages: ExtractorMessage[] =\n this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];\n for (const associatedMessage of associatedMessages) {\n // Make sure we didn't already report this message for some reason\n if (!associatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(associatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(associatedMessage);\n associatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not\n * retreieved using `fetchAssociatedMessagesForReviewFile()`.\n */\n public fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n for (const unassociatedMessage of this.messages) {\n // Make sure we didn't already report this message for some reason\n if (!unassociatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(unassociatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(unassociatedMessage);\n unassociatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns the list of remaining messages that were not already processed by\n * `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.\n * These messages will be shown on the console.\n */\n public handleRemainingNonConsoleMessages(): void {\n const messagesForLogger: ExtractorMessage[] = [];\n\n for (const message of this.messages) {\n // Make sure we didn't already report this message\n if (!message.handled) {\n messagesForLogger.push(message);\n }\n }\n\n this._sortMessagesForOutput(messagesForLogger);\n\n for (const message of messagesForLogger) {\n this._handleMessage(message);\n }\n }\n\n public logError(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Error\n })\n );\n }\n\n public logWarning(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Warning\n })\n );\n }\n\n public logInfo(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Info\n })\n );\n }\n\n public logVerbose(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Verbose\n })\n );\n }\n\n public logDiagnosticHeader(title: string): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n this.logDiagnostic(`DIAGNOSTIC: ` + title);\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n }\n\n public logDiagnosticFooter(): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\\n');\n }\n\n public logDiagnostic(message: string): void {\n if (this.showDiagnostics) {\n this.logVerbose(ConsoleMessageId.Diagnostics, message);\n }\n }\n\n /**\n * Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.\n */\n private _handleMessage(message: ExtractorMessage): void {\n // Don't tally messages that were already \"handled\" by writing them into the API report\n if (message.handled) {\n return;\n }\n\n // Assign the ExtractorMessage.logLevel; the message callback may adjust it below\n if (message.category === ExtractorMessageCategory.Console) {\n // Console messages have their category log level assigned via logInfo(), logVerbose(), etc.\n } else {\n const reportingRule: IReportingRule = this._getRuleForMessage(message);\n message.logLevel = reportingRule.logLevel;\n }\n\n // If there is a callback, allow it to modify and/or handle the message\n if (this._messageCallback) {\n this._messageCallback(message);\n }\n\n // Update the statistics\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n ++this.errorCount;\n break;\n case ExtractorLogLevel.Warning:\n ++this.warningCount;\n break;\n }\n\n if (message.handled) {\n return;\n }\n\n // The messageCallback did not handle the message, so perform default handling\n message.handled = true;\n\n if (message.logLevel === ExtractorLogLevel.None) {\n return;\n }\n\n let messageText: string;\n if (message.category === ExtractorMessageCategory.Console) {\n messageText = message.text;\n } else {\n messageText = message.formatMessageWithLocation(this._workingPackageFolder);\n }\n\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n console.error(Colorize.red('Error: ' + messageText));\n break;\n case ExtractorLogLevel.Warning:\n console.warn(Colorize.yellow('Warning: ' + messageText));\n break;\n case ExtractorLogLevel.Info:\n console.log(messageText);\n break;\n case ExtractorLogLevel.Verbose:\n if (this.showVerboseMessages) {\n console.log(Colorize.cyan(messageText));\n }\n break;\n default:\n throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);\n }\n }\n\n /**\n * For a given message, determine the IReportingRule based on the rule tables.\n */\n private _getRuleForMessage(message: ExtractorMessage): IReportingRule {\n const reportingRule: IReportingRule | undefined = this._reportingRuleByMessageId.get(message.messageId);\n if (reportingRule) {\n return reportingRule;\n }\n switch (message.category) {\n case ExtractorMessageCategory.Compiler:\n return this._compilerDefaultRule;\n case ExtractorMessageCategory.Extractor:\n return this._extractorDefaultRule;\n case ExtractorMessageCategory.TSDoc:\n return this._tsdocDefaultRule;\n case ExtractorMessageCategory.Console:\n throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');\n }\n }\n\n /**\n * Sorts an array of messages according to a reasonable ordering\n */\n private _sortMessagesForOutput(messages: ExtractorMessage[]): void {\n messages.sort((a, b) => {\n let diff: number;\n // First sort by file name\n diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by line number\n diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by messageId\n return Sort.compareByValue(a.messageId, b.messageId);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AAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrB,IAAI,IAAY,CAAC;YACjB,0BAA0B;YAC1B,IAAI,GAAG,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,2BAA2B;YAC3B,IAAI,GAAG,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,yBAAyB;YACzB,OAAO,wBAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;;AApmBH,sCAqmBC;AApmBwB,8BAAgB,GACrC,8DAA8D,AADzB,CAC0B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as ts from 'typescript';\n\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport { Sort, InternalError } from '@rushstack/node-core-library';\nimport { Colorize } from '@rushstack/terminal';\n\nimport { AstDeclaration } from '../analyzer/AstDeclaration';\nimport type { AstSymbol } from '../analyzer/AstSymbol';\nimport {\n ExtractorMessage,\n ExtractorMessageCategory,\n type IExtractorMessageOptions,\n type IExtractorMessageProperties\n} from '../api/ExtractorMessage';\nimport { type ExtractorMessageId, allExtractorMessageIds } from '../api/ExtractorMessageId';\nimport type { IExtractorMessagesConfig, IConfigMessageReportingRule } from '../api/IConfigFile';\nimport type { ISourceLocation, SourceMapper } from './SourceMapper';\nimport { ExtractorLogLevel } from '../api/ExtractorLogLevel';\nimport { ConsoleMessageId } from '../api/ConsoleMessageId';\n\ninterface IReportingRule {\n logLevel: ExtractorLogLevel;\n addToApiReportFile: boolean;\n}\n\nexport interface IMessageRouterOptions {\n workingPackageFolder: string | undefined;\n messageCallback: ((message: ExtractorMessage) => void) | undefined;\n messagesConfig: IExtractorMessagesConfig;\n showVerboseMessages: boolean;\n showDiagnostics: boolean;\n tsdocConfiguration: tsdoc.TSDocConfiguration;\n sourceMapper: SourceMapper;\n}\n\nexport interface IBuildJsonDumpObjectOptions {\n /**\n * {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.\n */\n keyNamesToOmit?: string[];\n}\n\nexport class MessageRouter {\n public static readonly DIAGNOSTICS_LINE: string =\n '============================================================';\n\n private readonly _workingPackageFolder: string | undefined;\n private readonly _messageCallback: ((message: ExtractorMessage) => void) | undefined;\n\n // All messages\n private readonly _messages: ExtractorMessage[];\n\n // For each AstDeclaration, the messages associated with it. This is used when addToApiReportFile=true\n private readonly _associatedMessagesForAstDeclaration: Map<AstDeclaration, ExtractorMessage[]>;\n\n private readonly _sourceMapper: SourceMapper;\n\n private readonly _tsdocConfiguration: tsdoc.TSDocConfiguration;\n\n // Normalized representation of the routing rules from api-extractor.json\n private _reportingRuleByMessageId: Map<string, IReportingRule> = new Map<string, IReportingRule>();\n private _compilerDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _extractorDefaultRule: IReportingRule = {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false\n };\n private _tsdocDefaultRule: IReportingRule = { logLevel: ExtractorLogLevel.None, addToApiReportFile: false };\n\n public errorCount: number = 0;\n public warningCount: number = 0;\n\n /**\n * See {@link IExtractorInvokeOptions.showVerboseMessages}\n */\n public readonly showVerboseMessages: boolean;\n\n /**\n * See {@link IExtractorInvokeOptions.showDiagnostics}\n */\n public readonly showDiagnostics: boolean;\n\n public constructor(options: IMessageRouterOptions) {\n this._workingPackageFolder = options.workingPackageFolder;\n this._messageCallback = options.messageCallback;\n\n this._messages = [];\n this._associatedMessagesForAstDeclaration = new Map<AstDeclaration, ExtractorMessage[]>();\n this._sourceMapper = options.sourceMapper;\n this._tsdocConfiguration = options.tsdocConfiguration;\n\n // showDiagnostics implies showVerboseMessages\n this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;\n this.showDiagnostics = options.showDiagnostics;\n\n this._applyMessagesConfig(options.messagesConfig);\n }\n\n /**\n * Read the api-extractor.json configuration and build up the tables of routing rules.\n */\n private _applyMessagesConfig(messagesConfig: IExtractorMessagesConfig): void {\n if (messagesConfig.compilerMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.compilerMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._compilerDefaultRule = reportingRule;\n } else if (!/^TS[0-9]+$/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.compilerMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The identifier format is \"TS\" followed by an integer.`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.extractorMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.extractorMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._extractorDefaultRule = reportingRule;\n } else if (!/^ae-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"ae-\" prefix.`\n );\n } else if (!allExtractorMessageIds.has(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.extractorMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n\n if (messagesConfig.tsdocMessageReporting) {\n for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {\n const reportingRule: IReportingRule = MessageRouter._getNormalizedRule(\n messagesConfig.tsdocMessageReporting[messageId]\n );\n\n if (messageId === 'default') {\n this._tsdocDefaultRule = reportingRule;\n } else if (!/^tsdoc-/.test(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an invalid entry \"${messageId}\". The name should begin with the \"tsdoc-\" prefix.`\n );\n } else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {\n throw new Error(\n `Error in API Extractor config: The messages.tsdocMessageReporting table contains` +\n ` an unrecognized identifier \"${messageId}\". Is it spelled correctly?`\n );\n } else {\n this._reportingRuleByMessageId.set(messageId, reportingRule);\n }\n }\n }\n }\n\n private static _getNormalizedRule(rule: IConfigMessageReportingRule): IReportingRule {\n return {\n logLevel: rule.logLevel || 'none',\n addToApiReportFile: rule.addToApiReportFile || false\n };\n }\n\n public get messages(): ReadonlyArray<ExtractorMessage> {\n return this._messages;\n }\n\n /**\n * Add a diagnostic message reported by the TypeScript compiler\n */\n public addCompilerDiagnostic(diagnostic: ts.Diagnostic): void {\n switch (diagnostic.category) {\n case ts.DiagnosticCategory.Suggestion:\n case ts.DiagnosticCategory.Message:\n return; // ignore noise\n }\n\n const messageText: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Compiler,\n messageId: `TS${diagnostic.code}`,\n text: messageText\n };\n\n if (diagnostic.file) {\n // NOTE: Since compiler errors pertain to issues specific to the .d.ts files,\n // we do not apply source mappings for them.\n const sourceFile: ts.SourceFile = diagnostic.file;\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: diagnostic.start || 0,\n useDtsLocation: true\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n }\n\n this._messages.push(new ExtractorMessage(options));\n }\n\n /**\n * Add a message from the API Extractor analysis\n */\n public addAnalyzerIssue(\n messageId: ExtractorMessageId,\n messageText: string,\n astDeclarationOrSymbol: AstDeclaration | AstSymbol,\n properties?: IExtractorMessageProperties\n ): void {\n let astDeclaration: AstDeclaration;\n if (astDeclarationOrSymbol instanceof AstDeclaration) {\n astDeclaration = astDeclarationOrSymbol;\n } else {\n astDeclaration = astDeclarationOrSymbol.astDeclarations[0];\n }\n\n const extractorMessage: ExtractorMessage = this.addAnalyzerIssueForPosition(\n messageId,\n messageText,\n astDeclaration.declaration.getSourceFile(),\n astDeclaration.declaration.getStart(),\n properties\n );\n\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n /**\n * Add all messages produced from an invocation of the TSDoc parser, assuming they refer to\n * code in the specified source file.\n */\n public addTsdocMessages(\n parserContext: tsdoc.ParserContext,\n sourceFile: ts.SourceFile,\n astDeclaration?: AstDeclaration\n ): void {\n for (const message of parserContext.log.messages) {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.TSDoc,\n messageId: message.messageId,\n text: message.unformattedText\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos: message.textRange.pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n if (astDeclaration) {\n this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);\n }\n\n this._messages.push(extractorMessage);\n }\n }\n\n /**\n * Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that\n * is JSON serializable. This is used by the \"--diagnostics\" feature to dump the state of configuration objects.\n *\n * @returns a JSON serializable object (possibly including `null` values)\n * or `undefined` if the input cannot be represented as JSON\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined {\n if (!options) {\n options = {};\n }\n\n const keyNamesToOmit: Set<string> = new Set(options.keyNamesToOmit);\n\n return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _buildJsonDumpObject(input: any, keyNamesToOmit: Set<string>): any | undefined {\n if (input === null || input === undefined) {\n return null; // JSON uses null instead of undefined\n }\n\n switch (typeof input) {\n case 'boolean':\n case 'number':\n case 'string':\n return input;\n case 'object':\n if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outputArray: any[] = [];\n for (const element of input) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedElement: any = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);\n if (serializedElement !== undefined) {\n outputArray.push(serializedElement);\n }\n }\n return outputArray;\n }\n\n const outputObject: object = {};\n for (const key of Object.getOwnPropertyNames(input)) {\n if (keyNamesToOmit.has(key)) {\n continue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value: any = input[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const serializedValue: any = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);\n\n if (serializedValue !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (outputObject as any)[key] = serializedValue;\n }\n }\n return outputObject;\n }\n\n return undefined;\n }\n\n /**\n * Record this message in _associatedMessagesForAstDeclaration\n */\n private _associateMessageWithAstDeclaration(\n extractorMessage: ExtractorMessage,\n astDeclaration: AstDeclaration\n ): void {\n let associatedMessages: ExtractorMessage[] | undefined =\n this._associatedMessagesForAstDeclaration.get(astDeclaration);\n\n if (!associatedMessages) {\n associatedMessages = [];\n this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);\n }\n associatedMessages.push(extractorMessage);\n }\n\n /**\n * Add a message for a location in an arbitrary source file.\n */\n public addAnalyzerIssueForPosition(\n messageId: ExtractorMessageId,\n messageText: string,\n sourceFile: ts.SourceFile,\n pos: number,\n properties?: IExtractorMessageProperties\n ): ExtractorMessage {\n const options: IExtractorMessageOptions = {\n category: ExtractorMessageCategory.Extractor,\n messageId,\n text: messageText,\n properties\n };\n\n const sourceLocation: ISourceLocation = this._sourceMapper.getSourceLocation({\n sourceFile,\n pos\n });\n options.sourceFilePath = sourceLocation.sourceFilePath;\n options.sourceFileLine = sourceLocation.sourceFileLine;\n options.sourceFileColumn = sourceLocation.sourceFileColumn;\n\n const extractorMessage: ExtractorMessage = new ExtractorMessage(options);\n\n this._messages.push(extractorMessage);\n return extractorMessage;\n }\n\n /**\n * This is used when writing the API report file. It looks up any messages that were configured to get emitted\n * in the API report file and returns them. It also records that they were emitted, which suppresses them from\n * being shown on the console.\n */\n public fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n const associatedMessages: ExtractorMessage[] =\n this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];\n for (const associatedMessage of associatedMessages) {\n // Make sure we didn't already report this message for some reason\n if (!associatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(associatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(associatedMessage);\n associatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not\n * retrieved using `fetchAssociatedMessagesForReviewFile()`.\n */\n public fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[] {\n const messagesForApiReportFile: ExtractorMessage[] = [];\n\n for (const unassociatedMessage of this.messages) {\n // Make sure we didn't already report this message for some reason\n if (!unassociatedMessage.handled) {\n // Is this message type configured to go in the API report file?\n const reportingRule: IReportingRule = this._getRuleForMessage(unassociatedMessage);\n if (reportingRule.addToApiReportFile) {\n // Include it in the result, and record that it went to the API report file\n messagesForApiReportFile.push(unassociatedMessage);\n unassociatedMessage.handled = true;\n }\n }\n }\n\n this._sortMessagesForOutput(messagesForApiReportFile);\n return messagesForApiReportFile;\n }\n\n /**\n * This returns the list of remaining messages that were not already processed by\n * `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.\n * These messages will be shown on the console.\n */\n public handleRemainingNonConsoleMessages(): void {\n const messagesForLogger: ExtractorMessage[] = [];\n\n for (const message of this.messages) {\n // Make sure we didn't already report this message\n if (!message.handled) {\n messagesForLogger.push(message);\n }\n }\n\n this._sortMessagesForOutput(messagesForLogger);\n\n for (const message of messagesForLogger) {\n this._handleMessage(message);\n }\n }\n\n public logError(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Error\n })\n );\n }\n\n public logWarning(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Warning\n })\n );\n }\n\n public logInfo(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Info\n })\n );\n }\n\n public logVerbose(\n messageId: ConsoleMessageId,\n message: string,\n properties?: IExtractorMessageProperties\n ): void {\n this._handleMessage(\n new ExtractorMessage({\n category: ExtractorMessageCategory.Console,\n messageId,\n text: message,\n properties,\n logLevel: ExtractorLogLevel.Verbose\n })\n );\n }\n\n public logDiagnosticHeader(title: string): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n this.logDiagnostic(`DIAGNOSTIC: ` + title);\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);\n }\n\n public logDiagnosticFooter(): void {\n this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\\n');\n }\n\n public logDiagnostic(message: string): void {\n if (this.showDiagnostics) {\n this.logVerbose(ConsoleMessageId.Diagnostics, message);\n }\n }\n\n /**\n * Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.\n */\n private _handleMessage(message: ExtractorMessage): void {\n // Don't tally messages that were already \"handled\" by writing them into the API report\n if (message.handled) {\n return;\n }\n\n // Assign the ExtractorMessage.logLevel; the message callback may adjust it below\n if (message.category === ExtractorMessageCategory.Console) {\n // Console messages have their category log level assigned via logInfo(), logVerbose(), etc.\n } else {\n const reportingRule: IReportingRule = this._getRuleForMessage(message);\n message.logLevel = reportingRule.logLevel;\n }\n\n // If there is a callback, allow it to modify and/or handle the message\n if (this._messageCallback) {\n this._messageCallback(message);\n }\n\n // Update the statistics\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n ++this.errorCount;\n break;\n case ExtractorLogLevel.Warning:\n ++this.warningCount;\n break;\n }\n\n if (message.handled) {\n return;\n }\n\n // The messageCallback did not handle the message, so perform default handling\n message.handled = true;\n\n if (message.logLevel === ExtractorLogLevel.None) {\n return;\n }\n\n let messageText: string;\n if (message.category === ExtractorMessageCategory.Console) {\n messageText = message.text;\n } else {\n messageText = message.formatMessageWithLocation(this._workingPackageFolder);\n }\n\n switch (message.logLevel) {\n case ExtractorLogLevel.Error:\n console.error(Colorize.red('Error: ' + messageText));\n break;\n case ExtractorLogLevel.Warning:\n console.warn(Colorize.yellow('Warning: ' + messageText));\n break;\n case ExtractorLogLevel.Info:\n console.log(messageText);\n break;\n case ExtractorLogLevel.Verbose:\n if (this.showVerboseMessages) {\n console.log(Colorize.cyan(messageText));\n }\n break;\n default:\n throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);\n }\n }\n\n /**\n * For a given message, determine the IReportingRule based on the rule tables.\n */\n private _getRuleForMessage(message: ExtractorMessage): IReportingRule {\n const reportingRule: IReportingRule | undefined = this._reportingRuleByMessageId.get(message.messageId);\n if (reportingRule) {\n return reportingRule;\n }\n switch (message.category) {\n case ExtractorMessageCategory.Compiler:\n return this._compilerDefaultRule;\n case ExtractorMessageCategory.Extractor:\n return this._extractorDefaultRule;\n case ExtractorMessageCategory.TSDoc:\n return this._tsdocDefaultRule;\n case ExtractorMessageCategory.Console:\n throw new InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');\n }\n }\n\n /**\n * Sorts an array of messages according to a reasonable ordering\n */\n private _sortMessagesForOutput(messages: ExtractorMessage[]): void {\n messages.sort((a, b) => {\n let diff: number;\n // First sort by file name\n diff = Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by line number\n diff = Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);\n if (diff !== 0) {\n return diff;\n }\n // Then sort by messageId\n return Sort.compareByValue(a.messageId, b.messageId);\n });\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/api-extractor",
3
- "version": "7.53.3",
3
+ "version": "7.54.0",
4
4
  "description": "Analyze the exported API for a TypeScript library and generate reviews, documentation, and .d.ts rollups",
5
5
  "keywords": [
6
6
  "typescript",
@@ -34,6 +34,7 @@
34
34
  "dependencies": {
35
35
  "@microsoft/tsdoc-config": "~0.17.1",
36
36
  "@microsoft/tsdoc": "~0.15.1",
37
+ "diff": "~8.0.2",
37
38
  "lodash": "~4.17.15",
38
39
  "minimatch": "10.0.3",
39
40
  "resolve": "~1.22.1",
@@ -41,13 +42,13 @@
41
42
  "source-map": "~0.6.1",
42
43
  "typescript": "5.8.2",
43
44
  "@microsoft/api-extractor-model": "7.31.3",
44
- "@rushstack/node-core-library": "5.18.0",
45
45
  "@rushstack/rig-package": "0.6.0",
46
+ "@rushstack/node-core-library": "5.18.0",
46
47
  "@rushstack/ts-command-line": "5.1.3",
47
48
  "@rushstack/terminal": "0.19.3"
48
49
  },
49
50
  "devDependencies": {
50
- "@rushstack/heft": "1.1.1",
51
+ "@rushstack/heft": "1.1.3",
51
52
  "@types/lodash": "4.14.116",
52
53
  "@types/resolve": "1.20.2",
53
54
  "@types/semver": "7.5.0",