@microsoft/api-extractor 7.43.7 → 7.44.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/bin/api-extractor +1 -1
- package/dist/rollup.d.ts +97 -7
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/analyzer/AstImport.js.map +1 -1
- package/lib/api/ConsoleMessageId.d.ts +4 -0
- package/lib/api/ConsoleMessageId.d.ts.map +1 -1
- package/lib/api/ConsoleMessageId.js +4 -0
- package/lib/api/ConsoleMessageId.js.map +1 -1
- package/lib/api/Extractor.d.ts +13 -0
- package/lib/api/Extractor.d.ts.map +1 -1
- package/lib/api/Extractor.js +88 -66
- package/lib/api/Extractor.js.map +1 -1
- package/lib/api/ExtractorConfig.d.ts +44 -5
- package/lib/api/ExtractorConfig.d.ts.map +1 -1
- package/lib/api/ExtractorConfig.js +80 -24
- package/lib/api/ExtractorConfig.js.map +1 -1
- package/lib/api/IConfigFile.d.ts +35 -3
- package/lib/api/IConfigFile.d.ts.map +1 -1
- package/lib/api/IConfigFile.js.map +1 -1
- package/lib/generators/ApiReportGenerator.d.ts +8 -1
- package/lib/generators/ApiReportGenerator.d.ts.map +1 -1
- package/lib/generators/ApiReportGenerator.js +53 -20
- package/lib/generators/ApiReportGenerator.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/schemas/api-extractor.schema.json +11 -2
- package/package.json +7 -7
package/bin/api-extractor
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js')
|
|
2
|
+
require('../lib/start.js');
|
package/dist/rollup.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ import type * as tsdoc from '@microsoft/tsdoc';
|
|
|
16
16
|
import { TSDocConfigFile } from '@microsoft/tsdoc-config';
|
|
17
17
|
import { TSDocConfiguration } from '@microsoft/tsdoc';
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The allowed variations of API reports.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare type ApiReportVariant = 'public' | 'beta' | 'alpha' | 'complete';
|
|
25
|
+
|
|
19
26
|
/**
|
|
20
27
|
* This class represents the TypeScript compiler state. This allows an optimization where multiple invocations
|
|
21
28
|
* of API Extractor can reuse the same TypeScript compiler analysis.
|
|
@@ -86,6 +93,10 @@ export declare enum ConsoleMessageId {
|
|
|
86
93
|
* "Writing package typings: ___"
|
|
87
94
|
*/
|
|
88
95
|
WritingDtsRollup = "console-writing-dts-rollup",
|
|
96
|
+
/**
|
|
97
|
+
* "Generating ___ API report: ___"
|
|
98
|
+
*/
|
|
99
|
+
WritingApiReport = "console-writing-api-report",
|
|
89
100
|
/**
|
|
90
101
|
* "You have changed the public API signature for this project.
|
|
91
102
|
* Please copy the file ___ to ___, or perform a local build (which does this automatically).
|
|
@@ -142,12 +153,26 @@ export declare class Extractor {
|
|
|
142
153
|
* Invoke API Extractor using an already prepared `ExtractorConfig` object.
|
|
143
154
|
*/
|
|
144
155
|
static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult;
|
|
156
|
+
/**
|
|
157
|
+
* Generates the API report at the specified release level, writes it to the specified file path, and compares
|
|
158
|
+
* the output to the existing report (if one exists).
|
|
159
|
+
*
|
|
160
|
+
* @param reportTempDirectoryPath - The path to the directory under which the temp report file will be written prior
|
|
161
|
+
* to comparison with an existing report.
|
|
162
|
+
* @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
|
|
163
|
+
* which the new report will be written post-comparison.
|
|
164
|
+
* @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
|
|
165
|
+
*
|
|
166
|
+
* @returns Whether or not the newly generated report differs from the existing report (if one exists).
|
|
167
|
+
*/
|
|
168
|
+
private static _writeApiReport;
|
|
145
169
|
private static _checkCompilerCompatibility;
|
|
146
170
|
private static _generateRollupDtsFile;
|
|
147
171
|
}
|
|
148
172
|
|
|
149
173
|
/**
|
|
150
174
|
* The `ExtractorConfig` class loads, validates, interprets, and represents the api-extractor.json config file.
|
|
175
|
+
* @sealed
|
|
151
176
|
* @public
|
|
152
177
|
*/
|
|
153
178
|
export declare class ExtractorConfig {
|
|
@@ -192,10 +217,27 @@ export declare class ExtractorConfig {
|
|
|
192
217
|
readonly skipLibCheck: boolean;
|
|
193
218
|
/** {@inheritDoc IConfigApiReport.enabled} */
|
|
194
219
|
readonly apiReportEnabled: boolean;
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
220
|
+
/**
|
|
221
|
+
* List of configurations for report files to be generated.
|
|
222
|
+
* @remarks Derived from {@link IConfigApiReport.reportFileName} and {@link IConfigApiReport.reportVariants}.
|
|
223
|
+
*/
|
|
224
|
+
readonly reportConfigs: readonly IExtractorConfigApiReport[];
|
|
225
|
+
/** {@inheritDoc IConfigApiReport.reportFolder} */
|
|
226
|
+
readonly reportFolder: string;
|
|
227
|
+
/** {@inheritDoc IConfigApiReport.reportTempFolder} */
|
|
228
|
+
readonly reportTempFolder: string;
|
|
229
|
+
/**
|
|
230
|
+
* Gets the file path for the "complete" (default) report configuration, if one was specified.
|
|
231
|
+
* Otherwise, returns an empty string.
|
|
232
|
+
* @deprecated Use {@link ExtractorConfig.reportConfigs} to access all report configurations.
|
|
233
|
+
*/
|
|
234
|
+
get reportFilePath(): string;
|
|
235
|
+
/**
|
|
236
|
+
* Gets the temp file path for the "complete" (default) report configuration, if one was specified.
|
|
237
|
+
* Otherwise, returns an empty string.
|
|
238
|
+
* @deprecated Use {@link ExtractorConfig.reportConfigs} to access all report configurations.
|
|
239
|
+
*/
|
|
240
|
+
get reportTempFilePath(): string;
|
|
199
241
|
/** {@inheritDoc IConfigApiReport.includeForgottenExports} */
|
|
200
242
|
readonly apiReportIncludeForgottenExports: boolean;
|
|
201
243
|
/** {@inheritDoc IConfigDocModel.enabled} */
|
|
@@ -302,6 +344,10 @@ export declare class ExtractorConfig {
|
|
|
302
344
|
* loaded from an alternate source, and/or customized after loading.
|
|
303
345
|
*/
|
|
304
346
|
static prepare(options: IExtractorConfigPrepareOptions): ExtractorConfig;
|
|
347
|
+
/**
|
|
348
|
+
* Gets the report configuration for the "complete" (default) report configuration, if one was specified.
|
|
349
|
+
*/
|
|
350
|
+
private _getCompleteReportConfig;
|
|
305
351
|
private static _resolvePathWithTokens;
|
|
306
352
|
private static _expandStringWithTokens;
|
|
307
353
|
/**
|
|
@@ -660,13 +706,39 @@ export declare interface IConfigApiReport {
|
|
|
660
706
|
*/
|
|
661
707
|
enabled: boolean;
|
|
662
708
|
/**
|
|
663
|
-
* The
|
|
664
|
-
* a full output filename.
|
|
709
|
+
* The base component of API report filenames.
|
|
665
710
|
*
|
|
666
711
|
* @remarks
|
|
667
|
-
*
|
|
712
|
+
* It will be combined with the specified {@link IConfigApiReport.reportVariants}, and {@link IConfigApiReport.reportFolder} and {@link IConfigApiReport.reportTempFolder} to
|
|
713
|
+
* produce a full output filenames in the form `<folder><reportFileName>.<variant>.api.md`.
|
|
714
|
+
*
|
|
715
|
+
* The string should not contain a file extension.
|
|
716
|
+
* Note: previous guidance noted that this should be specified in a form including the `.api.md` extension.
|
|
717
|
+
* This is no longer recommended, and support for this will be removed in a future release.
|
|
718
|
+
* For example, if you were previously specifying `Foo.api.md`, you should now specify `Foo`.
|
|
719
|
+
* The `.api.md` extension will be added automatically to the resulting filename.
|
|
720
|
+
*
|
|
721
|
+
* The string must not contain a path separator such as `\` or `/`.
|
|
722
|
+
*
|
|
723
|
+
* @defaultValue `<unscopedPackageName>.api.md` will be used if this argument is not specified or if it is empty.
|
|
668
724
|
*/
|
|
669
725
|
reportFileName?: string;
|
|
726
|
+
/**
|
|
727
|
+
* The set of report variants to generate.
|
|
728
|
+
*
|
|
729
|
+
* @remarks
|
|
730
|
+
* Each variant corresponds to a minimal release level, denoted by release tag in the TSDoc comment for each API item.
|
|
731
|
+
* E.g., the `beta` report variant will include all API items tagged `@beta` or higher (i.e. `@beta` and `@public`).
|
|
732
|
+
*
|
|
733
|
+
* The resulting API report file names will be derived from the {@link IConfigApiReport.reportFileName}.
|
|
734
|
+
* E.g., `foo.beta.api.md`.
|
|
735
|
+
* The only exception to this is the `complete` variant.
|
|
736
|
+
* This variant name will not be contained in the corresponding file name.
|
|
737
|
+
* I.e., `foo.api.md`.
|
|
738
|
+
*
|
|
739
|
+
* @defaultValue `['complete']`
|
|
740
|
+
*/
|
|
741
|
+
reportVariants?: ApiReportVariant[];
|
|
670
742
|
/**
|
|
671
743
|
* Specifies the folder where the API report file is written. The file name portion is determined by
|
|
672
744
|
* the `reportFileName` setting.
|
|
@@ -1052,6 +1124,24 @@ export declare interface IConfigTsdocMetadata {
|
|
|
1052
1124
|
tsdocMetadataFilePath?: string;
|
|
1053
1125
|
}
|
|
1054
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* Configuration for a single API report, including its {@link IExtractorConfigApiReport.variant}.
|
|
1129
|
+
*
|
|
1130
|
+
* @public
|
|
1131
|
+
*/
|
|
1132
|
+
export declare interface IExtractorConfigApiReport {
|
|
1133
|
+
/**
|
|
1134
|
+
* Report variant.
|
|
1135
|
+
* Determines which API items will be included in the report output, based on their tagged release levels.
|
|
1136
|
+
*/
|
|
1137
|
+
variant: ApiReportVariant;
|
|
1138
|
+
/**
|
|
1139
|
+
* Name of the output report file.
|
|
1140
|
+
* @remarks Relative to the configured report directory path.
|
|
1141
|
+
*/
|
|
1142
|
+
fileName: string;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1055
1145
|
/**
|
|
1056
1146
|
* Options for {@link ExtractorConfig.tryLoadForFolder}.
|
|
1057
1147
|
*
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstImport.js","sourceRoot":"","sources":["../../src/analyzer/AstImport.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3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AE,CAAC;YAC3B,KAAK,aAAa,CAAC,aAAa;gBAC9B,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvD,KAAK,aAAa,CAAC,WAAW;gBAC5B,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvD,KAAK,aAAa,CAAC,UAAU;gBAC3B,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC;YACnC,KAAK,aAAa,CAAC,YAAY;gBAC7B,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC;YACnC,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;gBAC9B,MAAM,MAAM,GAAW,CAAC,OAAO,CAAC,UAAU;oBACxC,CAAC,CAAC,GAAG,CAAC,2BAA2B;oBACjC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,+BAA+B;wBAChE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;gBACzB,OAAO,GAAG,OAAO,CAAC,UAAU,IAAI,MAAM,EAAE,CAAC;YAC3C,CAAC;YACD;gBACE,MAAM,IAAI,iCAAa,CAAC,uBAAuB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF;AA3GD,8BA2GC","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 type { AstSymbol } from './AstSymbol';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { AstSyntheticEntity } from './AstEntity';\n\n/**\n * Indicates the import kind for an `AstImport`.\n */\nexport enum AstImportKind {\n /**\n * An import statement such as `import X from \"y\";`.\n */\n DefaultImport,\n\n /**\n * An import statement such as `import { X } from \"y\";`.\n */\n NamedImport,\n\n /**\n * An import statement such as `import * as x from \"y\";`.\n */\n StarImport,\n\n /**\n * An import statement such as `import x = require(\"y\");`.\n */\n EqualsImport,\n\n /**\n * An import statement such as `interface foo { foo: import(\"bar\").a.b.c }`.\n */\n ImportType\n}\n\n/**\n * Constructor parameters for AstImport\n *\n * @privateRemarks\n * Our naming convention is to use I____Parameters for constructor options and\n * I____Options for general function options. However the word \"parameters\" is\n * confusingly similar to the terminology for function parameters modeled by API Extractor,\n * so we use I____Options for both cases in this code base.\n */\nexport interface IAstImportOptions {\n readonly importKind: AstImportKind;\n readonly modulePath: string;\n readonly exportName: string;\n readonly isTypeOnly: boolean;\n}\n\n/**\n * For a symbol that was imported from an external package, this tracks the import\n * statement that was used to reach it.\n */\nexport class AstImport extends AstSyntheticEntity {\n public readonly importKind: AstImportKind;\n\n /**\n * The name of the external package (and possibly module path) that this definition\n * was imported from.\n *\n * Example: \"@rushstack/node-core-library/lib/FileSystem\"\n */\n public readonly modulePath: string;\n\n /**\n * The name of the symbol being imported.\n *\n * @remarks\n *\n * The name depends on the type of import:\n *\n * ```ts\n * // For AstImportKind.DefaultImport style, exportName would be \"X\" in this example:\n * import X from \"y\";\n *\n * // For AstImportKind.NamedImport style, exportName would be \"X\" in this example:\n * import { X } from \"y\";\n *\n * // For AstImportKind.StarImport style, exportName would be \"x\" in this example:\n * import * as x from \"y\";\n *\n * // For AstImportKind.EqualsImport style, exportName would be \"x\" in this example:\n * import x = require(\"y\");\n *\n * // For AstImportKind.ImportType style, exportName would be \"a.b.c\" in this example:\n * interface foo { foo: import('bar').a.b.c };\n * ```\n */\n public readonly exportName: string;\n\n /**\n * Whether it is a type-only import, for example:\n *\n * ```ts\n * import type { X } from \"y\";\n * ```\n *\n * This is set to true ONLY if the type-only form is used in *every* reference to this AstImport.\n */\n public isTypeOnlyEverywhere: boolean;\n\n /**\n * If this import statement refers to an API from an external package that is tracked by API Extractor\n * (according to `PackageMetadataManager.isAedocSupportedFor()`), then this property will return the\n * corresponding AstSymbol. Otherwise, it is undefined.\n */\n public astSymbol: AstSymbol | undefined;\n\n /**\n * If modulePath and exportName are defined, then this is a dictionary key\n * that combines them with a colon (\":\").\n *\n * Example: \"@rushstack/node-core-library/lib/FileSystem:FileSystem\"\n */\n public readonly key: string;\n\n public constructor(options: IAstImportOptions) {\n super();\n\n this.importKind = options.importKind;\n this.modulePath = options.modulePath;\n this.exportName = options.exportName;\n\n // We start with this assumption, but it may get changed later if non-type-only import is encountered.\n this.isTypeOnlyEverywhere = options.isTypeOnly;\n\n this.key = AstImport.getKey(options);\n }\n\n /** {@inheritdoc} */\n public get localName(): string {\n // abstract\n return this.exportName;\n }\n\n /**\n * Calculates the lookup key used with `AstImport.key`\n */\n public static getKey(options: IAstImportOptions): string {\n switch (options.importKind) {\n case AstImportKind.DefaultImport:\n return `${options.modulePath}:${options.exportName}`;\n case AstImportKind.NamedImport:\n return `${options.modulePath}:${options.exportName}`;\n case AstImportKind.StarImport:\n return `${options.modulePath}:*`;\n case AstImportKind.EqualsImport:\n return `${options.modulePath}:=`;\n case AstImportKind.ImportType: {\n const subKey: string = !options.exportName\n ? '*' // Equivalent to StarImport\n : options.exportName.includes('.') // Equivalent to a named export\n ? options.exportName.split('.')[0]\n : options.exportName;\n return `${options.modulePath}:${subKey}`;\n }\n default:\n throw new InternalError('Unknown AstImportKind');\n }\n }\n}\n"]}
|
|
@@ -34,6 +34,10 @@ export declare enum ConsoleMessageId {
|
|
|
34
34
|
* "Writing package typings: ___"
|
|
35
35
|
*/
|
|
36
36
|
WritingDtsRollup = "console-writing-dts-rollup",
|
|
37
|
+
/**
|
|
38
|
+
* "Generating ___ API report: ___"
|
|
39
|
+
*/
|
|
40
|
+
WritingApiReport = "console-writing-api-report",
|
|
37
41
|
/**
|
|
38
42
|
* "You have changed the public API signature for this project.
|
|
39
43
|
* Please copy the file ___ to ___, or perform a local build (which does this automatically).
|
|
@@ -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;;;;;;;;;;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;;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"}
|
|
@@ -40,6 +40,10 @@ var ConsoleMessageId;
|
|
|
40
40
|
* "Writing package typings: ___"
|
|
41
41
|
*/
|
|
42
42
|
ConsoleMessageId["WritingDtsRollup"] = "console-writing-dts-rollup";
|
|
43
|
+
/**
|
|
44
|
+
* "Generating ___ API report: ___"
|
|
45
|
+
*/
|
|
46
|
+
ConsoleMessageId["WritingApiReport"] = "console-writing-api-report";
|
|
43
47
|
/**
|
|
44
48
|
* "You have changed the public API signature for this project.
|
|
45
49
|
* Please copy the file ___ to ___, or perform a local build (which does this automatically).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleMessageId.js","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;GASG;AACH,IAAY,
|
|
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"]}
|
package/lib/api/Extractor.d.ts
CHANGED
|
@@ -124,6 +124,19 @@ export declare class Extractor {
|
|
|
124
124
|
* Invoke API Extractor using an already prepared `ExtractorConfig` object.
|
|
125
125
|
*/
|
|
126
126
|
static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult;
|
|
127
|
+
/**
|
|
128
|
+
* Generates the API report at the specified release level, writes it to the specified file path, and compares
|
|
129
|
+
* the output to the existing report (if one exists).
|
|
130
|
+
*
|
|
131
|
+
* @param reportTempDirectoryPath - The path to the directory under which the temp report file will be written prior
|
|
132
|
+
* to comparison with an existing report.
|
|
133
|
+
* @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
|
|
134
|
+
* which the new report will be written post-comparison.
|
|
135
|
+
* @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
|
|
136
|
+
*
|
|
137
|
+
* @returns Whether or not the newly generated report differs from the existing report (if one exists).
|
|
138
|
+
*/
|
|
139
|
+
private static _writeApiReport;
|
|
127
140
|
private static _checkCompilerCompatibility;
|
|
128
141
|
private static _generateRollupDtsFile;
|
|
129
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAkC,MAAM,mBAAmB,CAAC;AASpF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,SAAgB,aAAa,EAAE,aAAa,CAAC;IAE7C;;OAEG;IACH,SAAgB,eAAe,EAAE,eAAe,CAAC;IAEjD;;;;;;;;;OASG;IACH,SAAgB,SAAS,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAE1C;;;;;OAKG;IACH,SAAgB,UAAU,EAAE,MAAM,CAAC;IAEnC;;;;;OAKG;IACH,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC,gBAAgB;gBACG,UAAU,EAAE,eAAe;CAQ/C;AAED;;;GAGG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,WAAkB,OAAO,IAAI,MAAM,CAElC;IAED;;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;IA6K1G;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA6G9B,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAsC1C,OAAO,CAAC,MAAM,CAAC,sBAAsB;CActC"}
|
package/lib/api/Extractor.js
CHANGED
|
@@ -159,72 +159,13 @@ class Extractor {
|
|
|
159
159
|
testMode: extractorConfig.testMode
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
function writeApiReport(reportConfig) {
|
|
163
|
+
return Extractor._writeApiReport(collector, extractorConfig, messageRouter, extractorConfig.reportTempFolder, extractorConfig.reportFolder, reportConfig, localBuild);
|
|
164
|
+
}
|
|
165
|
+
let anyReportChanged = false;
|
|
163
166
|
if (extractorConfig.apiReportEnabled) {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
const expectedApiReportPath = extractorConfig.reportFilePath;
|
|
167
|
-
const expectedApiReportShortPath = extractorConfig._getShortFilePath(extractorConfig.reportFilePath);
|
|
168
|
-
const actualApiReportContent = ApiReportGenerator_1.ApiReportGenerator.generateReviewFileContent(collector);
|
|
169
|
-
// Write the actual file
|
|
170
|
-
node_core_library_1.FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {
|
|
171
|
-
ensureFolderExists: true,
|
|
172
|
-
convertLineEndings: extractorConfig.newlineKind
|
|
173
|
-
});
|
|
174
|
-
// Compare it against the expected file
|
|
175
|
-
if (node_core_library_1.FileSystem.exists(expectedApiReportPath)) {
|
|
176
|
-
const expectedApiReportContent = node_core_library_1.FileSystem.readFile(expectedApiReportPath);
|
|
177
|
-
if (!ApiReportGenerator_1.ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
|
|
178
|
-
apiReportChanged = true;
|
|
179
|
-
if (!localBuild) {
|
|
180
|
-
// For a production build, issue a warning that will break the CI build.
|
|
181
|
-
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportNotCopied, 'You have changed the public API signature for this project.' +
|
|
182
|
-
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
|
183
|
-
` or perform a local build (which does this automatically).` +
|
|
184
|
-
` See the Git repo documentation for more info.`);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
// For a local build, just copy the file automatically.
|
|
188
|
-
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportCopied, 'You have changed the public API signature for this project.' +
|
|
189
|
-
` Updating ${expectedApiReportShortPath}`);
|
|
190
|
-
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
|
191
|
-
ensureFolderExists: true,
|
|
192
|
-
convertLineEndings: extractorConfig.newlineKind
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.ApiReportUnchanged, `The API report is up to date: ${actualApiReportShortPath}`);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// The target file does not exist, so we are setting up the API review file for the first time.
|
|
202
|
-
//
|
|
203
|
-
// NOTE: People sometimes make a mistake where they move a project and forget to update the "reportFolder"
|
|
204
|
-
// setting, which causes a new file to silently get written to the wrong place. This can be confusing.
|
|
205
|
-
// Thus we treat the initial creation of the file specially.
|
|
206
|
-
apiReportChanged = true;
|
|
207
|
-
if (!localBuild) {
|
|
208
|
-
// For a production build, issue a warning that will break the CI build.
|
|
209
|
-
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportNotCopied, 'The API report file is missing.' +
|
|
210
|
-
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
|
211
|
-
` or perform a local build (which does this automatically).` +
|
|
212
|
-
` See the Git repo documentation for more info.`);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
const expectedApiReportFolder = path.dirname(expectedApiReportPath);
|
|
216
|
-
if (!node_core_library_1.FileSystem.exists(expectedApiReportFolder)) {
|
|
217
|
-
messageRouter.logError(ConsoleMessageId_1.ConsoleMessageId.ApiReportFolderMissing, 'Unable to create the API report file. Please make sure the target folder exists:\n' +
|
|
218
|
-
expectedApiReportFolder);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
|
222
|
-
convertLineEndings: extractorConfig.newlineKind
|
|
223
|
-
});
|
|
224
|
-
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportCreated, 'The API report file was missing, so a new file was created. Please add this file to Git:\n' +
|
|
225
|
-
expectedApiReportPath);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
167
|
+
for (const reportConfig of extractorConfig.reportConfigs) {
|
|
168
|
+
anyReportChanged = writeApiReport(reportConfig) || anyReportChanged;
|
|
228
169
|
}
|
|
229
170
|
}
|
|
230
171
|
if (extractorConfig.rollupEnabled) {
|
|
@@ -253,11 +194,92 @@ class Extractor {
|
|
|
253
194
|
compilerState,
|
|
254
195
|
extractorConfig,
|
|
255
196
|
succeeded,
|
|
256
|
-
apiReportChanged,
|
|
197
|
+
apiReportChanged: anyReportChanged,
|
|
257
198
|
errorCount: messageRouter.errorCount,
|
|
258
199
|
warningCount: messageRouter.warningCount
|
|
259
200
|
});
|
|
260
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Generates the API report at the specified release level, writes it to the specified file path, and compares
|
|
204
|
+
* the output to the existing report (if one exists).
|
|
205
|
+
*
|
|
206
|
+
* @param reportTempDirectoryPath - The path to the directory under which the temp report file will be written prior
|
|
207
|
+
* to comparison with an existing report.
|
|
208
|
+
* @param reportDirectoryPath - The path to the directory under which the existing report file is located, and to
|
|
209
|
+
* which the new report will be written post-comparison.
|
|
210
|
+
* @param reportConfig - API report configuration, including its file name and {@link ApiReportVariant}.
|
|
211
|
+
*
|
|
212
|
+
* @returns Whether or not the newly generated report differs from the existing report (if one exists).
|
|
213
|
+
*/
|
|
214
|
+
static _writeApiReport(collector, extractorConfig, messageRouter, reportTempDirectoryPath, reportDirectoryPath, reportConfig, localBuild) {
|
|
215
|
+
let apiReportChanged = false;
|
|
216
|
+
const actualApiReportPath = path.resolve(reportTempDirectoryPath, reportConfig.fileName);
|
|
217
|
+
const actualApiReportShortPath = extractorConfig._getShortFilePath(actualApiReportPath);
|
|
218
|
+
const expectedApiReportPath = path.resolve(reportDirectoryPath, reportConfig.fileName);
|
|
219
|
+
const expectedApiReportShortPath = extractorConfig._getShortFilePath(expectedApiReportPath);
|
|
220
|
+
collector.messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.WritingApiReport, `Generating ${reportConfig.variant} API report: ${expectedApiReportPath}`);
|
|
221
|
+
const actualApiReportContent = ApiReportGenerator_1.ApiReportGenerator.generateReviewFileContent(collector, reportConfig.variant);
|
|
222
|
+
// Write the actual file
|
|
223
|
+
node_core_library_1.FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {
|
|
224
|
+
ensureFolderExists: true,
|
|
225
|
+
convertLineEndings: extractorConfig.newlineKind
|
|
226
|
+
});
|
|
227
|
+
// Compare it against the expected file
|
|
228
|
+
if (node_core_library_1.FileSystem.exists(expectedApiReportPath)) {
|
|
229
|
+
const expectedApiReportContent = node_core_library_1.FileSystem.readFile(expectedApiReportPath);
|
|
230
|
+
if (!ApiReportGenerator_1.ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
|
|
231
|
+
apiReportChanged = true;
|
|
232
|
+
if (!localBuild) {
|
|
233
|
+
// For a production build, issue a warning that will break the CI build.
|
|
234
|
+
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportNotCopied, 'You have changed the API signature for this project.' +
|
|
235
|
+
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
|
236
|
+
` or perform a local build (which does this automatically).` +
|
|
237
|
+
` See the Git repo documentation for more info.`);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
// For a local build, just copy the file automatically.
|
|
241
|
+
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportCopied, `You have changed the API signature for this project. Updating ${expectedApiReportShortPath}`);
|
|
242
|
+
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
|
243
|
+
ensureFolderExists: true,
|
|
244
|
+
convertLineEndings: extractorConfig.newlineKind
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
messageRouter.logVerbose(ConsoleMessageId_1.ConsoleMessageId.ApiReportUnchanged, `The API report is up to date: ${actualApiReportShortPath}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// The target file does not exist, so we are setting up the API review file for the first time.
|
|
254
|
+
//
|
|
255
|
+
// NOTE: People sometimes make a mistake where they move a project and forget to update the "reportFolder"
|
|
256
|
+
// setting, which causes a new file to silently get written to the wrong place. This can be confusing.
|
|
257
|
+
// Thus we treat the initial creation of the file specially.
|
|
258
|
+
apiReportChanged = true;
|
|
259
|
+
if (!localBuild) {
|
|
260
|
+
// For a production build, issue a warning that will break the CI build.
|
|
261
|
+
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportNotCopied, 'The API report file is missing.' +
|
|
262
|
+
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
|
263
|
+
` or perform a local build (which does this automatically).` +
|
|
264
|
+
` See the Git repo documentation for more info.`);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const expectedApiReportFolder = path.dirname(expectedApiReportPath);
|
|
268
|
+
if (!node_core_library_1.FileSystem.exists(expectedApiReportFolder)) {
|
|
269
|
+
messageRouter.logError(ConsoleMessageId_1.ConsoleMessageId.ApiReportFolderMissing, 'Unable to create the API report file. Please make sure the target folder exists:\n' +
|
|
270
|
+
expectedApiReportFolder);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
|
274
|
+
convertLineEndings: extractorConfig.newlineKind
|
|
275
|
+
});
|
|
276
|
+
messageRouter.logWarning(ConsoleMessageId_1.ConsoleMessageId.ApiReportCreated, 'The API report file was missing, so a new file was created. Please add this file to Git:\n' +
|
|
277
|
+
expectedApiReportPath);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return apiReportChanged;
|
|
282
|
+
}
|
|
261
283
|
static _checkCompilerCompatibility(extractorConfig, messageRouter) {
|
|
262
284
|
messageRouter.logInfo(ConsoleMessageId_1.ConsoleMessageId.Preamble, `Analysis will use the bundled TypeScript version ${ts.version}`);
|
|
263
285
|
try {
|
package/lib/api/Extractor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extractor.js","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,+CAAiC;AACjC,+CAAiC;AACjC,iDAAmC;AACnC,oEAOsC;AAEtC,uDAAoD;AACpD,sDAAmD;AACnD,yEAAqF;AACrF,uEAAoE;AAEpE,yEAAsE;AACtE,+EAA4E;AAC5E,wEAAqE;AACrE,wEAAqE;AACrE,mDAAgD;AAEhD,8DAA2D;AAC3D,yDAAsD;AACtD,0DAA0D;AAC1D,4DAAyD;AA+DzD;;;;GAIG;AACH,MAAa,eAAe;IA4C1B,gBAAgB;IAChB,YAAmB,UAA2B;QAC5C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IAC9C,CAAC;CACF;AArDD,0CAqDC;AAED;;;GAGG;AACH,MAAa,SAAS;IACpB;;OAEG;IACI,MAAM,KAAK,OAAO;QACvB,OAAO,SAAS,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,WA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AC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AAjVD,8BAiVC","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 'path';\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\nimport * as resolve from 'resolve';\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 } from './ExtractorConfig';\nimport { Collector } from '../collector/Collector';\nimport { DtsRollupGenerator, DtsRollupKind } from '../generators/DtsRollupGenerator';\nimport { ApiModelGenerator } from '../generators/ApiModelGenerator';\nimport type { ApiPackage } from '@microsoft/api-extractor-model';\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 { TSDocConfigFile } from '@microsoft/tsdoc-config';\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: 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);\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 (extractorConfig.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 let apiReportChanged: boolean = false;\n\n if (extractorConfig.apiReportEnabled) {\n const actualApiReportPath: string = extractorConfig.reportTempFilePath;\n const actualApiReportShortPath: string = extractorConfig._getShortFilePath(\n extractorConfig.reportTempFilePath\n );\n\n const expectedApiReportPath: string = extractorConfig.reportFilePath;\n const expectedApiReportShortPath: string = extractorConfig._getShortFilePath(\n extractorConfig.reportFilePath\n );\n\n const actualApiReportContent: string = ApiReportGenerator.generateReviewFileContent(collector);\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 public 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 public API signature for this project.' +\n ` 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 }\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,\n errorCount: messageRouter.errorCount,\n warningCount: messageRouter.warningCount\n });\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;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,+CAAiC;AACjC,+CAAiC;AACjC,iDAAmC;AACnC,oEAOsC;AAEtC,uDAAoF;AACpF,sDAAmD;AACnD,yEAAqF;AACrF,uEAAoE;AAEpE,yEAAsE;AACtE,+EAA4E;AAC5E,wEAAqE;AACrE,wEAAqE;AACrE,mDAAgD;AAEhD,8DAA2D;AAC3D,yDAAsD;AACtD,0DAA0D;AAC1D,4DAAyD;AA+DzD;;;;GAIG;AACH,MAAa,eAAe;IA4C1B,gBAAgB;IAChB,YAAmB,UAA2B;QAC5C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;QAC9C,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IAC9C,CAAC;CACF;AArDD,0CAqDC;AAED;;;GAGG;AACH,MAAa,SAAS;IACpB;;OAEG;IACI,MAAM,KAAK,OAAO;QACvB,OAAO,SAAS,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,WAAW;QAC3B,OAAO,SAAS,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC;IAC1C,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,OAAO,qCAAiB,CAAC,kBAAkB,CAAC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,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;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 'path';\nimport * as semver from 'semver';\nimport * as ts from 'typescript';\nimport * as resolve from 'resolve';\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 type { ApiPackage } from '@microsoft/api-extractor-model';\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 { TSDocConfigFile } from '@microsoft/tsdoc-config';\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: 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);\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 (extractorConfig.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"]}
|