init
This commit is contained in:
47
node_modules/@microsoft/api-extractor/lib/api/CompilerState.d.ts
generated
vendored
Normal file
47
node_modules/@microsoft/api-extractor/lib/api/CompilerState.d.ts
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import { ExtractorConfig } from './ExtractorConfig';
|
||||
/**
|
||||
* Options for {@link CompilerState.create}
|
||||
* @public
|
||||
*/
|
||||
export interface ICompilerStateCreateOptions {
|
||||
/** {@inheritDoc IExtractorInvokeOptions.typescriptCompilerFolder} */
|
||||
typescriptCompilerFolder?: string;
|
||||
/**
|
||||
* Additional .d.ts files to include in the analysis.
|
||||
*/
|
||||
additionalEntryPoints?: string[];
|
||||
}
|
||||
/**
|
||||
* This class represents the TypeScript compiler state. This allows an optimization where multiple invocations
|
||||
* of API Extractor can reuse the same TypeScript compiler analysis.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class CompilerState {
|
||||
/**
|
||||
* The TypeScript compiler's `Program` object, which represents a complete scope of analysis.
|
||||
*/
|
||||
readonly program: unknown;
|
||||
private constructor();
|
||||
/**
|
||||
* Create a compiler state for use with the specified `IExtractorInvokeOptions`.
|
||||
*/
|
||||
static create(extractorConfig: ExtractorConfig, options?: ICompilerStateCreateOptions): CompilerState;
|
||||
/**
|
||||
* Given a list of absolute file paths, return a list containing only the declaration
|
||||
* files. Duplicates are also eliminated.
|
||||
*
|
||||
* @remarks
|
||||
* The tsconfig.json settings specify the compiler's input (a set of *.ts source files,
|
||||
* plus some *.d.ts declaration files used for legacy typings). However API Extractor
|
||||
* analyzes the compiler's output (a set of *.d.ts entry point files, plus any legacy
|
||||
* typings). This requires API Extractor to generate a special file list when it invokes
|
||||
* the compiler.
|
||||
*
|
||||
* Duplicates are removed so that entry points can be appended without worrying whether they
|
||||
* may already appear in the tsconfig.json file list.
|
||||
*/
|
||||
private static _generateFilePathsForAnalysis;
|
||||
private static _createCompilerHost;
|
||||
}
|
||||
//# sourceMappingURL=CompilerState.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/CompilerState.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/CompilerState.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"CompilerState.d.ts","sourceRoot":"","sources":["../../src/api/CompilerState.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qEAAqE;IACrE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC,OAAO;IAIP;;OAEG;WACW,MAAM,CAClB,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,2BAA2B,GACpC,aAAa;IA2ChB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,MAAM,CAAC,6BAA6B;IAuB5C,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAwEnC"}
|
168
node_modules/@microsoft/api-extractor/lib/api/CompilerState.js
generated
vendored
Normal file
168
node_modules/@microsoft/api-extractor/lib/api/CompilerState.js
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CompilerState = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const colors = require("colors");
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const ExtractorConfig_1 = require("./ExtractorConfig");
|
||||
/**
|
||||
* This class represents the TypeScript compiler state. This allows an optimization where multiple invocations
|
||||
* of API Extractor can reuse the same TypeScript compiler analysis.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
class CompilerState {
|
||||
constructor(properties) {
|
||||
this.program = properties.program;
|
||||
}
|
||||
/**
|
||||
* Create a compiler state for use with the specified `IExtractorInvokeOptions`.
|
||||
*/
|
||||
static create(extractorConfig, options) {
|
||||
let tsconfig = extractorConfig.overrideTsconfig;
|
||||
let configBasePath = extractorConfig.projectFolder;
|
||||
if (!tsconfig) {
|
||||
// If it wasn't overridden, then load it from disk
|
||||
tsconfig = node_core_library_1.JsonFile.load(extractorConfig.tsconfigFilePath);
|
||||
configBasePath = path.resolve(path.dirname(extractorConfig.tsconfigFilePath));
|
||||
}
|
||||
const commandLine = ts.parseJsonConfigFileContent(tsconfig, ts.sys, configBasePath);
|
||||
if (!commandLine.options.skipLibCheck && extractorConfig.skipLibCheck) {
|
||||
commandLine.options.skipLibCheck = true;
|
||||
console.log(colors.cyan('API Extractor was invoked with skipLibCheck. This is not recommended and may cause ' +
|
||||
'incorrect type analysis.'));
|
||||
}
|
||||
const inputFilePaths = commandLine.fileNames.concat(extractorConfig.mainEntryPointFilePath);
|
||||
if (options && options.additionalEntryPoints) {
|
||||
inputFilePaths.push(...options.additionalEntryPoints);
|
||||
}
|
||||
// Append the entry points and remove any non-declaration files from the list
|
||||
const analysisFilePaths = CompilerState._generateFilePathsForAnalysis(inputFilePaths);
|
||||
const compilerHost = CompilerState._createCompilerHost(commandLine, options);
|
||||
const program = ts.createProgram(analysisFilePaths, commandLine.options, compilerHost);
|
||||
if (commandLine.errors.length > 0) {
|
||||
const errorText = ts.flattenDiagnosticMessageText(commandLine.errors[0].messageText, '\n');
|
||||
throw new Error(`Error parsing tsconfig.json content: ${errorText}`);
|
||||
}
|
||||
return new CompilerState({
|
||||
program
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Given a list of absolute file paths, return a list containing only the declaration
|
||||
* files. Duplicates are also eliminated.
|
||||
*
|
||||
* @remarks
|
||||
* The tsconfig.json settings specify the compiler's input (a set of *.ts source files,
|
||||
* plus some *.d.ts declaration files used for legacy typings). However API Extractor
|
||||
* analyzes the compiler's output (a set of *.d.ts entry point files, plus any legacy
|
||||
* typings). This requires API Extractor to generate a special file list when it invokes
|
||||
* the compiler.
|
||||
*
|
||||
* Duplicates are removed so that entry points can be appended without worrying whether they
|
||||
* may already appear in the tsconfig.json file list.
|
||||
*/
|
||||
static _generateFilePathsForAnalysis(inputFilePaths) {
|
||||
const analysisFilePaths = [];
|
||||
const seenFiles = new Set();
|
||||
for (const inputFilePath of inputFilePaths) {
|
||||
const inputFileToUpper = inputFilePath.toUpperCase();
|
||||
if (!seenFiles.has(inputFileToUpper)) {
|
||||
seenFiles.add(inputFileToUpper);
|
||||
if (!path.isAbsolute(inputFilePath)) {
|
||||
throw new Error('Input file is not an absolute path: ' + inputFilePath);
|
||||
}
|
||||
if (ExtractorConfig_1.ExtractorConfig.hasDtsFileExtension(inputFilePath)) {
|
||||
analysisFilePaths.push(inputFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
return analysisFilePaths;
|
||||
}
|
||||
static _createCompilerHost(commandLine, options) {
|
||||
// Create a default CompilerHost that we will override
|
||||
const compilerHost = ts.createCompilerHost(commandLine.options);
|
||||
// Save a copy of the original members. Note that "compilerHost" cannot be the copy, because
|
||||
// createCompilerHost() captures that instance in a closure that is used by the members.
|
||||
const defaultCompilerHost = Object.assign({}, compilerHost);
|
||||
if (options && options.typescriptCompilerFolder) {
|
||||
// Prevent a closure parameter
|
||||
const typescriptCompilerLibFolder = path.join(options.typescriptCompilerFolder, 'lib');
|
||||
compilerHost.getDefaultLibLocation = () => typescriptCompilerLibFolder;
|
||||
}
|
||||
// Used by compilerHost.fileExists()
|
||||
// .d.ts file path --> whether the file exists
|
||||
const dtsExistsCache = new Map();
|
||||
// Used by compilerHost.fileExists()
|
||||
// Example: "c:/folder/file.part.ts"
|
||||
const fileExtensionRegExp = /^(.+)(\.[a-z0-9_]+)$/i;
|
||||
compilerHost.fileExists = (fileName) => {
|
||||
// In certain deprecated setups, the compiler may write its output files (.js and .d.ts)
|
||||
// in the same folder as the corresponding input file (.ts or .tsx). When following imports,
|
||||
// API Extractor wants to analyze the .d.ts file; however recent versions of the compiler engine
|
||||
// will instead choose the .ts file. To work around this, we hook fileExists() to hide the
|
||||
// existence of those files.
|
||||
// Is "fileName" a .d.ts file? The double extension ".d.ts" needs to be matched specially.
|
||||
if (!ExtractorConfig_1.ExtractorConfig.hasDtsFileExtension(fileName)) {
|
||||
// It's not a .d.ts file. Is the file extension a potential source file?
|
||||
const match = fileExtensionRegExp.exec(fileName);
|
||||
if (match) {
|
||||
// Example: "c:/folder/file.part"
|
||||
const pathWithoutExtension = match[1];
|
||||
// Example: ".ts"
|
||||
const fileExtension = match[2];
|
||||
switch (fileExtension.toLocaleLowerCase()) {
|
||||
case '.ts':
|
||||
case '.tsx':
|
||||
case '.js':
|
||||
case '.jsx':
|
||||
// Yes, this is a possible source file. Is there a corresponding .d.ts file in the same folder?
|
||||
const dtsFileName = `${pathWithoutExtension}.d.ts`;
|
||||
let dtsFileExists = dtsExistsCache.get(dtsFileName);
|
||||
if (dtsFileExists === undefined) {
|
||||
dtsFileExists = defaultCompilerHost.fileExists(dtsFileName);
|
||||
dtsExistsCache.set(dtsFileName, dtsFileExists);
|
||||
}
|
||||
if (dtsFileExists) {
|
||||
// fileName is a potential source file and a corresponding .d.ts file exists.
|
||||
// Thus, API Extractor should ignore this file (so the .d.ts file will get analyzed instead).
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fall through to the default implementation
|
||||
return defaultCompilerHost.fileExists(fileName);
|
||||
};
|
||||
return compilerHost;
|
||||
}
|
||||
}
|
||||
exports.CompilerState = CompilerState;
|
||||
//# sourceMappingURL=CompilerState.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/CompilerState.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/CompilerState.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
70
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.d.ts
generated
vendored
Normal file
70
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.d.ts
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Unique identifiers for console messages reported by API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* These strings are possible values for the {@link ExtractorMessage.messageId} property
|
||||
* when the `ExtractorMessage.category` is {@link ExtractorMessageCategory.Console}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const enum ConsoleMessageId {
|
||||
/**
|
||||
* "Analysis will use the bundled TypeScript version ___"
|
||||
*/
|
||||
Preamble = "console-preamble",
|
||||
/**
|
||||
* "The target project appears to use TypeScript ___ which is newer than the bundled compiler engine;
|
||||
* consider upgrading API Extractor."
|
||||
*/
|
||||
CompilerVersionNotice = "console-compiler-version-notice",
|
||||
/**
|
||||
* "Using custom TSDoc config from ___"
|
||||
*/
|
||||
UsingCustomTSDocConfig = "console-using-custom-tsdoc-config",
|
||||
/**
|
||||
* "Found metadata in ___"
|
||||
*/
|
||||
FoundTSDocMetadata = "console-found-tsdoc-metadata",
|
||||
/**
|
||||
* "Writing: ___"
|
||||
*/
|
||||
WritingDocModelFile = "console-writing-doc-model-file",
|
||||
/**
|
||||
* "Writing package typings: ___"
|
||||
*/
|
||||
WritingDtsRollup = "console-writing-dts-rollup",
|
||||
/**
|
||||
* "You have changed the public API signature for this project.
|
||||
* Please copy the file ___ to ___, or perform a local build (which does this automatically).
|
||||
* See the Git repo documentation for more info."
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* "The API report file is missing.
|
||||
* Please copy the file ___ to ___, or perform a local build (which does this automatically).
|
||||
* See the Git repo documentation for more info."
|
||||
*/
|
||||
ApiReportNotCopied = "console-api-report-not-copied",
|
||||
/**
|
||||
* "You have changed the public API signature for this project. Updating ___"
|
||||
*/
|
||||
ApiReportCopied = "console-api-report-copied",
|
||||
/**
|
||||
* "The API report is up to date: ___"
|
||||
*/
|
||||
ApiReportUnchanged = "console-api-report-unchanged",
|
||||
/**
|
||||
* "The API report file was missing, so a new file was created. Please add this file to Git: ___"
|
||||
*/
|
||||
ApiReportCreated = "console-api-report-created",
|
||||
/**
|
||||
* "Unable to create the API report file. Please make sure the target folder exists: ___"
|
||||
*/
|
||||
ApiReportFolderMissing = "console-api-report-folder-missing",
|
||||
/**
|
||||
* Used for the information printed when the "--diagnostics" flag is enabled.
|
||||
*/
|
||||
Diagnostics = "console-diagnostics"
|
||||
}
|
||||
//# sourceMappingURL=ConsoleMessageId.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ConsoleMessageId.d.ts","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,0BAAkB,gBAAgB;IAChC;;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"}
|
5
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.js
generated
vendored
Normal file
5
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ConsoleMessageId.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ConsoleMessageId.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ConsoleMessageId.js","sourceRoot":"","sources":["../../src/api/ConsoleMessageId.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 const 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 * \"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"]}
|
130
node_modules/@microsoft/api-extractor/lib/api/Extractor.d.ts
generated
vendored
Normal file
130
node_modules/@microsoft/api-extractor/lib/api/Extractor.d.ts
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
import { ExtractorConfig } from './ExtractorConfig';
|
||||
import { CompilerState } from './CompilerState';
|
||||
import type { ExtractorMessage } from './ExtractorMessage';
|
||||
/**
|
||||
* Runtime options for Extractor.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IExtractorInvokeOptions {
|
||||
/**
|
||||
* An optional TypeScript compiler state. This allows an optimization where multiple invocations of API Extractor
|
||||
* can reuse the same TypeScript compiler analysis.
|
||||
*/
|
||||
compilerState?: CompilerState;
|
||||
/**
|
||||
* Indicates that API Extractor is running as part of a local build, e.g. on developer's
|
||||
* machine.
|
||||
*
|
||||
* @remarks
|
||||
* This disables certain validation that would normally be performed for a ship/production build. For example,
|
||||
* the *.api.md report file is automatically updated in a local build.
|
||||
*
|
||||
* The default value is false.
|
||||
*/
|
||||
localBuild?: boolean;
|
||||
/**
|
||||
* If true, API Extractor will include {@link ExtractorLogLevel.Verbose} messages in its output.
|
||||
*/
|
||||
showVerboseMessages?: boolean;
|
||||
/**
|
||||
* If true, API Extractor will print diagnostic information used for troubleshooting problems.
|
||||
* These messages will be included as {@link ExtractorLogLevel.Verbose} output.
|
||||
*
|
||||
* @remarks
|
||||
* Setting `showDiagnostics=true` forces `showVerboseMessages=true`.
|
||||
*/
|
||||
showDiagnostics?: boolean;
|
||||
/**
|
||||
* Specifies an alternate folder path to be used when loading the TypeScript system typings.
|
||||
*
|
||||
* @remarks
|
||||
* API Extractor uses its own TypeScript compiler engine to analyze your project. If your project
|
||||
* is built with a significantly different TypeScript version, sometimes API Extractor may report compilation
|
||||
* errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the "--typescriptCompilerFolder"
|
||||
* option to specify the folder path where you installed the TypeScript package, and API Extractor's compiler will
|
||||
* use those system typings instead.
|
||||
*/
|
||||
typescriptCompilerFolder?: string;
|
||||
/**
|
||||
* An optional callback function that will be called for each `ExtractorMessage` before it is displayed by
|
||||
* API Extractor. The callback can customize the message, handle it, or discard it.
|
||||
*
|
||||
* @remarks
|
||||
* If a `messageCallback` is not provided, then by default API Extractor will print the messages to
|
||||
* the STDERR/STDOUT console.
|
||||
*/
|
||||
messageCallback?: (message: ExtractorMessage) => void;
|
||||
}
|
||||
/**
|
||||
* This object represents the outcome of an invocation of API Extractor.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ExtractorResult {
|
||||
/**
|
||||
* The TypeScript compiler state that was used.
|
||||
*/
|
||||
readonly compilerState: CompilerState;
|
||||
/**
|
||||
* The API Extractor configuration that was used.
|
||||
*/
|
||||
readonly extractorConfig: ExtractorConfig;
|
||||
/**
|
||||
* Whether the invocation of API Extractor was successful. For example, if `succeeded` is false, then the build task
|
||||
* would normally return a nonzero process exit code, indicating that the operation failed.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* Normally the operation "succeeds" if `errorCount` and `warningCount` are both zero. However if
|
||||
* {@link IExtractorInvokeOptions.localBuild} is `true`, then the operation "succeeds" if `errorCount` is zero
|
||||
* (i.e. warnings are ignored).
|
||||
*/
|
||||
readonly succeeded: boolean;
|
||||
/**
|
||||
* Returns true if the API report was found to have changed.
|
||||
*/
|
||||
readonly apiReportChanged: boolean;
|
||||
/**
|
||||
* Reports the number of errors encountered during analysis.
|
||||
*
|
||||
* @remarks
|
||||
* This does not count exceptions, where unexpected issues prematurely abort the operation.
|
||||
*/
|
||||
readonly errorCount: number;
|
||||
/**
|
||||
* Reports the number of warnings encountered during analysis.
|
||||
*
|
||||
* @remarks
|
||||
* This does not count warnings that are emitted in the API report file.
|
||||
*/
|
||||
readonly warningCount: number;
|
||||
/** @internal */
|
||||
constructor(properties: ExtractorResult);
|
||||
}
|
||||
/**
|
||||
* The starting point for invoking the API Extractor tool.
|
||||
* @public
|
||||
*/
|
||||
export declare class Extractor {
|
||||
/**
|
||||
* Returns the version number of the API Extractor NPM package.
|
||||
*/
|
||||
static get version(): string;
|
||||
/**
|
||||
* Returns the package name of the API Extractor NPM package.
|
||||
*/
|
||||
static get packageName(): string;
|
||||
private static _getPackageJson;
|
||||
/**
|
||||
* Load the api-extractor.json config file from the specified path, and then invoke API Extractor.
|
||||
*/
|
||||
static loadConfigAndInvoke(configFilePath: string, options?: IExtractorInvokeOptions): ExtractorResult;
|
||||
/**
|
||||
* Invoke API Extractor using an already prepared `ExtractorConfig` object.
|
||||
*/
|
||||
static invoke(extractorConfig: ExtractorConfig, options?: IExtractorInvokeOptions): ExtractorResult;
|
||||
private static _checkCompilerCompatibility;
|
||||
private static _generateRollupDtsFile;
|
||||
}
|
||||
//# sourceMappingURL=Extractor.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/Extractor.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/Extractor.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Extractor.d.ts","sourceRoot":"","sources":["../../src/api/Extractor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASpD,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;IA2P1G,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAsC1C,OAAO,CAAC,MAAM,CAAC,sBAAsB;CActC"}
|
293
node_modules/@microsoft/api-extractor/lib/api/Extractor.js
generated
vendored
Normal file
293
node_modules/@microsoft/api-extractor/lib/api/Extractor.js
generated
vendored
Normal file
@ -0,0 +1,293 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Extractor = exports.ExtractorResult = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const semver = __importStar(require("semver"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const resolve = __importStar(require("resolve"));
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const ExtractorConfig_1 = require("./ExtractorConfig");
|
||||
const Collector_1 = require("../collector/Collector");
|
||||
const DtsRollupGenerator_1 = require("../generators/DtsRollupGenerator");
|
||||
const ApiModelGenerator_1 = require("../generators/ApiModelGenerator");
|
||||
const ApiReportGenerator_1 = require("../generators/ApiReportGenerator");
|
||||
const PackageMetadataManager_1 = require("../analyzer/PackageMetadataManager");
|
||||
const ValidationEnhancer_1 = require("../enhancers/ValidationEnhancer");
|
||||
const DocCommentEnhancer_1 = require("../enhancers/DocCommentEnhancer");
|
||||
const CompilerState_1 = require("./CompilerState");
|
||||
const MessageRouter_1 = require("../collector/MessageRouter");
|
||||
const tsdoc_config_1 = require("@microsoft/tsdoc-config");
|
||||
const SourceMapper_1 = require("../collector/SourceMapper");
|
||||
/**
|
||||
* This object represents the outcome of an invocation of API Extractor.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
class ExtractorResult {
|
||||
/** @internal */
|
||||
constructor(properties) {
|
||||
this.compilerState = properties.compilerState;
|
||||
this.extractorConfig = properties.extractorConfig;
|
||||
this.succeeded = properties.succeeded;
|
||||
this.apiReportChanged = properties.apiReportChanged;
|
||||
this.errorCount = properties.errorCount;
|
||||
this.warningCount = properties.warningCount;
|
||||
}
|
||||
}
|
||||
exports.ExtractorResult = ExtractorResult;
|
||||
/**
|
||||
* The starting point for invoking the API Extractor tool.
|
||||
* @public
|
||||
*/
|
||||
class Extractor {
|
||||
/**
|
||||
* Returns the version number of the API Extractor NPM package.
|
||||
*/
|
||||
static get version() {
|
||||
return Extractor._getPackageJson().version;
|
||||
}
|
||||
/**
|
||||
* Returns the package name of the API Extractor NPM package.
|
||||
*/
|
||||
static get packageName() {
|
||||
return Extractor._getPackageJson().name;
|
||||
}
|
||||
static _getPackageJson() {
|
||||
return node_core_library_1.PackageJsonLookup.loadOwnPackageJson(__dirname);
|
||||
}
|
||||
/**
|
||||
* Load the api-extractor.json config file from the specified path, and then invoke API Extractor.
|
||||
*/
|
||||
static loadConfigAndInvoke(configFilePath, options) {
|
||||
const extractorConfig = ExtractorConfig_1.ExtractorConfig.loadFileAndPrepare(configFilePath);
|
||||
return Extractor.invoke(extractorConfig, options);
|
||||
}
|
||||
/**
|
||||
* Invoke API Extractor using an already prepared `ExtractorConfig` object.
|
||||
*/
|
||||
static invoke(extractorConfig, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const localBuild = options.localBuild || false;
|
||||
let compilerState;
|
||||
if (options.compilerState) {
|
||||
compilerState = options.compilerState;
|
||||
}
|
||||
else {
|
||||
compilerState = CompilerState_1.CompilerState.create(extractorConfig, options);
|
||||
}
|
||||
const sourceMapper = new SourceMapper_1.SourceMapper();
|
||||
const messageRouter = new MessageRouter_1.MessageRouter({
|
||||
workingPackageFolder: extractorConfig.packageFolder,
|
||||
messageCallback: options.messageCallback,
|
||||
messagesConfig: extractorConfig.messages || {},
|
||||
showVerboseMessages: !!options.showVerboseMessages,
|
||||
showDiagnostics: !!options.showDiagnostics,
|
||||
tsdocConfiguration: extractorConfig.tsdocConfiguration,
|
||||
sourceMapper
|
||||
});
|
||||
if (extractorConfig.tsdocConfigFile.filePath && !extractorConfig.tsdocConfigFile.fileNotFound) {
|
||||
if (!node_core_library_1.Path.isEqual(extractorConfig.tsdocConfigFile.filePath, ExtractorConfig_1.ExtractorConfig._tsdocBaseFilePath)) {
|
||||
messageRouter.logVerbose("console-using-custom-tsdoc-config" /* ConsoleMessageId.UsingCustomTSDocConfig */, 'Using custom TSDoc config from ' + extractorConfig.tsdocConfigFile.filePath);
|
||||
}
|
||||
}
|
||||
this._checkCompilerCompatibility(extractorConfig, messageRouter);
|
||||
if (messageRouter.showDiagnostics) {
|
||||
messageRouter.logDiagnostic('');
|
||||
messageRouter.logDiagnosticHeader('Final prepared ExtractorConfig');
|
||||
messageRouter.logDiagnostic(extractorConfig.getDiagnosticDump());
|
||||
messageRouter.logDiagnosticFooter();
|
||||
messageRouter.logDiagnosticHeader('Compiler options');
|
||||
const serializedCompilerOptions = MessageRouter_1.MessageRouter.buildJsonDumpObject(compilerState.program.getCompilerOptions());
|
||||
messageRouter.logDiagnostic(JSON.stringify(serializedCompilerOptions, undefined, 2));
|
||||
messageRouter.logDiagnosticFooter();
|
||||
messageRouter.logDiagnosticHeader('TSDoc configuration');
|
||||
// Convert the TSDocConfiguration into a tsdoc.json representation
|
||||
const combinedConfigFile = tsdoc_config_1.TSDocConfigFile.loadFromParser(extractorConfig.tsdocConfiguration);
|
||||
const serializedTSDocConfig = MessageRouter_1.MessageRouter.buildJsonDumpObject(combinedConfigFile.saveToObject());
|
||||
messageRouter.logDiagnostic(JSON.stringify(serializedTSDocConfig, undefined, 2));
|
||||
messageRouter.logDiagnosticFooter();
|
||||
}
|
||||
const collector = new Collector_1.Collector({
|
||||
program: compilerState.program,
|
||||
messageRouter,
|
||||
extractorConfig: extractorConfig,
|
||||
sourceMapper
|
||||
});
|
||||
collector.analyze();
|
||||
DocCommentEnhancer_1.DocCommentEnhancer.analyze(collector);
|
||||
ValidationEnhancer_1.ValidationEnhancer.analyze(collector);
|
||||
const modelBuilder = new ApiModelGenerator_1.ApiModelGenerator(collector);
|
||||
const apiPackage = modelBuilder.buildApiPackage();
|
||||
if (messageRouter.showDiagnostics) {
|
||||
messageRouter.logDiagnostic(''); // skip a line after any diagnostic messages
|
||||
}
|
||||
if (extractorConfig.docModelEnabled) {
|
||||
messageRouter.logVerbose("console-writing-doc-model-file" /* ConsoleMessageId.WritingDocModelFile */, 'Writing: ' + extractorConfig.apiJsonFilePath);
|
||||
apiPackage.saveToJsonFile(extractorConfig.apiJsonFilePath, {
|
||||
toolPackage: Extractor.packageName,
|
||||
toolVersion: Extractor.version,
|
||||
newlineConversion: extractorConfig.newlineKind,
|
||||
ensureFolderExists: true,
|
||||
testMode: extractorConfig.testMode
|
||||
});
|
||||
}
|
||||
let apiReportChanged = false;
|
||||
if (extractorConfig.apiReportEnabled) {
|
||||
const actualApiReportPath = extractorConfig.reportTempFilePath;
|
||||
const actualApiReportShortPath = extractorConfig._getShortFilePath(extractorConfig.reportTempFilePath);
|
||||
const expectedApiReportPath = extractorConfig.reportFilePath;
|
||||
const expectedApiReportShortPath = extractorConfig._getShortFilePath(extractorConfig.reportFilePath);
|
||||
const actualApiReportContent = ApiReportGenerator_1.ApiReportGenerator.generateReviewFileContent(collector);
|
||||
// Write the actual file
|
||||
node_core_library_1.FileSystem.writeFile(actualApiReportPath, actualApiReportContent, {
|
||||
ensureFolderExists: true,
|
||||
convertLineEndings: extractorConfig.newlineKind
|
||||
});
|
||||
// Compare it against the expected file
|
||||
if (node_core_library_1.FileSystem.exists(expectedApiReportPath)) {
|
||||
const expectedApiReportContent = node_core_library_1.FileSystem.readFile(expectedApiReportPath);
|
||||
if (!ApiReportGenerator_1.ApiReportGenerator.areEquivalentApiFileContents(actualApiReportContent, expectedApiReportContent)) {
|
||||
apiReportChanged = true;
|
||||
if (!localBuild) {
|
||||
// For a production build, issue a warning that will break the CI build.
|
||||
messageRouter.logWarning("console-api-report-not-copied" /* ConsoleMessageId.ApiReportNotCopied */, 'You have changed the public API signature for this project.' +
|
||||
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
||||
` or perform a local build (which does this automatically).` +
|
||||
` See the Git repo documentation for more info.`);
|
||||
}
|
||||
else {
|
||||
// For a local build, just copy the file automatically.
|
||||
messageRouter.logWarning("console-api-report-copied" /* ConsoleMessageId.ApiReportCopied */, 'You have changed the public API signature for this project.' +
|
||||
` Updating ${expectedApiReportShortPath}`);
|
||||
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
||||
ensureFolderExists: true,
|
||||
convertLineEndings: extractorConfig.newlineKind
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
messageRouter.logVerbose("console-api-report-unchanged" /* ConsoleMessageId.ApiReportUnchanged */, `The API report is up to date: ${actualApiReportShortPath}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// The target file does not exist, so we are setting up the API review file for the first time.
|
||||
//
|
||||
// NOTE: People sometimes make a mistake where they move a project and forget to update the "reportFolder"
|
||||
// setting, which causes a new file to silently get written to the wrong place. This can be confusing.
|
||||
// Thus we treat the initial creation of the file specially.
|
||||
apiReportChanged = true;
|
||||
if (!localBuild) {
|
||||
// For a production build, issue a warning that will break the CI build.
|
||||
messageRouter.logWarning("console-api-report-not-copied" /* ConsoleMessageId.ApiReportNotCopied */, 'The API report file is missing.' +
|
||||
` Please copy the file "${actualApiReportShortPath}" to "${expectedApiReportShortPath}",` +
|
||||
` or perform a local build (which does this automatically).` +
|
||||
` See the Git repo documentation for more info.`);
|
||||
}
|
||||
else {
|
||||
const expectedApiReportFolder = path.dirname(expectedApiReportPath);
|
||||
if (!node_core_library_1.FileSystem.exists(expectedApiReportFolder)) {
|
||||
messageRouter.logError("console-api-report-folder-missing" /* ConsoleMessageId.ApiReportFolderMissing */, 'Unable to create the API report file. Please make sure the target folder exists:\n' +
|
||||
expectedApiReportFolder);
|
||||
}
|
||||
else {
|
||||
node_core_library_1.FileSystem.writeFile(expectedApiReportPath, actualApiReportContent, {
|
||||
convertLineEndings: extractorConfig.newlineKind
|
||||
});
|
||||
messageRouter.logWarning("console-api-report-created" /* ConsoleMessageId.ApiReportCreated */, 'The API report file was missing, so a new file was created. Please add this file to Git:\n' +
|
||||
expectedApiReportPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (extractorConfig.rollupEnabled) {
|
||||
Extractor._generateRollupDtsFile(collector, extractorConfig.publicTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.PublicRelease, extractorConfig.newlineKind);
|
||||
Extractor._generateRollupDtsFile(collector, extractorConfig.alphaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.AlphaRelease, extractorConfig.newlineKind);
|
||||
Extractor._generateRollupDtsFile(collector, extractorConfig.betaTrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.BetaRelease, extractorConfig.newlineKind);
|
||||
Extractor._generateRollupDtsFile(collector, extractorConfig.untrimmedFilePath, DtsRollupGenerator_1.DtsRollupKind.InternalRelease, extractorConfig.newlineKind);
|
||||
}
|
||||
if (extractorConfig.tsdocMetadataEnabled) {
|
||||
// Write the tsdoc-metadata.json file for this project
|
||||
PackageMetadataManager_1.PackageMetadataManager.writeTsdocMetadataFile(extractorConfig.tsdocMetadataFilePath, extractorConfig.newlineKind);
|
||||
}
|
||||
// Show all the messages that we collected during analysis
|
||||
messageRouter.handleRemainingNonConsoleMessages();
|
||||
// Determine success
|
||||
let succeeded;
|
||||
if (localBuild) {
|
||||
// For a local build, fail if there were errors (but ignore warnings)
|
||||
succeeded = messageRouter.errorCount === 0;
|
||||
}
|
||||
else {
|
||||
// For a production build, fail if there were any errors or warnings
|
||||
succeeded = messageRouter.errorCount + messageRouter.warningCount === 0;
|
||||
}
|
||||
return new ExtractorResult({
|
||||
compilerState,
|
||||
extractorConfig,
|
||||
succeeded,
|
||||
apiReportChanged,
|
||||
errorCount: messageRouter.errorCount,
|
||||
warningCount: messageRouter.warningCount
|
||||
});
|
||||
}
|
||||
static _checkCompilerCompatibility(extractorConfig, messageRouter) {
|
||||
messageRouter.logInfo("console-preamble" /* ConsoleMessageId.Preamble */, `Analysis will use the bundled TypeScript version ${ts.version}`);
|
||||
try {
|
||||
const typescriptPath = resolve.sync('typescript', {
|
||||
basedir: extractorConfig.projectFolder,
|
||||
preserveSymlinks: false
|
||||
});
|
||||
const packageJsonLookup = new node_core_library_1.PackageJsonLookup();
|
||||
const packageJson = packageJsonLookup.tryLoadNodePackageJsonFor(typescriptPath);
|
||||
if (packageJson && packageJson.version && semver.valid(packageJson.version)) {
|
||||
// Consider a newer MINOR release to be incompatible
|
||||
const ourMajor = semver.major(ts.version);
|
||||
const ourMinor = semver.minor(ts.version);
|
||||
const theirMajor = semver.major(packageJson.version);
|
||||
const theirMinor = semver.minor(packageJson.version);
|
||||
if (theirMajor > ourMajor || (theirMajor === ourMajor && theirMinor > ourMinor)) {
|
||||
messageRouter.logInfo("console-compiler-version-notice" /* ConsoleMessageId.CompilerVersionNotice */, `*** The target project appears to use TypeScript ${packageJson.version} which is newer than the` +
|
||||
` bundled compiler engine; consider upgrading API Extractor.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// The compiler detection heuristic is not expected to work in many configurations
|
||||
}
|
||||
}
|
||||
static _generateRollupDtsFile(collector, outputPath, dtsKind, newlineKind) {
|
||||
if (outputPath !== '') {
|
||||
collector.messageRouter.logVerbose("console-writing-dts-rollup" /* ConsoleMessageId.WritingDtsRollup */, `Writing package typings: ${outputPath}`);
|
||||
DtsRollupGenerator_1.DtsRollupGenerator.writeTypingsFile(collector, outputPath, dtsKind, newlineKind);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Extractor = Extractor;
|
||||
//# sourceMappingURL=Extractor.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/Extractor.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/Extractor.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
260
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.d.ts
generated
vendored
Normal file
260
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
import { JsonSchema, PackageJsonLookup, type INodePackageJson, NewlineKind } from '@rushstack/node-core-library';
|
||||
import { type IRigConfig } from '@rushstack/rig-package';
|
||||
import type { IConfigFile, IExtractorMessagesConfig } from './IConfigFile';
|
||||
import { EnumMemberOrder } from '@microsoft/api-extractor-model';
|
||||
import { TSDocConfiguration } from '@microsoft/tsdoc';
|
||||
import { TSDocConfigFile } from '@microsoft/tsdoc-config';
|
||||
/**
|
||||
* Options for {@link ExtractorConfig.tryLoadForFolder}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IExtractorConfigLoadForFolderOptions {
|
||||
/**
|
||||
* The folder path to start from when searching for api-extractor.json.
|
||||
*/
|
||||
startingFolder: string;
|
||||
/**
|
||||
* An already constructed `PackageJsonLookup` cache object to use. If omitted, a temporary one will
|
||||
* be constructed.
|
||||
*/
|
||||
packageJsonLookup?: PackageJsonLookup;
|
||||
/**
|
||||
* An already constructed `RigConfig` object. If omitted, then a new `RigConfig` object will be constructed.
|
||||
*/
|
||||
rigConfig?: IRigConfig;
|
||||
}
|
||||
/**
|
||||
* Options for {@link ExtractorConfig.prepare}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IExtractorConfigPrepareOptions {
|
||||
/**
|
||||
* A configuration object as returned by {@link ExtractorConfig.loadFile}.
|
||||
*/
|
||||
configObject: IConfigFile;
|
||||
/**
|
||||
* The absolute path of the file that the `configObject` object was loaded from. This is used for error messages
|
||||
* and when probing for `tsconfig.json`.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* If `configObjectFullPath` and `projectFolderLookupToken` are both unspecified, then the api-extractor.json
|
||||
* config file must explicitly specify a `projectFolder` setting rather than relying on the `<lookup>` token.
|
||||
*/
|
||||
configObjectFullPath: string | undefined;
|
||||
/**
|
||||
* The parsed package.json file for the working package, or undefined if API Extractor was invoked without
|
||||
* a package.json file.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* If omitted, then the `<unscopedPackageName>` and `<packageName>` tokens will have default values.
|
||||
*/
|
||||
packageJson?: INodePackageJson | undefined;
|
||||
/**
|
||||
* The absolute path of the file that the `packageJson` object was loaded from, or undefined if API Extractor
|
||||
* was invoked without a package.json file.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* This is used for error messages and when resolving paths found in package.json.
|
||||
*
|
||||
* If `packageJsonFullPath` is specified but `packageJson` is omitted, the file will be loaded automatically.
|
||||
*/
|
||||
packageJsonFullPath: string | undefined;
|
||||
/**
|
||||
* The default value for the `projectFolder` setting is the `<lookup>` token, which uses a heuristic to guess
|
||||
* an appropriate project folder. Use `projectFolderLookupValue` to manually specify the `<lookup>` token value
|
||||
* instead.
|
||||
*
|
||||
* @remarks
|
||||
* If the `projectFolder` setting is explicitly specified in api-extractor.json file, it should take precedence
|
||||
* over a value specified via the API. Thus the `projectFolderLookupToken` option provides a way to override
|
||||
* the default value for `projectFolder` setting while still honoring a manually specified value.
|
||||
*/
|
||||
projectFolderLookupToken?: string;
|
||||
/**
|
||||
* Allow customization of the tsdoc.json config file. If omitted, this file will be loaded from its default
|
||||
* location. If the file does not exist, then the standard definitions will be used from
|
||||
* `@microsoft/api-extractor/extends/tsdoc-base.json`.
|
||||
*/
|
||||
tsdocConfigFile?: TSDocConfigFile;
|
||||
/**
|
||||
* When preparing the configuration object, folder and file paths referenced in the configuration are checked
|
||||
* for existence, and an error is reported if they are not found. This option can be used to disable this
|
||||
* check for the main entry point module. This may be useful when preparing a configuration file for an
|
||||
* un-built project.
|
||||
*/
|
||||
ignoreMissingEntryPoint?: boolean;
|
||||
}
|
||||
/**
|
||||
* The `ExtractorConfig` class loads, validates, interprets, and represents the api-extractor.json config file.
|
||||
* @public
|
||||
*/
|
||||
export declare class ExtractorConfig {
|
||||
/**
|
||||
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
|
||||
*/
|
||||
static readonly jsonSchema: JsonSchema;
|
||||
/**
|
||||
* The config file name "api-extractor.json".
|
||||
*/
|
||||
static readonly FILENAME: 'api-extractor.json';
|
||||
/**
|
||||
* The full path to `extends/tsdoc-base.json` which contains the standard TSDoc configuration
|
||||
* for API Extractor.
|
||||
* @internal
|
||||
*/
|
||||
static readonly _tsdocBaseFilePath: string;
|
||||
private static readonly _defaultConfig;
|
||||
/** Match all three flavors for type declaration files (.d.ts, .d.mts, .d.cts) */
|
||||
private static readonly _declarationFileExtensionRegExp;
|
||||
/** {@inheritDoc IConfigFile.projectFolder} */
|
||||
readonly projectFolder: string;
|
||||
/**
|
||||
* The parsed package.json file for the working package, or undefined if API Extractor was invoked without
|
||||
* a package.json file.
|
||||
*/
|
||||
readonly packageJson: INodePackageJson | undefined;
|
||||
/**
|
||||
* The absolute path of the folder containing the package.json file for the working package, or undefined
|
||||
* if API Extractor was invoked without a package.json file.
|
||||
*/
|
||||
readonly packageFolder: string | undefined;
|
||||
/** {@inheritDoc IConfigFile.mainEntryPointFilePath} */
|
||||
readonly mainEntryPointFilePath: string;
|
||||
/** {@inheritDoc IConfigFile.bundledPackages} */
|
||||
readonly bundledPackages: string[];
|
||||
/** {@inheritDoc IConfigCompiler.tsconfigFilePath} */
|
||||
readonly tsconfigFilePath: string;
|
||||
/** {@inheritDoc IConfigCompiler.overrideTsconfig} */
|
||||
readonly overrideTsconfig: {} | undefined;
|
||||
/** {@inheritDoc IConfigCompiler.skipLibCheck} */
|
||||
readonly skipLibCheck: boolean;
|
||||
/** {@inheritDoc IConfigApiReport.enabled} */
|
||||
readonly apiReportEnabled: boolean;
|
||||
/** The `reportFolder` path combined with the `reportFileName`. */
|
||||
readonly reportFilePath: string;
|
||||
/** The `reportTempFolder` path combined with the `reportFileName`. */
|
||||
readonly reportTempFilePath: string;
|
||||
/** {@inheritDoc IConfigApiReport.includeForgottenExports} */
|
||||
readonly apiReportIncludeForgottenExports: boolean;
|
||||
/** {@inheritDoc IConfigDocModel.enabled} */
|
||||
readonly docModelEnabled: boolean;
|
||||
/** {@inheritDoc IConfigDocModel.apiJsonFilePath} */
|
||||
readonly apiJsonFilePath: string;
|
||||
/** {@inheritDoc IConfigDocModel.includeForgottenExports} */
|
||||
readonly docModelIncludeForgottenExports: boolean;
|
||||
/** {@inheritDoc IConfigDocModel.projectFolderUrl} */
|
||||
readonly projectFolderUrl: string | undefined;
|
||||
/** {@inheritDoc IConfigDtsRollup.enabled} */
|
||||
readonly rollupEnabled: boolean;
|
||||
/** {@inheritDoc IConfigDtsRollup.untrimmedFilePath} */
|
||||
readonly untrimmedFilePath: string;
|
||||
/** {@inheritDoc IConfigDtsRollup.alphaTrimmedFilePath} */
|
||||
readonly alphaTrimmedFilePath: string;
|
||||
/** {@inheritDoc IConfigDtsRollup.betaTrimmedFilePath} */
|
||||
readonly betaTrimmedFilePath: string;
|
||||
/** {@inheritDoc IConfigDtsRollup.publicTrimmedFilePath} */
|
||||
readonly publicTrimmedFilePath: string;
|
||||
/** {@inheritDoc IConfigDtsRollup.omitTrimmingComments} */
|
||||
readonly omitTrimmingComments: boolean;
|
||||
/** {@inheritDoc IConfigTsdocMetadata.enabled} */
|
||||
readonly tsdocMetadataEnabled: boolean;
|
||||
/** {@inheritDoc IConfigTsdocMetadata.tsdocMetadataFilePath} */
|
||||
readonly tsdocMetadataFilePath: string;
|
||||
/**
|
||||
* The tsdoc.json configuration that will be used when parsing doc comments.
|
||||
*/
|
||||
readonly tsdocConfigFile: TSDocConfigFile;
|
||||
/**
|
||||
* The `TSDocConfiguration` loaded from {@link ExtractorConfig.tsdocConfigFile}.
|
||||
*/
|
||||
readonly tsdocConfiguration: TSDocConfiguration;
|
||||
/**
|
||||
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
|
||||
* will be written with Windows-style newlines.
|
||||
*/
|
||||
readonly newlineKind: NewlineKind;
|
||||
/** {@inheritDoc IConfigFile.messages} */
|
||||
readonly messages: IExtractorMessagesConfig;
|
||||
/** {@inheritDoc IConfigFile.testMode} */
|
||||
readonly testMode: boolean;
|
||||
/** {@inheritDoc IConfigFile.enumMemberOrder} */
|
||||
readonly enumMemberOrder: EnumMemberOrder;
|
||||
private constructor();
|
||||
/**
|
||||
* Returns a JSON-like string representing the `ExtractorConfig` state, which can be printed to a console
|
||||
* for diagnostic purposes.
|
||||
*
|
||||
* @remarks
|
||||
* This is used by the "--diagnostics" command-line option. The string is not intended to be deserialized;
|
||||
* its format may be changed at any time.
|
||||
*/
|
||||
getDiagnosticDump(): string;
|
||||
/**
|
||||
* Returns a simplified file path for use in error messages.
|
||||
* @internal
|
||||
*/
|
||||
_getShortFilePath(absolutePath: string): string;
|
||||
/**
|
||||
* Searches for the api-extractor.json config file associated with the specified starting folder,
|
||||
* and loads the file if found. This lookup supports
|
||||
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig packages}.
|
||||
*
|
||||
* @remarks
|
||||
* The search will first look for a package.json file in a parent folder of the starting folder;
|
||||
* if found, that will be used as the base folder instead of the starting folder. If the config
|
||||
* file is not found in `<baseFolder>/api-extractor.json` or `<baseFolder>/config/api-extractor.json`,
|
||||
* then `<baseFolder/config/rig.json` will be checked to see whether a
|
||||
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig package} is referenced; if so then
|
||||
* the rig's api-extractor.json file will be used instead. If a config file is found, it will be loaded
|
||||
* and returned with the `IExtractorConfigPrepareOptions` object. Otherwise, `undefined` is returned
|
||||
* to indicate that API Extractor does not appear to be configured for the specified folder.
|
||||
*
|
||||
* @returns An options object that can be passed to {@link ExtractorConfig.prepare}, or `undefined`
|
||||
* if not api-extractor.json file was found.
|
||||
*/
|
||||
static tryLoadForFolder(options: IExtractorConfigLoadForFolderOptions): IExtractorConfigPrepareOptions | undefined;
|
||||
/**
|
||||
* Loads the api-extractor.json config file from the specified file path, and prepares an `ExtractorConfig` object.
|
||||
*
|
||||
* @remarks
|
||||
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
||||
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
||||
*
|
||||
* The result is prepared using `ExtractorConfig.prepare()`.
|
||||
*/
|
||||
static loadFileAndPrepare(configJsonFilePath: string): ExtractorConfig;
|
||||
/**
|
||||
* Performs only the first half of {@link ExtractorConfig.loadFileAndPrepare}, providing an opportunity to
|
||||
* modify the object before it is passed to {@link ExtractorConfig.prepare}.
|
||||
*
|
||||
* @remarks
|
||||
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
||||
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
||||
*/
|
||||
static loadFile(jsonFilePath: string): IConfigFile;
|
||||
private static _resolveConfigFileRelativePaths;
|
||||
private static _resolveConfigFileRelativePath;
|
||||
/**
|
||||
* Prepares an `ExtractorConfig` object using a configuration that is provided as a runtime object,
|
||||
* rather than reading it from disk. This allows configurations to be constructed programmatically,
|
||||
* loaded from an alternate source, and/or customized after loading.
|
||||
*/
|
||||
static prepare(options: IExtractorConfigPrepareOptions): ExtractorConfig;
|
||||
private static _resolvePathWithTokens;
|
||||
private static _expandStringWithTokens;
|
||||
/**
|
||||
* Returns true if the specified file path has the ".d.ts" file extension.
|
||||
*/
|
||||
static hasDtsFileExtension(filePath: string): boolean;
|
||||
/**
|
||||
* Given a path string that may have originally contained expandable tokens such as `<projectFolder>"`
|
||||
* this reports an error if any token-looking substrings remain after expansion (e.g. `c:\blah\<invalid>\blah`).
|
||||
*/
|
||||
private static _rejectAnyTokensInPath;
|
||||
}
|
||||
//# sourceMappingURL=ExtractorConfig.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExtractorConfig.d.ts","sourceRoot":"","sources":["../../src/api/ExtractorConfig.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,UAAU,EAEV,iBAAiB,EACjB,KAAK,gBAAgB,EAKrB,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AA8B1D;;;;GAIG;AACH,MAAM,WAAW,oCAAoC;IACnD;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,YAAY,EAAE,WAAW,CAAC;IAE1B;;;;;;;;OAQG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAE3C;;;;;;;;;OASG;IACH,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAmCD;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,gBAAuB,UAAU,EAAE,UAAU,CAAmD;IAEhG;;OAEG;IACH,gBAAuB,QAAQ,EAAE,oBAAoB,CAAwB;IAE7E;;;;OAIG;IACH,gBAAuB,kBAAkB,EAAE,MAAM,CAG/C;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAEpC;IAEF,iFAAiF;IACjF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,+BAA+B,CAA6B;IAEpF,8CAA8C;IAC9C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC;;;OAGG;IACH,SAAgB,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAE1D;;;OAGG;IACH,SAAgB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAElD,uDAAuD;IACvD,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAE/C,gDAAgD;IAChD,SAAgB,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1C,qDAAqD;IACrD,SAAgB,gBAAgB,EAAE,MAAM,CAAC;IAEzC,qDAAqD;IACrD,SAAgB,gBAAgB,EAAE,EAAE,GAAG,SAAS,CAAC;IAEjD,iDAAiD;IACjD,SAAgB,YAAY,EAAE,OAAO,CAAC;IAEtC,6CAA6C;IAC7C,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAE1C,kEAAkE;IAClE,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,sEAAsE;IACtE,SAAgB,kBAAkB,EAAE,MAAM,CAAC;IAC3C,6DAA6D;IAC7D,SAAgB,gCAAgC,EAAE,OAAO,CAAC;IAE1D,4CAA4C;IAC5C,SAAgB,eAAe,EAAE,OAAO,CAAC;IACzC,oDAAoD;IACpD,SAAgB,eAAe,EAAE,MAAM,CAAC;IACxC,4DAA4D;IAC5D,SAAgB,+BAA+B,EAAE,OAAO,CAAC;IACzD,qDAAqD;IACrD,SAAgB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAErD,6CAA6C;IAC7C,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,uDAAuD;IACvD,SAAgB,iBAAiB,EAAE,MAAM,CAAC;IAC1C,0DAA0D;IAC1D,SAAgB,oBAAoB,EAAE,MAAM,CAAC;IAC7C,yDAAyD;IACzD,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,2DAA2D;IAC3D,SAAgB,qBAAqB,EAAE,MAAM,CAAC;IAC9C,0DAA0D;IAC1D,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAE9C,iDAAiD;IACjD,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAC9C,+DAA+D;IAC/D,SAAgB,qBAAqB,EAAE,MAAM,CAAC;IAE9C;;OAEG;IACH,SAAgB,eAAe,EAAE,eAAe,CAAC;IAEjD;;OAEG;IACH,SAAgB,kBAAkB,EAAE,kBAAkB,CAAC;IAEvD;;;OAGG;IACH,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC,yCAAyC;IACzC,SAAgB,QAAQ,EAAE,wBAAwB,CAAC;IAEnD,yCAAyC;IACzC,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAElC,gDAAgD;IAChD,SAAgB,eAAe,EAAE,eAAe,CAAC;IAEjD,OAAO;IAiCP;;;;;;;OAOG;IACI,iBAAiB,IAAI,MAAM;IAiBlC;;;OAGG;IACI,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAUtD;;;;;;;;;;;;;;;;;OAiBG;WACW,gBAAgB,CAC5B,OAAO,EAAE,oCAAoC,GAC5C,8BAA8B,GAAG,SAAS;IA6E7C;;;;;;;;OAQG;WACW,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,eAAe;IAiB7E;;;;;;;OAOG;WACW,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW;IAqEzD,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAmG9C,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAgB7C;;;;OAIG;WACW,OAAO,CAAC,OAAO,EAAE,8BAA8B,GAAG,eAAe;IAmX/E,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAYrC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgCtC;;OAEG;WACW,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI5D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAatC"}
|
678
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js
generated
vendored
Normal file
678
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js
generated
vendored
Normal file
@ -0,0 +1,678 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtractorConfig = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const resolve = __importStar(require("resolve"));
|
||||
const lodash = require("lodash");
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const rig_package_1 = require("@rushstack/rig-package");
|
||||
const PackageMetadataManager_1 = require("../analyzer/PackageMetadataManager");
|
||||
const MessageRouter_1 = require("../collector/MessageRouter");
|
||||
const api_extractor_model_1 = require("@microsoft/api-extractor-model");
|
||||
const tsdoc_1 = require("@microsoft/tsdoc");
|
||||
const tsdoc_config_1 = require("@microsoft/tsdoc-config");
|
||||
const api_extractor_schema_json_1 = __importDefault(require("../schemas/api-extractor.schema.json"));
|
||||
/**
|
||||
* The `ExtractorConfig` class loads, validates, interprets, and represents the api-extractor.json config file.
|
||||
* @public
|
||||
*/
|
||||
class ExtractorConfig {
|
||||
constructor(parameters) {
|
||||
this.projectFolder = parameters.projectFolder;
|
||||
this.packageJson = parameters.packageJson;
|
||||
this.packageFolder = parameters.packageFolder;
|
||||
this.mainEntryPointFilePath = parameters.mainEntryPointFilePath;
|
||||
this.bundledPackages = parameters.bundledPackages;
|
||||
this.tsconfigFilePath = parameters.tsconfigFilePath;
|
||||
this.overrideTsconfig = parameters.overrideTsconfig;
|
||||
this.skipLibCheck = parameters.skipLibCheck;
|
||||
this.apiReportEnabled = parameters.apiReportEnabled;
|
||||
this.reportFilePath = parameters.reportFilePath;
|
||||
this.reportTempFilePath = parameters.reportTempFilePath;
|
||||
this.apiReportIncludeForgottenExports = parameters.apiReportIncludeForgottenExports;
|
||||
this.docModelEnabled = parameters.docModelEnabled;
|
||||
this.apiJsonFilePath = parameters.apiJsonFilePath;
|
||||
this.docModelIncludeForgottenExports = parameters.docModelIncludeForgottenExports;
|
||||
this.projectFolderUrl = parameters.projectFolderUrl;
|
||||
this.rollupEnabled = parameters.rollupEnabled;
|
||||
this.untrimmedFilePath = parameters.untrimmedFilePath;
|
||||
this.alphaTrimmedFilePath = parameters.alphaTrimmedFilePath;
|
||||
this.betaTrimmedFilePath = parameters.betaTrimmedFilePath;
|
||||
this.publicTrimmedFilePath = parameters.publicTrimmedFilePath;
|
||||
this.omitTrimmingComments = parameters.omitTrimmingComments;
|
||||
this.tsdocMetadataEnabled = parameters.tsdocMetadataEnabled;
|
||||
this.tsdocMetadataFilePath = parameters.tsdocMetadataFilePath;
|
||||
this.tsdocConfigFile = parameters.tsdocConfigFile;
|
||||
this.tsdocConfiguration = parameters.tsdocConfiguration;
|
||||
this.newlineKind = parameters.newlineKind;
|
||||
this.messages = parameters.messages;
|
||||
this.testMode = parameters.testMode;
|
||||
this.enumMemberOrder = parameters.enumMemberOrder;
|
||||
}
|
||||
/**
|
||||
* Returns a JSON-like string representing the `ExtractorConfig` state, which can be printed to a console
|
||||
* for diagnostic purposes.
|
||||
*
|
||||
* @remarks
|
||||
* This is used by the "--diagnostics" command-line option. The string is not intended to be deserialized;
|
||||
* its format may be changed at any time.
|
||||
*/
|
||||
getDiagnosticDump() {
|
||||
// Handle the simple JSON-serializable properties using buildJsonDumpObject()
|
||||
const result = MessageRouter_1.MessageRouter.buildJsonDumpObject(this, {
|
||||
keyNamesToOmit: ['tsdocConfigFile', 'tsdocConfiguration']
|
||||
});
|
||||
// Implement custom formatting for tsdocConfigFile and tsdocConfiguration
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
result.tsdocConfigFile = {
|
||||
filePath: this.tsdocConfigFile.filePath,
|
||||
log: this.tsdocConfigFile.log.messages.map((x) => x.toString())
|
||||
};
|
||||
return JSON.stringify(result, undefined, 2);
|
||||
}
|
||||
/**
|
||||
* Returns a simplified file path for use in error messages.
|
||||
* @internal
|
||||
*/
|
||||
_getShortFilePath(absolutePath) {
|
||||
if (!path.isAbsolute(absolutePath)) {
|
||||
throw new node_core_library_1.InternalError('Expected absolute path: ' + absolutePath);
|
||||
}
|
||||
if (node_core_library_1.Path.isUnderOrEqual(absolutePath, this.projectFolder)) {
|
||||
return node_core_library_1.Path.convertToSlashes(path.relative(this.projectFolder, absolutePath));
|
||||
}
|
||||
return absolutePath;
|
||||
}
|
||||
/**
|
||||
* Searches for the api-extractor.json config file associated with the specified starting folder,
|
||||
* and loads the file if found. This lookup supports
|
||||
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig packages}.
|
||||
*
|
||||
* @remarks
|
||||
* The search will first look for a package.json file in a parent folder of the starting folder;
|
||||
* if found, that will be used as the base folder instead of the starting folder. If the config
|
||||
* file is not found in `<baseFolder>/api-extractor.json` or `<baseFolder>/config/api-extractor.json`,
|
||||
* then `<baseFolder/config/rig.json` will be checked to see whether a
|
||||
* {@link https://www.npmjs.com/package/@rushstack/rig-package | rig package} is referenced; if so then
|
||||
* the rig's api-extractor.json file will be used instead. If a config file is found, it will be loaded
|
||||
* and returned with the `IExtractorConfigPrepareOptions` object. Otherwise, `undefined` is returned
|
||||
* to indicate that API Extractor does not appear to be configured for the specified folder.
|
||||
*
|
||||
* @returns An options object that can be passed to {@link ExtractorConfig.prepare}, or `undefined`
|
||||
* if not api-extractor.json file was found.
|
||||
*/
|
||||
static tryLoadForFolder(options) {
|
||||
const packageJsonLookup = options.packageJsonLookup || new node_core_library_1.PackageJsonLookup();
|
||||
const startingFolder = options.startingFolder;
|
||||
// Figure out which project we're in and look for the config file at the project root
|
||||
const packageJsonFullPath = packageJsonLookup.tryGetPackageJsonFilePathFor(startingFolder);
|
||||
const packageFolder = packageJsonFullPath
|
||||
? path.dirname(packageJsonFullPath)
|
||||
: undefined;
|
||||
// If there is no package, then just use the starting folder
|
||||
const baseFolder = packageFolder || startingFolder;
|
||||
let projectFolderLookupToken = undefined;
|
||||
// First try the standard "config" subfolder:
|
||||
let configFilename = path.join(baseFolder, 'config', ExtractorConfig.FILENAME);
|
||||
if (node_core_library_1.FileSystem.exists(configFilename)) {
|
||||
if (node_core_library_1.FileSystem.exists(path.join(baseFolder, ExtractorConfig.FILENAME))) {
|
||||
throw new Error(`Found conflicting ${ExtractorConfig.FILENAME} files in "." and "./config" folders`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Otherwise try the top-level folder
|
||||
configFilename = path.join(baseFolder, ExtractorConfig.FILENAME);
|
||||
if (!node_core_library_1.FileSystem.exists(configFilename)) {
|
||||
// If We didn't find it in <packageFolder>/api-extractor.json or <packageFolder>/config/api-extractor.json
|
||||
// then check for a rig package
|
||||
if (packageFolder) {
|
||||
let rigConfig;
|
||||
if (options.rigConfig) {
|
||||
// The caller provided an already solved RigConfig. Double-check that it is for the right project.
|
||||
if (!node_core_library_1.Path.isEqual(options.rigConfig.projectFolderPath, packageFolder)) {
|
||||
throw new Error('The provided ILoadForFolderOptions.rigConfig is for the wrong project folder:\n' +
|
||||
'\nExpected path: ' +
|
||||
packageFolder +
|
||||
'\nProvided path: ' +
|
||||
options.rigConfig.projectFolderOriginalPath);
|
||||
}
|
||||
rigConfig = options.rigConfig;
|
||||
}
|
||||
else {
|
||||
rigConfig = rig_package_1.RigConfig.loadForProjectFolder({
|
||||
projectFolderPath: packageFolder
|
||||
});
|
||||
}
|
||||
if (rigConfig.rigFound) {
|
||||
configFilename = path.join(rigConfig.getResolvedProfileFolder(), ExtractorConfig.FILENAME);
|
||||
// If the "projectFolder" setting isn't specified in api-extractor.json, it defaults to the
|
||||
// "<lookup>" token which will probe for the tsconfig.json nearest to the api-extractor.json path.
|
||||
// But this won't work if api-extractor.json belongs to the rig. So instead "<lookup>" should be
|
||||
// the "<packageFolder>" that referenced the rig.
|
||||
projectFolderLookupToken = packageFolder;
|
||||
}
|
||||
}
|
||||
if (!node_core_library_1.FileSystem.exists(configFilename)) {
|
||||
// API Extractor does not seem to be configured for this folder
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
const configObjectFullPath = path.resolve(configFilename);
|
||||
const configObject = ExtractorConfig.loadFile(configObjectFullPath);
|
||||
return {
|
||||
configObject,
|
||||
configObjectFullPath,
|
||||
packageJsonFullPath,
|
||||
projectFolderLookupToken
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Loads the api-extractor.json config file from the specified file path, and prepares an `ExtractorConfig` object.
|
||||
*
|
||||
* @remarks
|
||||
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
||||
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
||||
*
|
||||
* The result is prepared using `ExtractorConfig.prepare()`.
|
||||
*/
|
||||
static loadFileAndPrepare(configJsonFilePath) {
|
||||
const configObjectFullPath = path.resolve(configJsonFilePath);
|
||||
const configObject = ExtractorConfig.loadFile(configObjectFullPath);
|
||||
const packageJsonLookup = new node_core_library_1.PackageJsonLookup();
|
||||
const packageJsonFullPath = packageJsonLookup.tryGetPackageJsonFilePathFor(configObjectFullPath);
|
||||
const extractorConfig = ExtractorConfig.prepare({
|
||||
configObject,
|
||||
configObjectFullPath,
|
||||
packageJsonFullPath
|
||||
});
|
||||
return extractorConfig;
|
||||
}
|
||||
/**
|
||||
* Performs only the first half of {@link ExtractorConfig.loadFileAndPrepare}, providing an opportunity to
|
||||
* modify the object before it is passed to {@link ExtractorConfig.prepare}.
|
||||
*
|
||||
* @remarks
|
||||
* Loads the api-extractor.json config file from the specified file path. If the "extends" field is present,
|
||||
* the referenced file(s) will be merged. For any omitted fields, the API Extractor default values are merged.
|
||||
*/
|
||||
static loadFile(jsonFilePath) {
|
||||
// Set to keep track of config files which have been processed.
|
||||
const visitedPaths = new Set();
|
||||
let currentConfigFilePath = path.resolve(jsonFilePath);
|
||||
let configObject = {};
|
||||
try {
|
||||
do {
|
||||
// Check if this file was already processed.
|
||||
if (visitedPaths.has(currentConfigFilePath)) {
|
||||
throw new Error(`The API Extractor "extends" setting contains a cycle.` +
|
||||
` This file is included twice: "${currentConfigFilePath}"`);
|
||||
}
|
||||
visitedPaths.add(currentConfigFilePath);
|
||||
const currentConfigFolderPath = path.dirname(currentConfigFilePath);
|
||||
// Load the extractor config defined in extends property.
|
||||
const baseConfig = node_core_library_1.JsonFile.load(currentConfigFilePath);
|
||||
let extendsField = baseConfig.extends || '';
|
||||
// Delete the "extends" field so it doesn't get merged
|
||||
delete baseConfig.extends;
|
||||
if (extendsField) {
|
||||
if (extendsField.match(/^\.\.?[\\/]/)) {
|
||||
// EXAMPLE: "./subfolder/api-extractor-base.json"
|
||||
extendsField = path.resolve(currentConfigFolderPath, extendsField);
|
||||
}
|
||||
else {
|
||||
// EXAMPLE: "my-package/api-extractor-base.json"
|
||||
//
|
||||
// Resolve "my-package" from the perspective of the current folder.
|
||||
try {
|
||||
extendsField = resolve.sync(extendsField, {
|
||||
basedir: currentConfigFolderPath
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Error resolving NodeJS path "${extendsField}": ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// This step has to be performed in advance, since the currentConfigFolderPath information will be lost
|
||||
// after lodash.merge() is performed.
|
||||
ExtractorConfig._resolveConfigFileRelativePaths(baseConfig, currentConfigFolderPath);
|
||||
// Merge extractorConfig into baseConfig, mutating baseConfig
|
||||
lodash.merge(baseConfig, configObject);
|
||||
configObject = baseConfig;
|
||||
currentConfigFilePath = extendsField;
|
||||
} while (currentConfigFilePath);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Error loading ${currentConfigFilePath}:\n` + e.message);
|
||||
}
|
||||
// Lastly, apply the defaults
|
||||
configObject = lodash.merge(lodash.cloneDeep(ExtractorConfig._defaultConfig), configObject);
|
||||
ExtractorConfig.jsonSchema.validateObject(configObject, jsonFilePath);
|
||||
// The schema validation should ensure that this object conforms to IConfigFile
|
||||
return configObject;
|
||||
}
|
||||
static _resolveConfigFileRelativePaths(configFile, currentConfigFolderPath) {
|
||||
if (configFile.projectFolder) {
|
||||
configFile.projectFolder = ExtractorConfig._resolveConfigFileRelativePath('projectFolder', configFile.projectFolder, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.mainEntryPointFilePath) {
|
||||
configFile.mainEntryPointFilePath = ExtractorConfig._resolveConfigFileRelativePath('mainEntryPointFilePath', configFile.mainEntryPointFilePath, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.compiler) {
|
||||
if (configFile.compiler.tsconfigFilePath) {
|
||||
configFile.compiler.tsconfigFilePath = ExtractorConfig._resolveConfigFileRelativePath('tsconfigFilePath', configFile.compiler.tsconfigFilePath, currentConfigFolderPath);
|
||||
}
|
||||
}
|
||||
if (configFile.apiReport) {
|
||||
if (configFile.apiReport.reportFolder) {
|
||||
configFile.apiReport.reportFolder = ExtractorConfig._resolveConfigFileRelativePath('reportFolder', configFile.apiReport.reportFolder, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.apiReport.reportTempFolder) {
|
||||
configFile.apiReport.reportTempFolder = ExtractorConfig._resolveConfigFileRelativePath('reportTempFolder', configFile.apiReport.reportTempFolder, currentConfigFolderPath);
|
||||
}
|
||||
}
|
||||
if (configFile.docModel) {
|
||||
if (configFile.docModel.apiJsonFilePath) {
|
||||
configFile.docModel.apiJsonFilePath = ExtractorConfig._resolveConfigFileRelativePath('apiJsonFilePath', configFile.docModel.apiJsonFilePath, currentConfigFolderPath);
|
||||
}
|
||||
}
|
||||
if (configFile.dtsRollup) {
|
||||
if (configFile.dtsRollup.untrimmedFilePath) {
|
||||
configFile.dtsRollup.untrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('untrimmedFilePath', configFile.dtsRollup.untrimmedFilePath, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.dtsRollup.alphaTrimmedFilePath) {
|
||||
configFile.dtsRollup.alphaTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('alphaTrimmedFilePath', configFile.dtsRollup.alphaTrimmedFilePath, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.dtsRollup.betaTrimmedFilePath) {
|
||||
configFile.dtsRollup.betaTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('betaTrimmedFilePath', configFile.dtsRollup.betaTrimmedFilePath, currentConfigFolderPath);
|
||||
}
|
||||
if (configFile.dtsRollup.publicTrimmedFilePath) {
|
||||
configFile.dtsRollup.publicTrimmedFilePath = ExtractorConfig._resolveConfigFileRelativePath('publicTrimmedFilePath', configFile.dtsRollup.publicTrimmedFilePath, currentConfigFolderPath);
|
||||
}
|
||||
}
|
||||
if (configFile.tsdocMetadata) {
|
||||
if (configFile.tsdocMetadata.tsdocMetadataFilePath) {
|
||||
configFile.tsdocMetadata.tsdocMetadataFilePath = ExtractorConfig._resolveConfigFileRelativePath('tsdocMetadataFilePath', configFile.tsdocMetadata.tsdocMetadataFilePath, currentConfigFolderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
static _resolveConfigFileRelativePath(fieldName, fieldValue, currentConfigFolderPath) {
|
||||
if (!path.isAbsolute(fieldValue)) {
|
||||
if (fieldValue.indexOf('<projectFolder>') !== 0) {
|
||||
// If the path is not absolute and does not start with "<projectFolder>", then resolve it relative
|
||||
// to the folder of the config file that it appears in
|
||||
return path.join(currentConfigFolderPath, fieldValue);
|
||||
}
|
||||
}
|
||||
return fieldValue;
|
||||
}
|
||||
/**
|
||||
* Prepares an `ExtractorConfig` object using a configuration that is provided as a runtime object,
|
||||
* rather than reading it from disk. This allows configurations to be constructed programmatically,
|
||||
* loaded from an alternate source, and/or customized after loading.
|
||||
*/
|
||||
static prepare(options) {
|
||||
var _a;
|
||||
const filenameForErrors = options.configObjectFullPath || 'the configuration object';
|
||||
const configObject = options.configObject;
|
||||
if (configObject.extends) {
|
||||
throw new Error('The IConfigFile.extends field must be expanded before calling ExtractorConfig.prepare()');
|
||||
}
|
||||
if (options.configObjectFullPath) {
|
||||
if (!path.isAbsolute(options.configObjectFullPath)) {
|
||||
throw new Error('The "configObjectFullPath" setting must be an absolute path');
|
||||
}
|
||||
}
|
||||
ExtractorConfig.jsonSchema.validateObject(configObject, filenameForErrors);
|
||||
const packageJsonFullPath = options.packageJsonFullPath;
|
||||
let packageFolder = undefined;
|
||||
let packageJson = undefined;
|
||||
if (packageJsonFullPath) {
|
||||
if (!/.json$/i.test(packageJsonFullPath)) {
|
||||
// Catch common mistakes e.g. where someone passes a folder path instead of a file path
|
||||
throw new Error('The "packageJsonFullPath" setting does not have a .json file extension');
|
||||
}
|
||||
if (!path.isAbsolute(packageJsonFullPath)) {
|
||||
throw new Error('The "packageJsonFullPath" setting must be an absolute path');
|
||||
}
|
||||
if (options.packageJson) {
|
||||
packageJson = options.packageJson;
|
||||
}
|
||||
else {
|
||||
const packageJsonLookup = new node_core_library_1.PackageJsonLookup();
|
||||
packageJson = packageJsonLookup.loadNodePackageJson(packageJsonFullPath);
|
||||
}
|
||||
packageFolder = path.dirname(packageJsonFullPath);
|
||||
}
|
||||
// "tsdocConfigFile" and "tsdocConfiguration" are prepared outside the try-catch block,
|
||||
// so that if exceptions are thrown, it will not get the "Error parsing api-extractor.json:" header
|
||||
let extractorConfigParameters;
|
||||
try {
|
||||
if (!configObject.compiler) {
|
||||
// A merged configuration should have this
|
||||
throw new Error('The "compiler" section is missing');
|
||||
}
|
||||
if (!configObject.projectFolder) {
|
||||
// A merged configuration should have this
|
||||
throw new Error('The "projectFolder" setting is missing');
|
||||
}
|
||||
let projectFolder;
|
||||
if (configObject.projectFolder.trim() === '<lookup>') {
|
||||
if (options.projectFolderLookupToken) {
|
||||
// Use the manually specified "<lookup>" value
|
||||
projectFolder = options.projectFolderLookupToken;
|
||||
if (!node_core_library_1.FileSystem.exists(options.projectFolderLookupToken)) {
|
||||
throw new Error('The specified "projectFolderLookupToken" path does not exist: ' +
|
||||
options.projectFolderLookupToken);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!options.configObjectFullPath) {
|
||||
throw new Error('The "projectFolder" setting uses the "<lookup>" token, but it cannot be expanded because' +
|
||||
' the "configObjectFullPath" setting was not specified');
|
||||
}
|
||||
// "The default value for `projectFolder` is the token `<lookup>`, which means the folder is determined
|
||||
// by traversing parent folders, starting from the folder containing api-extractor.json, and stopping
|
||||
// at the first folder that contains a tsconfig.json file. If a tsconfig.json file cannot be found in
|
||||
// this way, then an error will be reported."
|
||||
let currentFolder = path.dirname(options.configObjectFullPath);
|
||||
for (;;) {
|
||||
const tsconfigPath = path.join(currentFolder, 'tsconfig.json');
|
||||
if (node_core_library_1.FileSystem.exists(tsconfigPath)) {
|
||||
projectFolder = currentFolder;
|
||||
break;
|
||||
}
|
||||
const parentFolder = path.dirname(currentFolder);
|
||||
if (parentFolder === '' || parentFolder === currentFolder) {
|
||||
throw new Error('The "projectFolder" setting uses the "<lookup>" token, but a tsconfig.json file cannot be' +
|
||||
' found in this folder or any parent folder.');
|
||||
}
|
||||
currentFolder = parentFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ExtractorConfig._rejectAnyTokensInPath(configObject.projectFolder, 'projectFolder');
|
||||
if (!node_core_library_1.FileSystem.exists(configObject.projectFolder)) {
|
||||
throw new Error('The specified "projectFolder" path does not exist: ' + configObject.projectFolder);
|
||||
}
|
||||
projectFolder = configObject.projectFolder;
|
||||
}
|
||||
const tokenContext = {
|
||||
unscopedPackageName: 'unknown-package',
|
||||
packageName: 'unknown-package',
|
||||
projectFolder: projectFolder
|
||||
};
|
||||
if (packageJson) {
|
||||
tokenContext.packageName = packageJson.name;
|
||||
tokenContext.unscopedPackageName = node_core_library_1.PackageName.getUnscopedName(packageJson.name);
|
||||
}
|
||||
if (!configObject.mainEntryPointFilePath) {
|
||||
// A merged configuration should have this
|
||||
throw new Error('The "mainEntryPointFilePath" setting is missing');
|
||||
}
|
||||
const mainEntryPointFilePath = ExtractorConfig._resolvePathWithTokens('mainEntryPointFilePath', configObject.mainEntryPointFilePath, tokenContext);
|
||||
if (!ExtractorConfig.hasDtsFileExtension(mainEntryPointFilePath)) {
|
||||
throw new Error('The "mainEntryPointFilePath" value is not a declaration file: ' + mainEntryPointFilePath);
|
||||
}
|
||||
if (!options.ignoreMissingEntryPoint && !node_core_library_1.FileSystem.exists(mainEntryPointFilePath)) {
|
||||
throw new Error('The "mainEntryPointFilePath" path does not exist: ' + mainEntryPointFilePath);
|
||||
}
|
||||
const bundledPackages = configObject.bundledPackages || [];
|
||||
for (const bundledPackage of bundledPackages) {
|
||||
if (!node_core_library_1.PackageName.isValidName(bundledPackage)) {
|
||||
throw new Error(`The "bundledPackages" list contains an invalid package name: "${bundledPackage}"`);
|
||||
}
|
||||
}
|
||||
const tsconfigFilePath = ExtractorConfig._resolvePathWithTokens('tsconfigFilePath', configObject.compiler.tsconfigFilePath, tokenContext);
|
||||
if (configObject.compiler.overrideTsconfig === undefined) {
|
||||
if (!tsconfigFilePath) {
|
||||
throw new Error('Either the "tsconfigFilePath" or "overrideTsconfig" setting must be specified');
|
||||
}
|
||||
if (!node_core_library_1.FileSystem.exists(tsconfigFilePath)) {
|
||||
throw new Error('The file referenced by "tsconfigFilePath" does not exist: ' + tsconfigFilePath);
|
||||
}
|
||||
}
|
||||
let apiReportEnabled = false;
|
||||
let reportFilePath = '';
|
||||
let reportTempFilePath = '';
|
||||
let apiReportIncludeForgottenExports = false;
|
||||
if (configObject.apiReport) {
|
||||
apiReportEnabled = !!configObject.apiReport.enabled;
|
||||
const reportFilename = ExtractorConfig._expandStringWithTokens('reportFileName', configObject.apiReport.reportFileName || '', tokenContext);
|
||||
if (!reportFilename) {
|
||||
// A merged configuration should have this
|
||||
throw new Error('The "reportFilename" setting is missing');
|
||||
}
|
||||
if (reportFilename.indexOf('/') >= 0 || reportFilename.indexOf('\\') >= 0) {
|
||||
// A merged configuration should have this
|
||||
throw new Error(`The "reportFilename" setting contains invalid characters: "${reportFilename}"`);
|
||||
}
|
||||
const reportFolder = ExtractorConfig._resolvePathWithTokens('reportFolder', configObject.apiReport.reportFolder, tokenContext);
|
||||
const reportTempFolder = ExtractorConfig._resolvePathWithTokens('reportTempFolder', configObject.apiReport.reportTempFolder, tokenContext);
|
||||
reportFilePath = path.join(reportFolder, reportFilename);
|
||||
reportTempFilePath = path.join(reportTempFolder, reportFilename);
|
||||
apiReportIncludeForgottenExports = !!configObject.apiReport.includeForgottenExports;
|
||||
}
|
||||
let docModelEnabled = false;
|
||||
let apiJsonFilePath = '';
|
||||
let docModelIncludeForgottenExports = false;
|
||||
let projectFolderUrl;
|
||||
if (configObject.docModel) {
|
||||
docModelEnabled = !!configObject.docModel.enabled;
|
||||
apiJsonFilePath = ExtractorConfig._resolvePathWithTokens('apiJsonFilePath', configObject.docModel.apiJsonFilePath, tokenContext);
|
||||
docModelIncludeForgottenExports = !!configObject.docModel.includeForgottenExports;
|
||||
projectFolderUrl = configObject.docModel.projectFolderUrl;
|
||||
}
|
||||
let tsdocMetadataEnabled = false;
|
||||
let tsdocMetadataFilePath = '';
|
||||
if (configObject.tsdocMetadata) {
|
||||
tsdocMetadataEnabled = !!configObject.tsdocMetadata.enabled;
|
||||
if (tsdocMetadataEnabled) {
|
||||
tsdocMetadataFilePath = configObject.tsdocMetadata.tsdocMetadataFilePath || '';
|
||||
if (tsdocMetadataFilePath.trim() === '<lookup>') {
|
||||
if (!packageJson) {
|
||||
throw new Error('The "<lookup>" token cannot be used with the "tsdocMetadataFilePath" setting because' +
|
||||
' the "packageJson" option was not provided');
|
||||
}
|
||||
if (!packageJsonFullPath) {
|
||||
throw new Error('The "<lookup>" token cannot be used with "tsdocMetadataFilePath" because' +
|
||||
'the "packageJsonFullPath" option was not provided');
|
||||
}
|
||||
tsdocMetadataFilePath = PackageMetadataManager_1.PackageMetadataManager.resolveTsdocMetadataPath(path.dirname(packageJsonFullPath), packageJson);
|
||||
}
|
||||
else {
|
||||
tsdocMetadataFilePath = ExtractorConfig._resolvePathWithTokens('tsdocMetadataFilePath', configObject.tsdocMetadata.tsdocMetadataFilePath, tokenContext);
|
||||
}
|
||||
if (!tsdocMetadataFilePath) {
|
||||
throw new Error('The "tsdocMetadata.enabled" setting is enabled,' +
|
||||
' but "tsdocMetadataFilePath" is not specified');
|
||||
}
|
||||
}
|
||||
}
|
||||
let rollupEnabled = false;
|
||||
let untrimmedFilePath = '';
|
||||
let betaTrimmedFilePath = '';
|
||||
let alphaTrimmedFilePath = '';
|
||||
let publicTrimmedFilePath = '';
|
||||
let omitTrimmingComments = false;
|
||||
if (configObject.dtsRollup) {
|
||||
rollupEnabled = !!configObject.dtsRollup.enabled;
|
||||
untrimmedFilePath = ExtractorConfig._resolvePathWithTokens('untrimmedFilePath', configObject.dtsRollup.untrimmedFilePath, tokenContext);
|
||||
alphaTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('alphaTrimmedFilePath', configObject.dtsRollup.alphaTrimmedFilePath, tokenContext);
|
||||
betaTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('betaTrimmedFilePath', configObject.dtsRollup.betaTrimmedFilePath, tokenContext);
|
||||
publicTrimmedFilePath = ExtractorConfig._resolvePathWithTokens('publicTrimmedFilePath', configObject.dtsRollup.publicTrimmedFilePath, tokenContext);
|
||||
omitTrimmingComments = !!configObject.dtsRollup.omitTrimmingComments;
|
||||
}
|
||||
let newlineKind;
|
||||
switch (configObject.newlineKind) {
|
||||
case 'lf':
|
||||
newlineKind = node_core_library_1.NewlineKind.Lf;
|
||||
break;
|
||||
case 'os':
|
||||
newlineKind = node_core_library_1.NewlineKind.OsDefault;
|
||||
break;
|
||||
default:
|
||||
newlineKind = node_core_library_1.NewlineKind.CrLf;
|
||||
break;
|
||||
}
|
||||
const enumMemberOrder = (_a = configObject.enumMemberOrder) !== null && _a !== void 0 ? _a : api_extractor_model_1.EnumMemberOrder.ByName;
|
||||
extractorConfigParameters = {
|
||||
projectFolder: projectFolder,
|
||||
packageJson,
|
||||
packageFolder,
|
||||
mainEntryPointFilePath,
|
||||
bundledPackages,
|
||||
tsconfigFilePath,
|
||||
overrideTsconfig: configObject.compiler.overrideTsconfig,
|
||||
skipLibCheck: !!configObject.compiler.skipLibCheck,
|
||||
apiReportEnabled,
|
||||
reportFilePath,
|
||||
reportTempFilePath,
|
||||
apiReportIncludeForgottenExports,
|
||||
docModelEnabled,
|
||||
apiJsonFilePath,
|
||||
docModelIncludeForgottenExports,
|
||||
projectFolderUrl,
|
||||
rollupEnabled,
|
||||
untrimmedFilePath,
|
||||
alphaTrimmedFilePath,
|
||||
betaTrimmedFilePath,
|
||||
publicTrimmedFilePath,
|
||||
omitTrimmingComments,
|
||||
tsdocMetadataEnabled,
|
||||
tsdocMetadataFilePath,
|
||||
newlineKind,
|
||||
messages: configObject.messages || {},
|
||||
testMode: !!configObject.testMode,
|
||||
enumMemberOrder
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Error parsing ${filenameForErrors}:\n` + e.message);
|
||||
}
|
||||
let tsdocConfigFile = options.tsdocConfigFile;
|
||||
if (!tsdocConfigFile) {
|
||||
// Example: "my-project/tsdoc.json"
|
||||
let packageTSDocConfigPath = tsdoc_config_1.TSDocConfigFile.findConfigPathForFolder(extractorConfigParameters.projectFolder);
|
||||
if (!packageTSDocConfigPath || !node_core_library_1.FileSystem.exists(packageTSDocConfigPath)) {
|
||||
// If the project does not have a tsdoc.json config file, then use API Extractor's base file.
|
||||
packageTSDocConfigPath = ExtractorConfig._tsdocBaseFilePath;
|
||||
if (!node_core_library_1.FileSystem.exists(packageTSDocConfigPath)) {
|
||||
throw new node_core_library_1.InternalError('Unable to load the built-in TSDoc config file: ' + packageTSDocConfigPath);
|
||||
}
|
||||
}
|
||||
tsdocConfigFile = tsdoc_config_1.TSDocConfigFile.loadFile(packageTSDocConfigPath);
|
||||
}
|
||||
// IMPORTANT: After calling TSDocConfigFile.loadFile(), we need to check for errors.
|
||||
if (tsdocConfigFile.hasErrors) {
|
||||
throw new Error(tsdocConfigFile.getErrorSummary());
|
||||
}
|
||||
const tsdocConfiguration = new tsdoc_1.TSDocConfiguration();
|
||||
tsdocConfigFile.configureParser(tsdocConfiguration);
|
||||
// IMPORTANT: After calling TSDocConfigFile.configureParser(), we need to check for errors a second time.
|
||||
if (tsdocConfigFile.hasErrors) {
|
||||
throw new Error(tsdocConfigFile.getErrorSummary());
|
||||
}
|
||||
return new ExtractorConfig(Object.assign(Object.assign({}, extractorConfigParameters), { tsdocConfigFile, tsdocConfiguration }));
|
||||
}
|
||||
static _resolvePathWithTokens(fieldName, value, tokenContext) {
|
||||
value = ExtractorConfig._expandStringWithTokens(fieldName, value, tokenContext);
|
||||
if (value !== '') {
|
||||
value = path.resolve(tokenContext.projectFolder, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
static _expandStringWithTokens(fieldName, value, tokenContext) {
|
||||
value = value ? value.trim() : '';
|
||||
if (value !== '') {
|
||||
value = node_core_library_1.Text.replaceAll(value, '<unscopedPackageName>', tokenContext.unscopedPackageName);
|
||||
value = node_core_library_1.Text.replaceAll(value, '<packageName>', tokenContext.packageName);
|
||||
const projectFolderToken = '<projectFolder>';
|
||||
if (value.indexOf(projectFolderToken) === 0) {
|
||||
// Replace "<projectFolder>" at the start of a string
|
||||
value = path.join(tokenContext.projectFolder, value.substr(projectFolderToken.length));
|
||||
}
|
||||
if (value.indexOf(projectFolderToken) >= 0) {
|
||||
// If after all replacements, "<projectFolder>" appears somewhere in the string, report an error
|
||||
throw new Error(`The "${fieldName}" value incorrectly uses the "<projectFolder>" token.` +
|
||||
` It must appear at the start of the string.`);
|
||||
}
|
||||
if (value.indexOf('<lookup>') >= 0) {
|
||||
throw new Error(`The "${fieldName}" value incorrectly uses the "<lookup>" token`);
|
||||
}
|
||||
ExtractorConfig._rejectAnyTokensInPath(value, fieldName);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Returns true if the specified file path has the ".d.ts" file extension.
|
||||
*/
|
||||
static hasDtsFileExtension(filePath) {
|
||||
return ExtractorConfig._declarationFileExtensionRegExp.test(filePath);
|
||||
}
|
||||
/**
|
||||
* Given a path string that may have originally contained expandable tokens such as `<projectFolder>"`
|
||||
* this reports an error if any token-looking substrings remain after expansion (e.g. `c:\blah\<invalid>\blah`).
|
||||
*/
|
||||
static _rejectAnyTokensInPath(value, fieldName) {
|
||||
if (value.indexOf('<') < 0 && value.indexOf('>') < 0) {
|
||||
return;
|
||||
}
|
||||
// Can we determine the name of a token?
|
||||
const tokenRegExp = /(\<[^<]*?\>)/;
|
||||
const match = tokenRegExp.exec(value);
|
||||
if (match) {
|
||||
throw new Error(`The "${fieldName}" value contains an unrecognized token "${match[1]}"`);
|
||||
}
|
||||
throw new Error(`The "${fieldName}" value contains extra token characters ("<" or ">"): ${value}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The JSON Schema for API Extractor config file (api-extractor.schema.json).
|
||||
*/
|
||||
ExtractorConfig.jsonSchema = node_core_library_1.JsonSchema.fromLoadedObject(api_extractor_schema_json_1.default);
|
||||
/**
|
||||
* The config file name "api-extractor.json".
|
||||
*/
|
||||
ExtractorConfig.FILENAME = 'api-extractor.json';
|
||||
/**
|
||||
* The full path to `extends/tsdoc-base.json` which contains the standard TSDoc configuration
|
||||
* for API Extractor.
|
||||
* @internal
|
||||
*/
|
||||
ExtractorConfig._tsdocBaseFilePath = path.resolve(__dirname, '../../extends/tsdoc-base.json');
|
||||
ExtractorConfig._defaultConfig = node_core_library_1.JsonFile.load(path.join(__dirname, '../schemas/api-extractor-defaults.json'));
|
||||
/** Match all three flavors for type declaration files (.d.ts, .d.mts, .d.cts) */
|
||||
ExtractorConfig._declarationFileExtensionRegExp = /\.d\.(c|m)?ts$/i;
|
||||
exports.ExtractorConfig = ExtractorConfig;
|
||||
//# sourceMappingURL=ExtractorConfig.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.d.ts
generated
vendored
Normal file
43
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Used with {@link IConfigMessageReportingRule.logLevel} and {@link IExtractorInvokeOptions.messageCallback}.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const enum ExtractorLogLevel {
|
||||
/**
|
||||
* The message will be displayed as an error.
|
||||
*
|
||||
* @remarks
|
||||
* Errors typically cause the build to fail and return a nonzero exit code.
|
||||
*/
|
||||
Error = "error",
|
||||
/**
|
||||
* The message will be displayed as an warning.
|
||||
*
|
||||
* @remarks
|
||||
* Warnings typically cause a production build fail and return a nonzero exit code. For a non-production build
|
||||
* (e.g. using the `--local` option with `api-extractor run`), the warning is displayed but the build will not fail.
|
||||
*/
|
||||
Warning = "warning",
|
||||
/**
|
||||
* The message will be displayed as an informational message.
|
||||
*
|
||||
* @remarks
|
||||
* Informational messages may contain newlines to ensure nice formatting of the output,
|
||||
* however word-wrapping is the responsibility of the message handler.
|
||||
*/
|
||||
Info = "info",
|
||||
/**
|
||||
* The message will be displayed only when "verbose" output is requested, e.g. using the `--verbose`
|
||||
* command line option.
|
||||
*/
|
||||
Verbose = "verbose",
|
||||
/**
|
||||
* The message will be discarded entirely.
|
||||
*/
|
||||
None = "none"
|
||||
}
|
||||
//# sourceMappingURL=ExtractorLogLevel.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExtractorLogLevel.d.ts","sourceRoot":"","sources":["../../src/api/ExtractorLogLevel.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,0BAAkB,iBAAiB;IACjC;;;;;OAKG;IACH,KAAK,UAAU;IAEf;;;;;;OAMG;IACH,OAAO,YAAY;IAEnB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;OAGG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,IAAI,SAAS;CACd"}
|
5
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.js
generated
vendored
Normal file
5
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ExtractorLogLevel.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorLogLevel.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExtractorLogLevel.js","sourceRoot":"","sources":["../../src/api/ExtractorLogLevel.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 * Used with {@link IConfigMessageReportingRule.logLevel} and {@link IExtractorInvokeOptions.messageCallback}.\n *\n * @remarks\n * This is part of the {@link IConfigFile} structure.\n *\n * @public\n */\nexport const enum ExtractorLogLevel {\n /**\n * The message will be displayed as an error.\n *\n * @remarks\n * Errors typically cause the build to fail and return a nonzero exit code.\n */\n Error = 'error',\n\n /**\n * The message will be displayed as an warning.\n *\n * @remarks\n * Warnings typically cause a production build fail and return a nonzero exit code. For a non-production build\n * (e.g. using the `--local` option with `api-extractor run`), the warning is displayed but the build will not fail.\n */\n Warning = 'warning',\n\n /**\n * The message will be displayed as an informational message.\n *\n * @remarks\n * Informational messages may contain newlines to ensure nice formatting of the output,\n * however word-wrapping is the responsibility of the message handler.\n */\n Info = 'info',\n\n /**\n * The message will be displayed only when \"verbose\" output is requested, e.g. using the `--verbose`\n * command line option.\n */\n Verbose = 'verbose',\n\n /**\n * The message will be discarded entirely.\n */\n None = 'none'\n}\n"]}
|
155
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.d.ts
generated
vendored
Normal file
155
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.d.ts
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
import type * as tsdoc from '@microsoft/tsdoc';
|
||||
import type { ExtractorMessageId } from './ExtractorMessageId';
|
||||
import { ExtractorLogLevel } from './ExtractorLogLevel';
|
||||
import type { ConsoleMessageId } from './ConsoleMessageId';
|
||||
/**
|
||||
* Used by {@link ExtractorMessage.properties}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IExtractorMessageProperties {
|
||||
/**
|
||||
* A declaration can have multiple names if it is exported more than once.
|
||||
* If an `ExtractorMessage` applies to a specific export name, this property can indicate that.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* Used by {@link ExtractorMessageId.InternalMissingUnderscore}.
|
||||
*/
|
||||
readonly exportName?: string;
|
||||
}
|
||||
/**
|
||||
* Specifies a category of messages for use with {@link ExtractorMessage}.
|
||||
* @public
|
||||
*/
|
||||
export declare const enum ExtractorMessageCategory {
|
||||
/**
|
||||
* Messages originating from the TypeScript compiler.
|
||||
*
|
||||
* @remarks
|
||||
* These strings begin with the prefix "TS" and have a numeric error code.
|
||||
* Example: `TS2551`
|
||||
*/
|
||||
Compiler = "Compiler",
|
||||
/**
|
||||
* Messages related to parsing of TSDoc comments.
|
||||
*
|
||||
* @remarks
|
||||
* These strings begin with the prefix "tsdoc-".
|
||||
* Example: `tsdoc-link-tag-unescaped-text`
|
||||
*/
|
||||
TSDoc = "TSDoc",
|
||||
/**
|
||||
* Messages related to API Extractor's analysis.
|
||||
*
|
||||
* @remarks
|
||||
* These strings begin with the prefix "ae-".
|
||||
* Example: `ae-extra-release-tag`
|
||||
*/
|
||||
Extractor = "Extractor",
|
||||
/**
|
||||
* Console messages communicate the progress of the overall operation. They may include newlines to ensure
|
||||
* nice formatting. They are output in real time, and cannot be routed to the API Report file.
|
||||
*
|
||||
* @remarks
|
||||
* These strings begin with the prefix "console-".
|
||||
* Example: `console-writing-typings-file`
|
||||
*/
|
||||
Console = "console"
|
||||
}
|
||||
/**
|
||||
* Constructor options for `ExtractorMessage`.
|
||||
*/
|
||||
export interface IExtractorMessageOptions {
|
||||
category: ExtractorMessageCategory;
|
||||
messageId: tsdoc.TSDocMessageId | ExtractorMessageId | ConsoleMessageId | string;
|
||||
text: string;
|
||||
sourceFilePath?: string;
|
||||
sourceFileLine?: number;
|
||||
sourceFileColumn?: number;
|
||||
properties?: IExtractorMessageProperties;
|
||||
logLevel?: ExtractorLogLevel;
|
||||
}
|
||||
/**
|
||||
* This object is used to report an error or warning that occurred during API Extractor's analysis.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class ExtractorMessage {
|
||||
private _handled;
|
||||
private _logLevel;
|
||||
/**
|
||||
* The category of issue.
|
||||
*/
|
||||
readonly category: ExtractorMessageCategory;
|
||||
/**
|
||||
* A text string that uniquely identifies the issue type. This identifier can be used to suppress
|
||||
* or configure the reporting of issues, and also to search for help about an issue.
|
||||
*/
|
||||
readonly messageId: tsdoc.TSDocMessageId | ExtractorMessageId | ConsoleMessageId | string;
|
||||
/**
|
||||
* The text description of this issue.
|
||||
*/
|
||||
readonly text: string;
|
||||
/**
|
||||
* The absolute path to the affected input source file, if there is one.
|
||||
*/
|
||||
readonly sourceFilePath: string | undefined;
|
||||
/**
|
||||
* The line number where the issue occurred in the input source file. This is not used if `sourceFilePath`
|
||||
* is undefined. The first line number is 1.
|
||||
*/
|
||||
readonly sourceFileLine: number | undefined;
|
||||
/**
|
||||
* The column number where the issue occurred in the input source file. This is not used if `sourceFilePath`
|
||||
* is undefined. The first column number is 1.
|
||||
*/
|
||||
readonly sourceFileColumn: number | undefined;
|
||||
/**
|
||||
* Additional contextual information about the message that may be useful when reporting errors.
|
||||
* All properties are optional.
|
||||
*/
|
||||
readonly properties: IExtractorMessageProperties;
|
||||
/** @internal */
|
||||
constructor(options: IExtractorMessageOptions);
|
||||
/**
|
||||
* If the {@link IExtractorInvokeOptions.messageCallback} sets this property to true, it will prevent the message
|
||||
* from being displayed by API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* If the `messageCallback` routes the message to a custom handler (e.g. a toolchain logger), it should
|
||||
* assign `handled = true` to prevent API Extractor from displaying it. Assigning `handled = true` for all messages
|
||||
* would effectively disable all console output from the `Extractor` API.
|
||||
*
|
||||
* If `handled` is set to true, the message will still be included in the count of errors/warnings;
|
||||
* to discard a message entirely, instead assign `logLevel = none`.
|
||||
*/
|
||||
get handled(): boolean;
|
||||
set handled(value: boolean);
|
||||
/**
|
||||
* Specifies how the message should be reported.
|
||||
*
|
||||
* @remarks
|
||||
* If the {@link IExtractorInvokeOptions.messageCallback} handles the message (i.e. sets `handled = true`),
|
||||
* it can use the `logLevel` to determine how to display the message.
|
||||
*
|
||||
* Alternatively, if API Extractor is handling the message, the `messageCallback` could assign `logLevel` to change
|
||||
* how it will be processed. However, in general the recommended practice is to configure message routing
|
||||
* using the `messages` section in api-extractor.json.
|
||||
*
|
||||
* To discard a message entirely, assign `logLevel = none`.
|
||||
*/
|
||||
get logLevel(): ExtractorLogLevel;
|
||||
set logLevel(value: ExtractorLogLevel);
|
||||
/**
|
||||
* Returns the message formatted with its identifier and file position.
|
||||
* @remarks
|
||||
* Example:
|
||||
* ```
|
||||
* src/folder/File.ts:123:4 - (ae-extra-release-tag) The doc comment should not contain more than one release tag.
|
||||
* ```
|
||||
*/
|
||||
formatMessageWithLocation(workingPackageFolderPath: string | undefined): string;
|
||||
formatMessageWithoutLocation(): string;
|
||||
}
|
||||
//# sourceMappingURL=ExtractorMessage.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExtractorMessage.d.ts","sourceRoot":"","sources":["../../src/api/ExtractorMessage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,0BAAkB,wBAAwB;IACxC;;;;;;OAMG;IACH,QAAQ,aAAa;IAErB;;;;;;OAMG;IACH,KAAK,UAAU;IAEf;;;;;;OAMG;IACH,SAAS,cAAc;IAEvB;;;;;;;OAOG;IACH,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,SAAS,EAAE,KAAK,CAAC,cAAc,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,MAAM,CAAC;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,SAAS,CAAoB;IAErC;;OAEG;IACH,SAAgB,QAAQ,EAAE,wBAAwB,CAAC;IAEnD;;;OAGG;IACH,SAAgB,SAAS,EAAE,KAAK,CAAC,cAAc,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,MAAM,CAAC;IAEjG;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,SAAgB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnD;;;OAGG;IACH,SAAgB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnD;;;OAGG;IACH,SAAgB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAErD;;;OAGG;IACH,SAAgB,UAAU,EAAE,2BAA2B,CAAC;IAExD,gBAAgB;gBACG,OAAO,EAAE,wBAAwB;IAapD;;;;;;;;;;;OAWG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,OAAO,EAOhC;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,QAAQ,IAAI,iBAAiB,CAEvC;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAY3C;IAED;;;;;;;OAOG;IACI,yBAAyB,CAAC,wBAAwB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAoB/E,4BAA4B,IAAI,MAAM;CAG9C"}
|
103
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.js
generated
vendored
Normal file
103
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtractorMessage = void 0;
|
||||
const SourceFileLocationFormatter_1 = require("../analyzer/SourceFileLocationFormatter");
|
||||
/**
|
||||
* This object is used to report an error or warning that occurred during API Extractor's analysis.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
class ExtractorMessage {
|
||||
/** @internal */
|
||||
constructor(options) {
|
||||
this.category = options.category;
|
||||
this.messageId = options.messageId;
|
||||
this.text = options.text;
|
||||
this.sourceFilePath = options.sourceFilePath;
|
||||
this.sourceFileLine = options.sourceFileLine;
|
||||
this.sourceFileColumn = options.sourceFileColumn;
|
||||
this.properties = options.properties || {};
|
||||
this._handled = false;
|
||||
this._logLevel = options.logLevel || "none" /* ExtractorLogLevel.None */;
|
||||
}
|
||||
/**
|
||||
* If the {@link IExtractorInvokeOptions.messageCallback} sets this property to true, it will prevent the message
|
||||
* from being displayed by API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* If the `messageCallback` routes the message to a custom handler (e.g. a toolchain logger), it should
|
||||
* assign `handled = true` to prevent API Extractor from displaying it. Assigning `handled = true` for all messages
|
||||
* would effectively disable all console output from the `Extractor` API.
|
||||
*
|
||||
* If `handled` is set to true, the message will still be included in the count of errors/warnings;
|
||||
* to discard a message entirely, instead assign `logLevel = none`.
|
||||
*/
|
||||
get handled() {
|
||||
return this._handled;
|
||||
}
|
||||
set handled(value) {
|
||||
if (this._handled && !value) {
|
||||
throw new Error('One a message has been marked as handled, the "handled" property cannot be set to false');
|
||||
}
|
||||
this._handled = value;
|
||||
}
|
||||
/**
|
||||
* Specifies how the message should be reported.
|
||||
*
|
||||
* @remarks
|
||||
* If the {@link IExtractorInvokeOptions.messageCallback} handles the message (i.e. sets `handled = true`),
|
||||
* it can use the `logLevel` to determine how to display the message.
|
||||
*
|
||||
* Alternatively, if API Extractor is handling the message, the `messageCallback` could assign `logLevel` to change
|
||||
* how it will be processed. However, in general the recommended practice is to configure message routing
|
||||
* using the `messages` section in api-extractor.json.
|
||||
*
|
||||
* To discard a message entirely, assign `logLevel = none`.
|
||||
*/
|
||||
get logLevel() {
|
||||
return this._logLevel;
|
||||
}
|
||||
set logLevel(value) {
|
||||
switch (value) {
|
||||
case "error" /* ExtractorLogLevel.Error */:
|
||||
case "info" /* ExtractorLogLevel.Info */:
|
||||
case "none" /* ExtractorLogLevel.None */:
|
||||
case "verbose" /* ExtractorLogLevel.Verbose */:
|
||||
case "warning" /* ExtractorLogLevel.Warning */:
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid log level');
|
||||
}
|
||||
this._logLevel = value;
|
||||
}
|
||||
/**
|
||||
* Returns the message formatted with its identifier and file position.
|
||||
* @remarks
|
||||
* Example:
|
||||
* ```
|
||||
* src/folder/File.ts:123:4 - (ae-extra-release-tag) The doc comment should not contain more than one release tag.
|
||||
* ```
|
||||
*/
|
||||
formatMessageWithLocation(workingPackageFolderPath) {
|
||||
let result = '';
|
||||
if (this.sourceFilePath) {
|
||||
result += SourceFileLocationFormatter_1.SourceFileLocationFormatter.formatPath(this.sourceFilePath, {
|
||||
sourceFileLine: this.sourceFileLine,
|
||||
sourceFileColumn: this.sourceFileColumn,
|
||||
workingPackageFolderPath
|
||||
});
|
||||
if (result.length > 0) {
|
||||
result += ' - ';
|
||||
}
|
||||
}
|
||||
result += this.formatMessageWithoutLocation();
|
||||
return result;
|
||||
}
|
||||
formatMessageWithoutLocation() {
|
||||
return `(${this.messageId}) ${this.text}`;
|
||||
}
|
||||
}
|
||||
exports.ExtractorMessage = ExtractorMessage;
|
||||
//# sourceMappingURL=ExtractorMessage.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessage.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
106
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.d.ts
generated
vendored
Normal file
106
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.d.ts
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Unique identifiers for messages reported by API Extractor during its analysis.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* These strings are possible values for the {@link ExtractorMessage.messageId} property
|
||||
* when the `ExtractorMessage.category` is {@link ExtractorMessageCategory.Extractor}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare const enum ExtractorMessageId {
|
||||
/**
|
||||
* "The doc comment should not contain more than one release tag."
|
||||
*/
|
||||
ExtraReleaseTag = "ae-extra-release-tag",
|
||||
/**
|
||||
* "Missing documentation for ___."
|
||||
* @remarks
|
||||
* The `ae-undocumented` message is only generated if the API report feature is enabled.
|
||||
*
|
||||
* Because the API report file already annotates undocumented items with `// (undocumented)`,
|
||||
* the `ae-undocumented` message is not logged by default. To see it, add a setting such as:
|
||||
* ```json
|
||||
* "messages": {
|
||||
* "extractorMessageReporting": {
|
||||
* "ae-undocumented": {
|
||||
* "logLevel": "warning"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
Undocumented = "ae-undocumented",
|
||||
/**
|
||||
* "This symbol has another declaration with a different release tag."
|
||||
*/
|
||||
DifferentReleaseTags = "ae-different-release-tags",
|
||||
/**
|
||||
* "The symbol ___ is marked as ___, but its signature references ___ which is marked as ___."
|
||||
*/
|
||||
IncompatibleReleaseTags = "ae-incompatible-release-tags",
|
||||
/**
|
||||
* "___ is part of the package's API, but it is missing a release tag (`@alpha`, `@beta`, `@public`, or `@internal`)."
|
||||
*/
|
||||
MissingReleaseTag = "ae-missing-release-tag",
|
||||
/**
|
||||
* "The `@packageDocumentation` comment must appear at the top of entry point *.d.ts file."
|
||||
*/
|
||||
MisplacedPackageTag = "ae-misplaced-package-tag",
|
||||
/**
|
||||
* "The symbol ___ needs to be exported by the entry point ___."
|
||||
*/
|
||||
ForgottenExport = "ae-forgotten-export",
|
||||
/**
|
||||
* "The name ___ should be prefixed with an underscore because the declaration is marked as `@internal`."
|
||||
*/
|
||||
InternalMissingUnderscore = "ae-internal-missing-underscore",
|
||||
/**
|
||||
* "Mixed release tags are not allowed for ___ because one of its declarations is marked as `@internal`."
|
||||
*/
|
||||
InternalMixedReleaseTag = "ae-internal-mixed-release-tag",
|
||||
/**
|
||||
* "The `@preapproved` tag cannot be applied to ___ because it is not a supported declaration type."
|
||||
*/
|
||||
PreapprovedUnsupportedType = "ae-preapproved-unsupported-type",
|
||||
/**
|
||||
* "The `@preapproved` tag cannot be applied to ___ without an `@internal` release tag."
|
||||
*/
|
||||
PreapprovedBadReleaseTag = "ae-preapproved-bad-release-tag",
|
||||
/**
|
||||
* "The `@inheritDoc` reference could not be resolved."
|
||||
*/
|
||||
UnresolvedInheritDocReference = "ae-unresolved-inheritdoc-reference",
|
||||
/**
|
||||
* "The `@inheritDoc` tag needs a TSDoc declaration reference; signature matching is not supported yet."
|
||||
*
|
||||
* @privateRemarks
|
||||
* In the future, we will implement signature matching so that you can write `{@inheritDoc}` and API Extractor
|
||||
* will find a corresponding member from a base class (or implemented interface). Until then, the tag
|
||||
* always needs an explicit declaration reference such as `{@inhertDoc MyBaseClass.sameMethod}`.
|
||||
*/
|
||||
UnresolvedInheritDocBase = "ae-unresolved-inheritdoc-base",
|
||||
/**
|
||||
* "The `@inheritDoc` tag for ___ refers to its own declaration."
|
||||
*/
|
||||
CyclicInheritDoc = "ae-cyclic-inherit-doc",
|
||||
/**
|
||||
* "The `@link` reference could not be resolved."
|
||||
*/
|
||||
UnresolvedLink = "ae-unresolved-link",
|
||||
/**
|
||||
* "The doc comment for the property ___ must appear on the getter, not the setter."
|
||||
*/
|
||||
SetterWithDocs = "ae-setter-with-docs",
|
||||
/**
|
||||
* "The property ___ has a setter but no getter."
|
||||
*/
|
||||
MissingGetter = "ae-missing-getter",
|
||||
/**
|
||||
* "Incorrect file type; API Extractor expects to analyze compiler outputs with the .d.ts file extension.
|
||||
* Troubleshooting tips: `https://api-extractor.com/link/dts-error`"
|
||||
*/
|
||||
WrongInputFileType = "ae-wrong-input-file-type"
|
||||
}
|
||||
export declare const allExtractorMessageIds: Set<string>;
|
||||
//# sourceMappingURL=ExtractorMessageId.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExtractorMessageId.d.ts","sourceRoot":"","sources":["../../src/api/ExtractorMessageId.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,0BAAkB,kBAAkB;IAClC;;OAEG;IACH,eAAe,yBAAyB;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,oBAAoB;IAEhC;;OAEG;IACH,oBAAoB,8BAA8B;IAElD;;OAEG;IACH,uBAAuB,iCAAiC;IAExD;;OAEG;IACH,iBAAiB,2BAA2B;IAE5C;;OAEG;IACH,mBAAmB,6BAA6B;IAEhD;;OAEG;IACH,eAAe,wBAAwB;IAEvC;;OAEG;IACH,yBAAyB,mCAAmC;IAE5D;;OAEG;IACH,uBAAuB,kCAAkC;IAEzD;;OAEG;IACH,0BAA0B,oCAAoC;IAE9D;;OAEG;IACH,wBAAwB,mCAAmC;IAE3D;;OAEG;IACH,6BAA6B,uCAAuC;IAEpE;;;;;;;OAOG;IACH,wBAAwB,kCAAkC;IAE1D;;OAEG;IACH,gBAAgB,0BAA0B;IAE1C;;OAEG;IACH,cAAc,uBAAuB;IAErC;;OAEG;IACH,cAAc,wBAAwB;IAEtC;;OAEG;IACH,aAAa,sBAAsB;IAEnC;;;OAGG;IACH,kBAAkB,6BAA6B;CAChD;AAED,eAAO,MAAM,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAmB7C,CAAC"}
|
26
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.js
generated
vendored
Normal file
26
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.allExtractorMessageIds = void 0;
|
||||
exports.allExtractorMessageIds = new Set([
|
||||
'ae-extra-release-tag',
|
||||
'ae-undocumented',
|
||||
'ae-different-release-tags',
|
||||
'ae-incompatible-release-tags',
|
||||
'ae-missing-release-tag',
|
||||
'ae-misplaced-package-tag',
|
||||
'ae-forgotten-export',
|
||||
'ae-internal-missing-underscore',
|
||||
'ae-internal-mixed-release-tag',
|
||||
'ae-preapproved-unsupported-type',
|
||||
'ae-preapproved-bad-release-tag',
|
||||
'ae-unresolved-inheritdoc-reference',
|
||||
'ae-unresolved-inheritdoc-base',
|
||||
'ae-cyclic-inherit-doc',
|
||||
'ae-unresolved-link',
|
||||
'ae-setter-with-docs',
|
||||
'ae-missing-getter',
|
||||
'ae-wrong-input-file-type'
|
||||
]);
|
||||
//# sourceMappingURL=ExtractorMessageId.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/ExtractorMessageId.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
415
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.d.ts
generated
vendored
Normal file
415
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.d.ts
generated
vendored
Normal file
@ -0,0 +1,415 @@
|
||||
import type { EnumMemberOrder } from '@microsoft/api-extractor-model';
|
||||
import type { ExtractorLogLevel } from './ExtractorLogLevel';
|
||||
/**
|
||||
* Determines how the TypeScript compiler engine will be invoked by API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigCompiler {
|
||||
/**
|
||||
* Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
|
||||
*
|
||||
* @remarks
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*
|
||||
* Note: This setting will be ignored if `overrideTsconfig` is used.
|
||||
*/
|
||||
tsconfigFilePath?: string;
|
||||
/**
|
||||
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
|
||||
*
|
||||
* @remarks
|
||||
* The value must conform to the TypeScript tsconfig schema:
|
||||
*
|
||||
* http://json.schemastore.org/tsconfig
|
||||
*
|
||||
* If omitted, then the tsconfig.json file will instead be read from the projectFolder.
|
||||
*/
|
||||
overrideTsconfig?: {};
|
||||
/**
|
||||
* This option causes the compiler to be invoked with the `--skipLibCheck` option.
|
||||
*
|
||||
* @remarks
|
||||
* This option is not recommended and may cause API Extractor to produce incomplete or incorrect declarations,
|
||||
* but it may be required when dependencies contain declarations that are incompatible with the TypeScript engine
|
||||
* that API Extractor uses for its analysis. Where possible, the underlying issue should be fixed rather than
|
||||
* relying on skipLibCheck.
|
||||
*/
|
||||
skipLibCheck?: boolean;
|
||||
}
|
||||
/**
|
||||
* Configures how the API report files (*.api.md) will be generated.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigApiReport {
|
||||
/**
|
||||
* Whether to generate an API report.
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* The filename for the API report files. It will be combined with `reportFolder` or `reportTempFolder` to produce
|
||||
* a full output filename.
|
||||
*
|
||||
* @remarks
|
||||
* The file extension should be ".api.md", and the string should not contain a path separator such as `\` or `/`.
|
||||
*/
|
||||
reportFileName?: string;
|
||||
/**
|
||||
* Specifies the folder where the API report file is written. The file name portion is determined by
|
||||
* the `reportFileName` setting.
|
||||
*
|
||||
* @remarks
|
||||
* The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
|
||||
* e.g. for an API review.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
reportFolder?: string;
|
||||
/**
|
||||
* Specifies the folder where the temporary report file is written. The file name portion is determined by
|
||||
* the `reportFileName` setting.
|
||||
*
|
||||
* @remarks
|
||||
* After the temporary file is written to disk, it is compared with the file in the `reportFolder`.
|
||||
* If they are different, a production build will fail.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
reportTempFolder?: string;
|
||||
/**
|
||||
* Whether "forgotten exports" should be included in the API report file.
|
||||
*
|
||||
* @remarks
|
||||
* Forgotten exports are declarations flagged with `ae-forgotten-export` warnings. See
|
||||
* https://api-extractor.com/pages/messages/ae-forgotten-export/ to learn more.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
includeForgottenExports?: boolean;
|
||||
}
|
||||
/**
|
||||
* Configures how the doc model file (*.api.json) will be generated.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigDocModel {
|
||||
/**
|
||||
* Whether to generate a doc model file.
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* The output path for the doc model file. The file extension should be ".api.json".
|
||||
*
|
||||
* @remarks
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
apiJsonFilePath?: string;
|
||||
/**
|
||||
* Whether "forgotten exports" should be included in the doc model file.
|
||||
*
|
||||
* @remarks
|
||||
* Forgotten exports are declarations flagged with `ae-forgotten-export` warnings. See
|
||||
* https://api-extractor.com/pages/messages/ae-forgotten-export/ to learn more.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
includeForgottenExports?: boolean;
|
||||
/**
|
||||
* The base URL where the project's source code can be viewed on a website such as GitHub or
|
||||
* Azure DevOps. This URL path corresponds to the `<projectFolder>` path on disk.
|
||||
*
|
||||
* @remarks
|
||||
* This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items.
|
||||
* For example, if the `projectFolderUrl` is "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor" and an API
|
||||
* item's file path is "api/ExtractorConfig.ts", the full URL file path would be
|
||||
* "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js".
|
||||
*
|
||||
* Can be omitted if you don't need source code links in your API documentation reference.
|
||||
*/
|
||||
projectFolderUrl?: string;
|
||||
}
|
||||
/**
|
||||
* Configures how the .d.ts rollup file will be generated.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigDtsRollup {
|
||||
/**
|
||||
* Whether to generate the .d.ts rollup file.
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated without any trimming.
|
||||
*
|
||||
* @remarks
|
||||
* This file will include all declarations that are exported by the main entry point.
|
||||
*
|
||||
* If the path is an empty string, then this file will not be written.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
untrimmedFilePath?: string;
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release.
|
||||
*
|
||||
* @remarks
|
||||
* This file will include only declarations that are marked as `@public`, `@beta`, or `@alpha`.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
alphaTrimmedFilePath?: string;
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
|
||||
*
|
||||
* @remarks
|
||||
* This file will include only declarations that are marked as `@public` or `@beta`.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
betaTrimmedFilePath?: string;
|
||||
/**
|
||||
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
|
||||
*
|
||||
* @remarks
|
||||
* This file will include only declarations that are marked as `@public`.
|
||||
*
|
||||
* If the path is an empty string, then this file will not be written.
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*/
|
||||
publicTrimmedFilePath?: string;
|
||||
/**
|
||||
* When a declaration is trimmed, by default it will be replaced by a code comment such as
|
||||
* "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
|
||||
* declaration completely.
|
||||
*/
|
||||
omitTrimmingComments?: boolean;
|
||||
}
|
||||
/**
|
||||
* Configures how the tsdoc-metadata.json file will be generated.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigTsdocMetadata {
|
||||
/**
|
||||
* Whether to generate the tsdoc-metadata.json file.
|
||||
*/
|
||||
enabled: boolean;
|
||||
/**
|
||||
* Specifies where the TSDoc metadata file should be written.
|
||||
*
|
||||
* @remarks
|
||||
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||
* prepend a folder token such as `<projectFolder>`.
|
||||
*
|
||||
* The default value is `<lookup>`, which causes the path to be automatically inferred from the `tsdocMetadata`,
|
||||
* `typings` or `main` fields of the project's package.json. If none of these fields are set, the lookup
|
||||
* falls back to `tsdoc-metadata.json` in the package folder.
|
||||
*/
|
||||
tsdocMetadataFilePath?: string;
|
||||
}
|
||||
/**
|
||||
* Configures reporting for a given message identifier.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigMessageReportingRule {
|
||||
/**
|
||||
* Specifies whether the message should be written to the the tool's output log.
|
||||
*
|
||||
* @remarks
|
||||
* Note that the `addToApiReportFile` property may supersede this option.
|
||||
*/
|
||||
logLevel: ExtractorLogLevel;
|
||||
/**
|
||||
* When `addToApiReportFile` is true: If API Extractor is configured to write an API report file (.api.md),
|
||||
* then the message will be written inside that file; otherwise, the message is instead logged according to
|
||||
* the `logLevel` option.
|
||||
*/
|
||||
addToApiReportFile?: boolean;
|
||||
}
|
||||
/**
|
||||
* Specifies a table of reporting rules for different message identifiers, and also the default rule used for
|
||||
* identifiers that do not appear in the table.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigMessageReportingTable {
|
||||
/**
|
||||
* The key is a message identifier for the associated type of message, or "default" to specify the default policy.
|
||||
* For example, the key might be `TS2551` (a compiler message), `tsdoc-link-tag-unescaped-text` (a TSDOc message),
|
||||
* or `ae-extra-release-tag` (a message related to the API Extractor analysis).
|
||||
*/
|
||||
[messageId: string]: IConfigMessageReportingRule;
|
||||
}
|
||||
/**
|
||||
* Configures how API Extractor reports error and warning messages produced during analysis.
|
||||
*
|
||||
* @remarks
|
||||
* This is part of the {@link IConfigFile} structure.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IExtractorMessagesConfig {
|
||||
/**
|
||||
* Configures handling of diagnostic messages generating the TypeScript compiler while analyzing the
|
||||
* input .d.ts files.
|
||||
*/
|
||||
compilerMessageReporting?: IConfigMessageReportingTable;
|
||||
/**
|
||||
* Configures handling of messages reported by API Extractor during its analysis.
|
||||
*/
|
||||
extractorMessageReporting?: IConfigMessageReportingTable;
|
||||
/**
|
||||
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
|
||||
*/
|
||||
tsdocMessageReporting?: IConfigMessageReportingTable;
|
||||
}
|
||||
/**
|
||||
* Configuration options for the API Extractor tool. These options can be constructed programmatically
|
||||
* or loaded from the api-extractor.json config file using the {@link ExtractorConfig} class.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface IConfigFile {
|
||||
/**
|
||||
* Optionally specifies another JSON config file that this file extends from. This provides a way for
|
||||
* standard settings to be shared across multiple projects.
|
||||
*
|
||||
* @remarks
|
||||
* If the path starts with `./` or `../`, the path is resolved relative to the folder of the file that contains
|
||||
* the `extends` field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
|
||||
* resolved using NodeJS `require()`.
|
||||
*/
|
||||
extends?: string;
|
||||
/**
|
||||
* Determines the `<projectFolder>` token that can be used with other config file settings. The project folder
|
||||
* typically contains the tsconfig.json and package.json config files, but the path is user-defined.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* The path is resolved relative to the folder of the config file that contains the setting.
|
||||
*
|
||||
* The default value for `projectFolder` is the token `<lookup>`, which means the folder is determined using
|
||||
* the following heuristics:
|
||||
*
|
||||
* If the config/rig.json system is used (as defined by {@link https://www.npmjs.com/package/@rushstack/rig-package
|
||||
* | @rushstack/rig-package}), then the `<lookup>` value will be the package folder that referenced the rig.
|
||||
*
|
||||
* Otherwise, the `<lookup>` value is determined by traversing parent folders, starting from the folder containing
|
||||
* api-extractor.json, and stopping at the first folder that contains a tsconfig.json file. If a tsconfig.json file
|
||||
* cannot be found in this way, then an error will be reported.
|
||||
*/
|
||||
projectFolder?: string;
|
||||
/**
|
||||
* Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
|
||||
* analyzes the symbols exported by this module.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* The file extension must be ".d.ts" and not ".ts".
|
||||
* The path is resolved relative to the "projectFolder" location.
|
||||
*/
|
||||
mainEntryPointFilePath: string;
|
||||
/**
|
||||
* A list of NPM package names whose exports should be treated as part of this package.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* For example, suppose that Webpack is used to generate a distributed bundle for the project `library1`,
|
||||
* and another NPM package `library2` is embedded in this bundle. Some types from `library2` may become part
|
||||
* of the exported API for `library1`, but by default API Extractor would generate a .d.ts rollup that explicitly
|
||||
* imports `library2`. To avoid this, we can specify:
|
||||
*
|
||||
* ```js
|
||||
* "bundledPackages": [ "library2" ],
|
||||
* ```
|
||||
*
|
||||
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
|
||||
* local files for `library1`.
|
||||
*/
|
||||
bundledPackages?: string[];
|
||||
/**
|
||||
* Specifies what type of newlines API Extractor should use when writing output files.
|
||||
*
|
||||
* @remarks
|
||||
* By default, the output files will be written with Windows-style newlines.
|
||||
* To use POSIX-style newlines, specify "lf" instead.
|
||||
* To use the OS's default newline kind, specify "os".
|
||||
*/
|
||||
newlineKind?: 'crlf' | 'lf' | 'os';
|
||||
/**
|
||||
* Set to true when invoking API Extractor's test harness.
|
||||
* @remarks
|
||||
* When `testMode` is true, the `toolVersion` field in the .api.json file is assigned an empty string
|
||||
* to prevent spurious diffs in output files tracked for tests.
|
||||
*/
|
||||
testMode?: boolean;
|
||||
/**
|
||||
* Specifies how API Extractor sorts members of an enum when generating the .api.json file.
|
||||
*
|
||||
* @remarks
|
||||
* By default, the output files will be sorted alphabetically, which is "by-name".
|
||||
* To keep the ordering in the source code, specify "preserve".
|
||||
*
|
||||
* @defaultValue `by-name`
|
||||
*/
|
||||
enumMemberOrder?: EnumMemberOrder;
|
||||
/**
|
||||
* {@inheritDoc IConfigCompiler}
|
||||
*/
|
||||
compiler?: IConfigCompiler;
|
||||
/**
|
||||
* {@inheritDoc IConfigApiReport}
|
||||
*/
|
||||
apiReport?: IConfigApiReport;
|
||||
/**
|
||||
* {@inheritDoc IConfigDocModel}
|
||||
*/
|
||||
docModel?: IConfigDocModel;
|
||||
/**
|
||||
* {@inheritDoc IConfigDtsRollup}
|
||||
* @beta
|
||||
*/
|
||||
dtsRollup?: IConfigDtsRollup;
|
||||
/**
|
||||
* {@inheritDoc IConfigTsdocMetadata}
|
||||
* @beta
|
||||
*/
|
||||
tsdocMetadata?: IConfigTsdocMetadata;
|
||||
/**
|
||||
* {@inheritDoc IExtractorMessagesConfig}
|
||||
*/
|
||||
messages?: IExtractorMessagesConfig;
|
||||
}
|
||||
//# sourceMappingURL=IConfigFile.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"IConfigFile.d.ts","sourceRoot":"","sources":["../../src/api/IConfigFile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,EAAE,CAAC;IAEtB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;OAQG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,QAAQ,EAAE,iBAAiB,CAAC;IAE5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,CAAC,SAAS,EAAE,MAAM,GAAG,2BAA2B,CAAC;CAClD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,4BAA4B,CAAC;IAExD;;OAEG;IACH,yBAAyB,CAAC,EAAE,4BAA4B,CAAC;IAEzD;;OAEG;IACH,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;CACtD;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;;;OAQG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAEnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;OAGG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC"}
|
5
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.js
generated
vendored
Normal file
5
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IConfigFile.js.map
|
1
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/api/IConfigFile.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user