init
This commit is contained in:
68
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.d.ts
generated
vendored
Normal file
68
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.d.ts
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
import type * as tsdoc from '@microsoft/tsdoc';
|
||||
import type { ReleaseTag } from '@microsoft/api-extractor-model';
|
||||
import { VisitorState } from './VisitorState';
|
||||
/**
|
||||
* Constructor parameters for `ApiItemMetadata`.
|
||||
*/
|
||||
export interface IApiItemMetadataOptions {
|
||||
declaredReleaseTag: ReleaseTag;
|
||||
effectiveReleaseTag: ReleaseTag;
|
||||
releaseTagSameAsParent: boolean;
|
||||
isEventProperty: boolean;
|
||||
isOverride: boolean;
|
||||
isSealed: boolean;
|
||||
isVirtual: boolean;
|
||||
isPreapproved: boolean;
|
||||
}
|
||||
/**
|
||||
* Stores the Collector's additional analysis for an `AstDeclaration`. This object is assigned to
|
||||
* `AstDeclaration.apiItemMetadata` but consumers must always obtain it by calling `Collector.fetchApiItemMetadata()`.
|
||||
*
|
||||
* @remarks
|
||||
* Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,
|
||||
* whereas a separate `DeclarationMetadata` object is created for each declaration.
|
||||
*
|
||||
* Consider this example:
|
||||
* ```ts
|
||||
* export declare class A {
|
||||
* get b(): string;
|
||||
* set b(value: string);
|
||||
* }
|
||||
* export declare namespace A { }
|
||||
* ```
|
||||
*
|
||||
* In this example, there are two "symbols": `A` and `b`
|
||||
*
|
||||
* There are four "declarations": `A` class, `A` namespace, `b` getter, `b` setter
|
||||
*
|
||||
* There are three "API items": `A` class, `A` namespace, `b` property. The property getter is the main declaration
|
||||
* for `b`, and the setter is the "ancillary" declaration.
|
||||
*/
|
||||
export declare class ApiItemMetadata {
|
||||
/**
|
||||
* This is the release tag that was explicitly specified in the original doc comment, if any.
|
||||
*/
|
||||
readonly declaredReleaseTag: ReleaseTag;
|
||||
/**
|
||||
* The "effective" release tag is a normalized value that is based on `declaredReleaseTag`,
|
||||
* but may be inherited from a parent, or corrected if the declared value was somehow invalid.
|
||||
* When actually trimming .d.ts files or generating docs, API Extractor uses the "effective" value
|
||||
* instead of the "declared" value.
|
||||
*/
|
||||
readonly effectiveReleaseTag: ReleaseTag;
|
||||
readonly releaseTagSameAsParent: boolean;
|
||||
readonly isEventProperty: boolean;
|
||||
readonly isOverride: boolean;
|
||||
readonly isSealed: boolean;
|
||||
readonly isVirtual: boolean;
|
||||
readonly isPreapproved: boolean;
|
||||
/**
|
||||
* This is the TSDoc comment for the declaration. It may be modified (or constructed artificially) by
|
||||
* the DocCommentEnhancer.
|
||||
*/
|
||||
tsdocComment: tsdoc.DocComment | undefined;
|
||||
undocumented: boolean;
|
||||
docCommentEnhancerVisitorState: VisitorState;
|
||||
constructor(options: IApiItemMetadataOptions);
|
||||
}
|
||||
//# sourceMappingURL=ApiItemMetadata.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApiItemMetadata.d.ts","sourceRoot":"","sources":["../../src/collector/ApiItemMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,EAAE,UAAU,CAAC;IAC/B,mBAAmB,EAAE,UAAU,CAAC;IAChC,sBAAsB,EAAE,OAAO,CAAC;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,SAAgB,kBAAkB,EAAE,UAAU,CAAC;IAE/C;;;;;OAKG;IACH,SAAgB,mBAAmB,EAAE,UAAU,CAAC;IAGhD,SAAgB,sBAAsB,EAAE,OAAO,CAAC;IAIhD,SAAgB,eAAe,EAAE,OAAO,CAAC;IACzC,SAAgB,UAAU,EAAE,OAAO,CAAC;IACpC,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAClC,SAAgB,SAAS,EAAE,OAAO,CAAC;IAEnC,SAAgB,aAAa,EAAE,OAAO,CAAC;IAEvC;;;OAGG;IACI,YAAY,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC;IAG3C,YAAY,EAAE,OAAO,CAAQ;IAE7B,8BAA8B,EAAE,YAAY,CAA0B;gBAE1D,OAAO,EAAE,uBAAuB;CAUpD"}
|
47
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.js
generated
vendored
Normal file
47
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"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.ApiItemMetadata = void 0;
|
||||
const VisitorState_1 = require("./VisitorState");
|
||||
/**
|
||||
* Stores the Collector's additional analysis for an `AstDeclaration`. This object is assigned to
|
||||
* `AstDeclaration.apiItemMetadata` but consumers must always obtain it by calling `Collector.fetchApiItemMetadata()`.
|
||||
*
|
||||
* @remarks
|
||||
* Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,
|
||||
* whereas a separate `DeclarationMetadata` object is created for each declaration.
|
||||
*
|
||||
* Consider this example:
|
||||
* ```ts
|
||||
* export declare class A {
|
||||
* get b(): string;
|
||||
* set b(value: string);
|
||||
* }
|
||||
* export declare namespace A { }
|
||||
* ```
|
||||
*
|
||||
* In this example, there are two "symbols": `A` and `b`
|
||||
*
|
||||
* There are four "declarations": `A` class, `A` namespace, `b` getter, `b` setter
|
||||
*
|
||||
* There are three "API items": `A` class, `A` namespace, `b` property. The property getter is the main declaration
|
||||
* for `b`, and the setter is the "ancillary" declaration.
|
||||
*/
|
||||
class ApiItemMetadata {
|
||||
constructor(options) {
|
||||
// Assigned by DocCommentEnhancer
|
||||
this.undocumented = true;
|
||||
this.docCommentEnhancerVisitorState = VisitorState_1.VisitorState.Unvisited;
|
||||
this.declaredReleaseTag = options.declaredReleaseTag;
|
||||
this.effectiveReleaseTag = options.effectiveReleaseTag;
|
||||
this.releaseTagSameAsParent = options.releaseTagSameAsParent;
|
||||
this.isEventProperty = options.isEventProperty;
|
||||
this.isOverride = options.isOverride;
|
||||
this.isSealed = options.isSealed;
|
||||
this.isVirtual = options.isVirtual;
|
||||
this.isPreapproved = options.isPreapproved;
|
||||
}
|
||||
}
|
||||
exports.ApiItemMetadata = ApiItemMetadata;
|
||||
//# sourceMappingURL=ApiItemMetadata.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/ApiItemMetadata.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApiItemMetadata.js","sourceRoot":"","sources":["../../src/collector/ApiItemMetadata.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,iDAA8C;AAgB9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,eAAe;IAqC1B,YAAmB,OAAgC;QALnD,iCAAiC;QAC1B,iBAAY,GAAY,IAAI,CAAC;QAE7B,mCAA8B,GAAiB,2BAAY,CAAC,SAAS,CAAC;QAG3E,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACvD,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;QAC7D,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC7C,CAAC;CACF;AA/CD,0CA+CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport type { ReleaseTag } from '@microsoft/api-extractor-model';\nimport { VisitorState } from './VisitorState';\n\n/**\n * Constructor parameters for `ApiItemMetadata`.\n */\nexport interface IApiItemMetadataOptions {\n declaredReleaseTag: ReleaseTag;\n effectiveReleaseTag: ReleaseTag;\n releaseTagSameAsParent: boolean;\n isEventProperty: boolean;\n isOverride: boolean;\n isSealed: boolean;\n isVirtual: boolean;\n isPreapproved: boolean;\n}\n\n/**\n * Stores the Collector's additional analysis for an `AstDeclaration`. This object is assigned to\n * `AstDeclaration.apiItemMetadata` but consumers must always obtain it by calling `Collector.fetchApiItemMetadata()`.\n *\n * @remarks\n * Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,\n * whereas a separate `DeclarationMetadata` object is created for each declaration.\n *\n * Consider this example:\n * ```ts\n * export declare class A {\n * get b(): string;\n * set b(value: string);\n * }\n * export declare namespace A { }\n * ```\n *\n * In this example, there are two \"symbols\": `A` and `b`\n *\n * There are four \"declarations\": `A` class, `A` namespace, `b` getter, `b` setter\n *\n * There are three \"API items\": `A` class, `A` namespace, `b` property. The property getter is the main declaration\n * for `b`, and the setter is the \"ancillary\" declaration.\n */\nexport class ApiItemMetadata {\n /**\n * This is the release tag that was explicitly specified in the original doc comment, if any.\n */\n public readonly declaredReleaseTag: ReleaseTag;\n\n /**\n * The \"effective\" release tag is a normalized value that is based on `declaredReleaseTag`,\n * but may be inherited from a parent, or corrected if the declared value was somehow invalid.\n * When actually trimming .d.ts files or generating docs, API Extractor uses the \"effective\" value\n * instead of the \"declared\" value.\n */\n public readonly effectiveReleaseTag: ReleaseTag;\n\n // If true, then it would be redundant to show this release tag\n public readonly releaseTagSameAsParent: boolean;\n\n // NOTE: In the future, the Collector may infer or error-correct some of these states.\n // Generators should rely on these instead of tsdocComment.modifierTagSet.\n public readonly isEventProperty: boolean;\n public readonly isOverride: boolean;\n public readonly isSealed: boolean;\n public readonly isVirtual: boolean;\n\n public readonly isPreapproved: boolean;\n\n /**\n * This is the TSDoc comment for the declaration. It may be modified (or constructed artificially) by\n * the DocCommentEnhancer.\n */\n public tsdocComment: tsdoc.DocComment | undefined;\n\n // Assigned by DocCommentEnhancer\n public undocumented: boolean = true;\n\n public docCommentEnhancerVisitorState: VisitorState = VisitorState.Unvisited;\n\n public constructor(options: IApiItemMetadataOptions) {\n this.declaredReleaseTag = options.declaredReleaseTag;\n this.effectiveReleaseTag = options.effectiveReleaseTag;\n this.releaseTagSameAsParent = options.releaseTagSameAsParent;\n this.isEventProperty = options.isEventProperty;\n this.isOverride = options.isOverride;\n this.isSealed = options.isSealed;\n this.isVirtual = options.isVirtual;\n this.isPreapproved = options.isPreapproved;\n }\n}\n"]}
|
142
node_modules/@microsoft/api-extractor/lib/collector/Collector.d.ts
generated
vendored
Normal file
142
node_modules/@microsoft/api-extractor/lib/collector/Collector.d.ts
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
import * as ts from 'typescript';
|
||||
import { PackageJsonLookup } from '@rushstack/node-core-library';
|
||||
import { CollectorEntity } from './CollectorEntity';
|
||||
import { AstSymbolTable } from '../analyzer/AstSymbolTable';
|
||||
import type { AstEntity } from '../analyzer/AstEntity';
|
||||
import { AstSymbol } from '../analyzer/AstSymbol';
|
||||
import type { AstDeclaration } from '../analyzer/AstDeclaration';
|
||||
import { WorkingPackage } from './WorkingPackage';
|
||||
import { type DeclarationMetadata } from './DeclarationMetadata';
|
||||
import { ApiItemMetadata } from './ApiItemMetadata';
|
||||
import { SymbolMetadata } from './SymbolMetadata';
|
||||
import { type IGlobalVariableAnalyzer } from '../analyzer/TypeScriptInternals';
|
||||
import type { MessageRouter } from './MessageRouter';
|
||||
import { AstReferenceResolver } from '../analyzer/AstReferenceResolver';
|
||||
import { ExtractorConfig } from '../api/ExtractorConfig';
|
||||
import type { SourceMapper } from './SourceMapper';
|
||||
/**
|
||||
* Options for Collector constructor.
|
||||
*/
|
||||
export interface ICollectorOptions {
|
||||
/**
|
||||
* Configuration for the TypeScript compiler. The most important options to set are:
|
||||
*
|
||||
* - target: ts.ScriptTarget.ES5
|
||||
* - module: ts.ModuleKind.CommonJS
|
||||
* - moduleResolution: ts.ModuleResolutionKind.NodeJs
|
||||
* - rootDir: inputFolder
|
||||
*/
|
||||
program: ts.Program;
|
||||
messageRouter: MessageRouter;
|
||||
extractorConfig: ExtractorConfig;
|
||||
sourceMapper: SourceMapper;
|
||||
}
|
||||
/**
|
||||
* The `Collector` manages the overall data set that is used by `ApiModelGenerator`,
|
||||
* `DtsRollupGenerator`, and `ApiReportGenerator`. Starting from the working package's entry point,
|
||||
* the `Collector` collects all exported symbols, determines how to import any symbols they reference,
|
||||
* assigns unique names, and sorts everything into a normalized alphabetical ordering.
|
||||
*/
|
||||
export declare class Collector {
|
||||
readonly program: ts.Program;
|
||||
readonly typeChecker: ts.TypeChecker;
|
||||
readonly globalVariableAnalyzer: IGlobalVariableAnalyzer;
|
||||
readonly astSymbolTable: AstSymbolTable;
|
||||
readonly astReferenceResolver: AstReferenceResolver;
|
||||
readonly packageJsonLookup: PackageJsonLookup;
|
||||
readonly messageRouter: MessageRouter;
|
||||
readonly workingPackage: WorkingPackage;
|
||||
readonly extractorConfig: ExtractorConfig;
|
||||
readonly sourceMapper: SourceMapper;
|
||||
/**
|
||||
* The `ExtractorConfig.bundledPackages` names in a set.
|
||||
*/
|
||||
readonly bundledPackageNames: ReadonlySet<string>;
|
||||
private readonly _program;
|
||||
private readonly _tsdocParser;
|
||||
private _astEntryPoint;
|
||||
private readonly _entities;
|
||||
private readonly _entitiesByAstEntity;
|
||||
private readonly _entitiesBySymbol;
|
||||
private readonly _starExportedExternalModulePaths;
|
||||
private readonly _dtsTypeReferenceDirectives;
|
||||
private readonly _dtsLibReferenceDirectives;
|
||||
private readonly _cachedOverloadIndexesByDeclaration;
|
||||
constructor(options: ICollectorOptions);
|
||||
/**
|
||||
* Returns a list of names (e.g. "example-library") that should appear in a reference like this:
|
||||
*
|
||||
* ```
|
||||
* /// <reference types="example-library" />
|
||||
* ```
|
||||
*/
|
||||
get dtsTypeReferenceDirectives(): ReadonlySet<string>;
|
||||
/**
|
||||
* A list of names (e.g. "runtime-library") that should appear in a reference like this:
|
||||
*
|
||||
* ```
|
||||
* /// <reference lib="runtime-library" />
|
||||
* ```
|
||||
*/
|
||||
get dtsLibReferenceDirectives(): ReadonlySet<string>;
|
||||
get entities(): ReadonlyArray<CollectorEntity>;
|
||||
/**
|
||||
* A list of module specifiers (e.g. `"@rushstack/node-core-library/lib/FileSystem"`) that should be emitted
|
||||
* as star exports (e.g. `export * from "@rushstack/node-core-library/lib/FileSystem"`).
|
||||
*/
|
||||
get starExportedExternalModulePaths(): ReadonlyArray<string>;
|
||||
/**
|
||||
* Perform the analysis.
|
||||
*/
|
||||
analyze(): void;
|
||||
/**
|
||||
* For a given ts.Identifier that is part of an AstSymbol that we analyzed, return the CollectorEntity that
|
||||
* it refers to. Returns undefined if it doesn't refer to anything interesting.
|
||||
* @remarks
|
||||
* Throws an Error if the ts.Identifier is not part of node tree that was analyzed.
|
||||
*/
|
||||
tryGetEntityForNode(identifier: ts.Identifier | ts.ImportTypeNode): CollectorEntity | undefined;
|
||||
/**
|
||||
* For a given analyzed ts.Symbol, return the CollectorEntity that it refers to. Returns undefined if it
|
||||
* doesn't refer to anything interesting.
|
||||
*/
|
||||
tryGetEntityForSymbol(symbol: ts.Symbol): CollectorEntity | undefined;
|
||||
/**
|
||||
* Returns the associated `CollectorEntity` for the given `astEntity`, if one was created during analysis.
|
||||
*/
|
||||
tryGetCollectorEntity(astEntity: AstEntity): CollectorEntity | undefined;
|
||||
fetchSymbolMetadata(astSymbol: AstSymbol): SymbolMetadata;
|
||||
fetchDeclarationMetadata(astDeclaration: AstDeclaration): DeclarationMetadata;
|
||||
fetchApiItemMetadata(astDeclaration: AstDeclaration): ApiItemMetadata;
|
||||
tryFetchMetadataForAstEntity(astEntity: AstEntity): SymbolMetadata | undefined;
|
||||
isAncillaryDeclaration(astDeclaration: AstDeclaration): boolean;
|
||||
getNonAncillaryDeclarations(astSymbol: AstSymbol): ReadonlyArray<AstDeclaration>;
|
||||
/**
|
||||
* Removes the leading underscore, for example: "_Example" --> "example*Example*_"
|
||||
*
|
||||
* @remarks
|
||||
* This causes internal definitions to sort alphabetically case-insensitive, then case-sensitive, and
|
||||
* initially ignoring the underscore prefix, while still deterministically comparing it.
|
||||
* The star is used as a delimiter because it is not a legal identifier character.
|
||||
*/
|
||||
static getSortKeyIgnoringUnderscore(identifier: string | undefined): string;
|
||||
/**
|
||||
* For function-like signatures, this returns the TSDoc "overload index" which can be used to identify
|
||||
* a specific overload.
|
||||
*/
|
||||
getOverloadIndex(astDeclaration: AstDeclaration): number;
|
||||
private _createCollectorEntity;
|
||||
private _recursivelyCreateEntities;
|
||||
/**
|
||||
* Ensures a unique name for each item in the package typings file.
|
||||
*/
|
||||
private _makeUniqueNames;
|
||||
private _fetchSymbolMetadata;
|
||||
private _calculateDeclarationMetadataForDeclarations;
|
||||
private _addAncillaryDeclaration;
|
||||
private _calculateApiItemMetadata;
|
||||
private _parseTsdocForAstDeclaration;
|
||||
private _collectReferenceDirectives;
|
||||
private _collectReferenceDirectivesFromSourceFiles;
|
||||
}
|
||||
//# sourceMappingURL=Collector.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/Collector.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/Collector.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Collector.d.ts","sourceRoot":"","sources":["../../src/collector/Collector.ts"],"names":[],"mappings":"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"}
|
730
node_modules/@microsoft/api-extractor/lib/collector/Collector.js
generated
vendored
Normal file
730
node_modules/@microsoft/api-extractor/lib/collector/Collector.js
generated
vendored
Normal file
@ -0,0 +1,730 @@
|
||||
"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.Collector = void 0;
|
||||
const ts = __importStar(require("typescript"));
|
||||
const tsdoc = __importStar(require("@microsoft/tsdoc"));
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const api_extractor_model_1 = require("@microsoft/api-extractor-model");
|
||||
const CollectorEntity_1 = require("./CollectorEntity");
|
||||
const AstSymbolTable_1 = require("../analyzer/AstSymbolTable");
|
||||
const AstSymbol_1 = require("../analyzer/AstSymbol");
|
||||
const TypeScriptHelpers_1 = require("../analyzer/TypeScriptHelpers");
|
||||
const WorkingPackage_1 = require("./WorkingPackage");
|
||||
const PackageDocComment_1 = require("../aedoc/PackageDocComment");
|
||||
const DeclarationMetadata_1 = require("./DeclarationMetadata");
|
||||
const ApiItemMetadata_1 = require("./ApiItemMetadata");
|
||||
const SymbolMetadata_1 = require("./SymbolMetadata");
|
||||
const TypeScriptInternals_1 = require("../analyzer/TypeScriptInternals");
|
||||
const AstReferenceResolver_1 = require("../analyzer/AstReferenceResolver");
|
||||
const ExtractorConfig_1 = require("../api/ExtractorConfig");
|
||||
const AstNamespaceImport_1 = require("../analyzer/AstNamespaceImport");
|
||||
const AstImport_1 = require("../analyzer/AstImport");
|
||||
/**
|
||||
* The `Collector` manages the overall data set that is used by `ApiModelGenerator`,
|
||||
* `DtsRollupGenerator`, and `ApiReportGenerator`. Starting from the working package's entry point,
|
||||
* the `Collector` collects all exported symbols, determines how to import any symbols they reference,
|
||||
* assigns unique names, and sorts everything into a normalized alphabetical ordering.
|
||||
*/
|
||||
class Collector {
|
||||
constructor(options) {
|
||||
this._entities = [];
|
||||
this._entitiesByAstEntity = new Map();
|
||||
this._entitiesBySymbol = new Map();
|
||||
this._starExportedExternalModulePaths = [];
|
||||
this._dtsTypeReferenceDirectives = new Set();
|
||||
this._dtsLibReferenceDirectives = new Set();
|
||||
this.packageJsonLookup = new node_core_library_1.PackageJsonLookup();
|
||||
this._program = options.program;
|
||||
this.extractorConfig = options.extractorConfig;
|
||||
this.sourceMapper = options.sourceMapper;
|
||||
const entryPointSourceFile = options.program.getSourceFile(this.extractorConfig.mainEntryPointFilePath);
|
||||
if (!entryPointSourceFile) {
|
||||
throw new Error('Unable to load file: ' + this.extractorConfig.mainEntryPointFilePath);
|
||||
}
|
||||
if (!this.extractorConfig.packageFolder || !this.extractorConfig.packageJson) {
|
||||
// TODO: We should be able to analyze projects that don't have any package.json.
|
||||
// The ExtractorConfig class is already designed to allow this.
|
||||
throw new Error('Unable to find a package.json file for the project being analyzed');
|
||||
}
|
||||
this.workingPackage = new WorkingPackage_1.WorkingPackage({
|
||||
packageFolder: this.extractorConfig.packageFolder,
|
||||
packageJson: this.extractorConfig.packageJson,
|
||||
entryPointSourceFile
|
||||
});
|
||||
this.messageRouter = options.messageRouter;
|
||||
this.program = options.program;
|
||||
this.typeChecker = options.program.getTypeChecker();
|
||||
this.globalVariableAnalyzer = TypeScriptInternals_1.TypeScriptInternals.getGlobalVariableAnalyzer(this.program);
|
||||
this._tsdocParser = new tsdoc.TSDocParser(this.extractorConfig.tsdocConfiguration);
|
||||
this.bundledPackageNames = new Set(this.extractorConfig.bundledPackages);
|
||||
this.astSymbolTable = new AstSymbolTable_1.AstSymbolTable(this.program, this.typeChecker, this.packageJsonLookup, this.bundledPackageNames, this.messageRouter);
|
||||
this.astReferenceResolver = new AstReferenceResolver_1.AstReferenceResolver(this);
|
||||
this._cachedOverloadIndexesByDeclaration = new Map();
|
||||
}
|
||||
/**
|
||||
* Returns a list of names (e.g. "example-library") that should appear in a reference like this:
|
||||
*
|
||||
* ```
|
||||
* /// <reference types="example-library" />
|
||||
* ```
|
||||
*/
|
||||
get dtsTypeReferenceDirectives() {
|
||||
return this._dtsTypeReferenceDirectives;
|
||||
}
|
||||
/**
|
||||
* A list of names (e.g. "runtime-library") that should appear in a reference like this:
|
||||
*
|
||||
* ```
|
||||
* /// <reference lib="runtime-library" />
|
||||
* ```
|
||||
*/
|
||||
get dtsLibReferenceDirectives() {
|
||||
return this._dtsLibReferenceDirectives;
|
||||
}
|
||||
get entities() {
|
||||
return this._entities;
|
||||
}
|
||||
/**
|
||||
* A list of module specifiers (e.g. `"@rushstack/node-core-library/lib/FileSystem"`) that should be emitted
|
||||
* as star exports (e.g. `export * from "@rushstack/node-core-library/lib/FileSystem"`).
|
||||
*/
|
||||
get starExportedExternalModulePaths() {
|
||||
return this._starExportedExternalModulePaths;
|
||||
}
|
||||
/**
|
||||
* Perform the analysis.
|
||||
*/
|
||||
analyze() {
|
||||
if (this._astEntryPoint) {
|
||||
throw new Error('DtsRollupGenerator.analyze() was already called');
|
||||
}
|
||||
// This runs a full type analysis, and then augments the Abstract Syntax Tree (i.e. declarations)
|
||||
// with semantic information (i.e. symbols). The "diagnostics" are a subset of the everyday
|
||||
// compile errors that would result from a full compilation.
|
||||
for (const diagnostic of this._program.getSemanticDiagnostics()) {
|
||||
this.messageRouter.addCompilerDiagnostic(diagnostic);
|
||||
}
|
||||
const sourceFiles = this.program.getSourceFiles();
|
||||
if (this.messageRouter.showDiagnostics) {
|
||||
this.messageRouter.logDiagnosticHeader('Root filenames');
|
||||
for (const fileName of this.program.getRootFileNames()) {
|
||||
this.messageRouter.logDiagnostic(fileName);
|
||||
}
|
||||
this.messageRouter.logDiagnosticFooter();
|
||||
this.messageRouter.logDiagnosticHeader('Files analyzed by compiler');
|
||||
for (const sourceFile of sourceFiles) {
|
||||
this.messageRouter.logDiagnostic(sourceFile.fileName);
|
||||
}
|
||||
this.messageRouter.logDiagnosticFooter();
|
||||
}
|
||||
// We can throw this error earlier in CompilerState.ts, but intentionally wait until after we've logged the
|
||||
// associated diagnostic message above to make debugging easier for developers.
|
||||
// Typically there will be many such files -- to avoid too much noise, only report the first one.
|
||||
const badSourceFile = sourceFiles.find(({ fileName }) => !ExtractorConfig_1.ExtractorConfig.hasDtsFileExtension(fileName));
|
||||
if (badSourceFile) {
|
||||
this.messageRouter.addAnalyzerIssueForPosition("ae-wrong-input-file-type" /* ExtractorMessageId.WrongInputFileType */, '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', badSourceFile, 0);
|
||||
}
|
||||
// Build the entry point
|
||||
const entryPointSourceFile = this.workingPackage.entryPointSourceFile;
|
||||
const astEntryPoint = this.astSymbolTable.fetchAstModuleFromWorkingPackage(entryPointSourceFile);
|
||||
this._astEntryPoint = astEntryPoint;
|
||||
const packageDocCommentTextRange = PackageDocComment_1.PackageDocComment.tryFindInSourceFile(entryPointSourceFile, this);
|
||||
if (packageDocCommentTextRange) {
|
||||
const range = tsdoc.TextRange.fromStringRange(entryPointSourceFile.text, packageDocCommentTextRange.pos, packageDocCommentTextRange.end);
|
||||
this.workingPackage.tsdocParserContext = this._tsdocParser.parseRange(range);
|
||||
this.messageRouter.addTsdocMessages(this.workingPackage.tsdocParserContext, entryPointSourceFile);
|
||||
this.workingPackage.tsdocComment = this.workingPackage.tsdocParserContext.docComment;
|
||||
}
|
||||
const astModuleExportInfo = this.astSymbolTable.fetchAstModuleExportInfo(astEntryPoint);
|
||||
// Create a CollectorEntity for each top-level export.
|
||||
const processedAstEntities = [];
|
||||
for (const [exportName, astEntity] of astModuleExportInfo.exportedLocalEntities) {
|
||||
this._createCollectorEntity(astEntity, exportName);
|
||||
processedAstEntities.push(astEntity);
|
||||
}
|
||||
// Recursively create the remaining CollectorEntities after the top-level entities
|
||||
// have been processed.
|
||||
const alreadySeenAstEntities = new Set();
|
||||
for (const astEntity of processedAstEntities) {
|
||||
this._recursivelyCreateEntities(astEntity, alreadySeenAstEntities);
|
||||
if (astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
this.fetchSymbolMetadata(astEntity);
|
||||
}
|
||||
}
|
||||
this._makeUniqueNames();
|
||||
for (const starExportedExternalModule of astModuleExportInfo.starExportedExternalModules) {
|
||||
if (starExportedExternalModule.externalModulePath !== undefined) {
|
||||
this._starExportedExternalModulePaths.push(starExportedExternalModule.externalModulePath);
|
||||
}
|
||||
}
|
||||
node_core_library_1.Sort.sortBy(this._entities, (x) => x.getSortKey());
|
||||
node_core_library_1.Sort.sortSet(this._dtsTypeReferenceDirectives);
|
||||
node_core_library_1.Sort.sortSet(this._dtsLibReferenceDirectives);
|
||||
this._starExportedExternalModulePaths.sort();
|
||||
}
|
||||
/**
|
||||
* For a given ts.Identifier that is part of an AstSymbol that we analyzed, return the CollectorEntity that
|
||||
* it refers to. Returns undefined if it doesn't refer to anything interesting.
|
||||
* @remarks
|
||||
* Throws an Error if the ts.Identifier is not part of node tree that was analyzed.
|
||||
*/
|
||||
tryGetEntityForNode(identifier) {
|
||||
const astEntity = this.astSymbolTable.tryGetEntityForNode(identifier);
|
||||
if (astEntity) {
|
||||
return this._entitiesByAstEntity.get(astEntity);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* For a given analyzed ts.Symbol, return the CollectorEntity that it refers to. Returns undefined if it
|
||||
* doesn't refer to anything interesting.
|
||||
*/
|
||||
tryGetEntityForSymbol(symbol) {
|
||||
return this._entitiesBySymbol.get(symbol);
|
||||
}
|
||||
/**
|
||||
* Returns the associated `CollectorEntity` for the given `astEntity`, if one was created during analysis.
|
||||
*/
|
||||
tryGetCollectorEntity(astEntity) {
|
||||
return this._entitiesByAstEntity.get(astEntity);
|
||||
}
|
||||
fetchSymbolMetadata(astSymbol) {
|
||||
if (astSymbol.symbolMetadata === undefined) {
|
||||
this._fetchSymbolMetadata(astSymbol);
|
||||
}
|
||||
return astSymbol.symbolMetadata;
|
||||
}
|
||||
fetchDeclarationMetadata(astDeclaration) {
|
||||
if (astDeclaration.declarationMetadata === undefined) {
|
||||
// Fetching the SymbolMetadata always constructs the DeclarationMetadata
|
||||
this._fetchSymbolMetadata(astDeclaration.astSymbol);
|
||||
}
|
||||
return astDeclaration.declarationMetadata;
|
||||
}
|
||||
fetchApiItemMetadata(astDeclaration) {
|
||||
if (astDeclaration.apiItemMetadata === undefined) {
|
||||
// Fetching the SymbolMetadata always constructs the ApiItemMetadata
|
||||
this._fetchSymbolMetadata(astDeclaration.astSymbol);
|
||||
}
|
||||
return astDeclaration.apiItemMetadata;
|
||||
}
|
||||
tryFetchMetadataForAstEntity(astEntity) {
|
||||
if (astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
return this.fetchSymbolMetadata(astEntity);
|
||||
}
|
||||
if (astEntity instanceof AstImport_1.AstImport) {
|
||||
if (astEntity.astSymbol) {
|
||||
return this.fetchSymbolMetadata(astEntity.astSymbol);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
isAncillaryDeclaration(astDeclaration) {
|
||||
const declarationMetadata = this.fetchDeclarationMetadata(astDeclaration);
|
||||
return declarationMetadata.isAncillary;
|
||||
}
|
||||
getNonAncillaryDeclarations(astSymbol) {
|
||||
const result = [];
|
||||
for (const astDeclaration of astSymbol.astDeclarations) {
|
||||
const declarationMetadata = this.fetchDeclarationMetadata(astDeclaration);
|
||||
if (!declarationMetadata.isAncillary) {
|
||||
result.push(astDeclaration);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Removes the leading underscore, for example: "_Example" --> "example*Example*_"
|
||||
*
|
||||
* @remarks
|
||||
* This causes internal definitions to sort alphabetically case-insensitive, then case-sensitive, and
|
||||
* initially ignoring the underscore prefix, while still deterministically comparing it.
|
||||
* The star is used as a delimiter because it is not a legal identifier character.
|
||||
*/
|
||||
static getSortKeyIgnoringUnderscore(identifier) {
|
||||
if (!identifier)
|
||||
return '';
|
||||
let parts;
|
||||
if (identifier[0] === '_') {
|
||||
const withoutUnderscore = identifier.substr(1);
|
||||
parts = [withoutUnderscore.toLowerCase(), '*', withoutUnderscore, '*', '_'];
|
||||
}
|
||||
else {
|
||||
parts = [identifier.toLowerCase(), '*', identifier];
|
||||
}
|
||||
return parts.join('');
|
||||
}
|
||||
/**
|
||||
* For function-like signatures, this returns the TSDoc "overload index" which can be used to identify
|
||||
* a specific overload.
|
||||
*/
|
||||
getOverloadIndex(astDeclaration) {
|
||||
const allDeclarations = astDeclaration.astSymbol.astDeclarations;
|
||||
if (allDeclarations.length === 1) {
|
||||
return 1; // trivial case
|
||||
}
|
||||
let overloadIndex = this._cachedOverloadIndexesByDeclaration.get(astDeclaration);
|
||||
if (overloadIndex === undefined) {
|
||||
// TSDoc index selectors are positive integers counting from 1
|
||||
let nextIndex = 1;
|
||||
for (const other of allDeclarations) {
|
||||
// Filter out other declarations that are not overloads. For example, an overloaded function can also
|
||||
// be a namespace.
|
||||
if (other.declaration.kind === astDeclaration.declaration.kind) {
|
||||
this._cachedOverloadIndexesByDeclaration.set(other, nextIndex);
|
||||
++nextIndex;
|
||||
}
|
||||
}
|
||||
overloadIndex = this._cachedOverloadIndexesByDeclaration.get(astDeclaration);
|
||||
}
|
||||
if (overloadIndex === undefined) {
|
||||
// This should never happen
|
||||
throw new node_core_library_1.InternalError('Error calculating overload index for declaration');
|
||||
}
|
||||
return overloadIndex;
|
||||
}
|
||||
_createCollectorEntity(astEntity, exportName, parent) {
|
||||
let entity = this._entitiesByAstEntity.get(astEntity);
|
||||
if (!entity) {
|
||||
entity = new CollectorEntity_1.CollectorEntity(astEntity);
|
||||
this._entitiesByAstEntity.set(astEntity, entity);
|
||||
if (astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
this._entitiesBySymbol.set(astEntity.followedSymbol, entity);
|
||||
}
|
||||
else if (astEntity instanceof AstNamespaceImport_1.AstNamespaceImport) {
|
||||
this._entitiesBySymbol.set(astEntity.symbol, entity);
|
||||
}
|
||||
this._entities.push(entity);
|
||||
this._collectReferenceDirectives(astEntity);
|
||||
}
|
||||
if (exportName) {
|
||||
if (parent) {
|
||||
entity.addLocalExportName(exportName, parent);
|
||||
}
|
||||
else {
|
||||
entity.addExportName(exportName);
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
_recursivelyCreateEntities(astEntity, alreadySeenAstEntities) {
|
||||
if (alreadySeenAstEntities.has(astEntity))
|
||||
return;
|
||||
alreadySeenAstEntities.add(astEntity);
|
||||
if (astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
astEntity.forEachDeclarationRecursive((astDeclaration) => {
|
||||
for (const referencedAstEntity of astDeclaration.referencedAstEntities) {
|
||||
if (referencedAstEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
// We only create collector entities for root-level symbols. For example, if a symbol is
|
||||
// nested inside a namespace, only the namespace gets a collector entity. Note that this
|
||||
// is not true for AstNamespaceImports below.
|
||||
if (referencedAstEntity.parentAstSymbol === undefined) {
|
||||
this._createCollectorEntity(referencedAstEntity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._createCollectorEntity(referencedAstEntity);
|
||||
}
|
||||
this._recursivelyCreateEntities(referencedAstEntity, alreadySeenAstEntities);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (astEntity instanceof AstNamespaceImport_1.AstNamespaceImport) {
|
||||
const astModuleExportInfo = astEntity.fetchAstModuleExportInfo(this);
|
||||
const parentEntity = this._entitiesByAstEntity.get(astEntity);
|
||||
if (!parentEntity) {
|
||||
// This should never happen, as we've already created entities for all AstNamespaceImports.
|
||||
throw new node_core_library_1.InternalError(`Failed to get CollectorEntity for AstNamespaceImport with namespace name "${astEntity.namespaceName}"`);
|
||||
}
|
||||
for (const [localExportName, localAstEntity] of astModuleExportInfo.exportedLocalEntities) {
|
||||
// Create a CollectorEntity for each local export within an AstNamespaceImport entity.
|
||||
this._createCollectorEntity(localAstEntity, localExportName, parentEntity);
|
||||
this._recursivelyCreateEntities(localAstEntity, alreadySeenAstEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Ensures a unique name for each item in the package typings file.
|
||||
*/
|
||||
_makeUniqueNames() {
|
||||
// The following examples illustrate the nameForEmit heuristics:
|
||||
//
|
||||
// Example 1:
|
||||
// class X { } <--- nameForEmit should be "A" to simplify things and reduce possibility of conflicts
|
||||
// export { X as A };
|
||||
//
|
||||
// Example 2:
|
||||
// class X { } <--- nameForEmit should be "X" because choosing A or B would be nondeterministic
|
||||
// export { X as A };
|
||||
// export { X as B };
|
||||
//
|
||||
// Example 3:
|
||||
// class X { } <--- nameForEmit should be "X_1" because Y has a stronger claim to the name
|
||||
// export { X as A };
|
||||
// export { X as B };
|
||||
// class Y { } <--- nameForEmit should be "X"
|
||||
// export { Y as X };
|
||||
// Set of names that should NOT be used when generating a unique nameForEmit
|
||||
const usedNames = new Set();
|
||||
// First collect the names of explicit package exports, and perform a sanity check.
|
||||
for (const entity of this._entities) {
|
||||
for (const exportName of entity.exportNames) {
|
||||
if (usedNames.has(exportName)) {
|
||||
// This should be impossible
|
||||
throw new node_core_library_1.InternalError(`A package cannot have two exports with the name "${exportName}"`);
|
||||
}
|
||||
usedNames.add(exportName);
|
||||
}
|
||||
}
|
||||
// Ensure that each entity has a unique nameForEmit
|
||||
for (const entity of this._entities) {
|
||||
// What name would we ideally want to emit it as?
|
||||
let idealNameForEmit;
|
||||
// If this entity is exported exactly once, then we prefer the exported name
|
||||
if (entity.singleExportName !== undefined &&
|
||||
entity.singleExportName !== ts.InternalSymbolName.Default) {
|
||||
idealNameForEmit = entity.singleExportName;
|
||||
}
|
||||
else {
|
||||
// otherwise use the local name
|
||||
idealNameForEmit = entity.astEntity.localName;
|
||||
}
|
||||
if (idealNameForEmit.includes('.')) {
|
||||
// For an ImportType with a namespace chain, only the top namespace is imported.
|
||||
idealNameForEmit = idealNameForEmit.split('.')[0];
|
||||
}
|
||||
// If the idealNameForEmit happens to be the same as one of the exports, then we're safe to use that...
|
||||
if (entity.exportNames.has(idealNameForEmit)) {
|
||||
// ...except that if it conflicts with a global name, then the global name wins
|
||||
if (!this.globalVariableAnalyzer.hasGlobalName(idealNameForEmit)) {
|
||||
// ...also avoid "default" which can interfere with "export { default } from 'some-module;'"
|
||||
if (idealNameForEmit !== 'default') {
|
||||
entity.nameForEmit = idealNameForEmit;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Generate a unique name based on idealNameForEmit
|
||||
let suffix = 1;
|
||||
let nameForEmit = idealNameForEmit;
|
||||
// Choose a name that doesn't conflict with usedNames or a global name
|
||||
while (nameForEmit === 'default' ||
|
||||
usedNames.has(nameForEmit) ||
|
||||
this.globalVariableAnalyzer.hasGlobalName(nameForEmit)) {
|
||||
nameForEmit = `${idealNameForEmit}_${++suffix}`;
|
||||
}
|
||||
entity.nameForEmit = nameForEmit;
|
||||
usedNames.add(nameForEmit);
|
||||
}
|
||||
}
|
||||
_fetchSymbolMetadata(astSymbol) {
|
||||
if (astSymbol.symbolMetadata) {
|
||||
return;
|
||||
}
|
||||
// When we solve an astSymbol, then we always also solve all of its parents and all of its declarations.
|
||||
// The parent is solved first.
|
||||
if (astSymbol.parentAstSymbol && astSymbol.parentAstSymbol.symbolMetadata === undefined) {
|
||||
this._fetchSymbolMetadata(astSymbol.parentAstSymbol);
|
||||
}
|
||||
// Construct the DeclarationMetadata objects, and detect any ancillary declarations
|
||||
this._calculateDeclarationMetadataForDeclarations(astSymbol);
|
||||
// Calculate the ApiItemMetadata objects
|
||||
for (const astDeclaration of astSymbol.astDeclarations) {
|
||||
this._calculateApiItemMetadata(astDeclaration);
|
||||
}
|
||||
// The most public effectiveReleaseTag for all declarations
|
||||
let maxEffectiveReleaseTag = api_extractor_model_1.ReleaseTag.None;
|
||||
for (const astDeclaration of astSymbol.astDeclarations) {
|
||||
// We know we solved this above
|
||||
const apiItemMetadata = astDeclaration.apiItemMetadata;
|
||||
const effectiveReleaseTag = apiItemMetadata.effectiveReleaseTag;
|
||||
if (effectiveReleaseTag > maxEffectiveReleaseTag) {
|
||||
maxEffectiveReleaseTag = effectiveReleaseTag;
|
||||
}
|
||||
}
|
||||
// Update this last when we're sure no exceptions were thrown
|
||||
astSymbol.symbolMetadata = new SymbolMetadata_1.SymbolMetadata({
|
||||
maxEffectiveReleaseTag
|
||||
});
|
||||
}
|
||||
_calculateDeclarationMetadataForDeclarations(astSymbol) {
|
||||
// Initialize DeclarationMetadata for each declaration
|
||||
for (const astDeclaration of astSymbol.astDeclarations) {
|
||||
if (astDeclaration.declarationMetadata) {
|
||||
throw new node_core_library_1.InternalError('AstDeclaration.declarationMetadata is not expected to have been initialized yet');
|
||||
}
|
||||
const metadata = new DeclarationMetadata_1.InternalDeclarationMetadata();
|
||||
metadata.tsdocParserContext = this._parseTsdocForAstDeclaration(astDeclaration);
|
||||
astDeclaration.declarationMetadata = metadata;
|
||||
}
|
||||
// Detect ancillary declarations
|
||||
for (const astDeclaration of astSymbol.astDeclarations) {
|
||||
// For a getter/setter pair, make the setter ancillary to the getter
|
||||
if (astDeclaration.declaration.kind === ts.SyntaxKind.SetAccessor) {
|
||||
let foundGetter = false;
|
||||
for (const getterAstDeclaration of astDeclaration.astSymbol.astDeclarations) {
|
||||
if (getterAstDeclaration.declaration.kind === ts.SyntaxKind.GetAccessor) {
|
||||
// Associate it with the getter
|
||||
this._addAncillaryDeclaration(getterAstDeclaration, astDeclaration);
|
||||
foundGetter = true;
|
||||
}
|
||||
}
|
||||
if (!foundGetter) {
|
||||
this.messageRouter.addAnalyzerIssue("ae-missing-getter" /* ExtractorMessageId.MissingGetter */, `The property "${astDeclaration.astSymbol.localName}" has a setter but no getter.`, astDeclaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_addAncillaryDeclaration(mainAstDeclaration, ancillaryAstDeclaration) {
|
||||
const mainMetadata = mainAstDeclaration.declarationMetadata;
|
||||
const ancillaryMetadata = ancillaryAstDeclaration.declarationMetadata;
|
||||
if (mainMetadata.ancillaryDeclarations.indexOf(ancillaryAstDeclaration) >= 0) {
|
||||
return; // already added
|
||||
}
|
||||
if (mainAstDeclaration.astSymbol !== ancillaryAstDeclaration.astSymbol) {
|
||||
throw new node_core_library_1.InternalError('Invalid call to _addAncillaryDeclaration() because declarations do not' +
|
||||
' belong to the same symbol');
|
||||
}
|
||||
if (mainMetadata.isAncillary) {
|
||||
throw new node_core_library_1.InternalError('Invalid call to _addAncillaryDeclaration() because the target is ancillary itself');
|
||||
}
|
||||
if (ancillaryMetadata.isAncillary) {
|
||||
throw new node_core_library_1.InternalError('Invalid call to _addAncillaryDeclaration() because source is already ancillary' +
|
||||
' to another declaration');
|
||||
}
|
||||
if (mainAstDeclaration.apiItemMetadata || ancillaryAstDeclaration.apiItemMetadata) {
|
||||
throw new node_core_library_1.InternalError('Invalid call to _addAncillaryDeclaration() because the API item metadata' +
|
||||
' has already been constructed');
|
||||
}
|
||||
ancillaryMetadata.isAncillary = true;
|
||||
mainMetadata.ancillaryDeclarations.push(ancillaryAstDeclaration);
|
||||
}
|
||||
_calculateApiItemMetadata(astDeclaration) {
|
||||
const declarationMetadata = astDeclaration.declarationMetadata;
|
||||
if (declarationMetadata.isAncillary) {
|
||||
if (astDeclaration.declaration.kind === ts.SyntaxKind.SetAccessor) {
|
||||
if (declarationMetadata.tsdocParserContext) {
|
||||
this.messageRouter.addAnalyzerIssue("ae-setter-with-docs" /* ExtractorMessageId.SetterWithDocs */, `The doc comment for the property "${astDeclaration.astSymbol.localName}"` +
|
||||
` must appear on the getter, not the setter.`, astDeclaration);
|
||||
}
|
||||
}
|
||||
// We never calculate ApiItemMetadata for an ancillary declaration; instead, it is assigned when
|
||||
// the main declaration is processed.
|
||||
return;
|
||||
}
|
||||
const options = {
|
||||
declaredReleaseTag: api_extractor_model_1.ReleaseTag.None,
|
||||
effectiveReleaseTag: api_extractor_model_1.ReleaseTag.None,
|
||||
isEventProperty: false,
|
||||
isOverride: false,
|
||||
isSealed: false,
|
||||
isVirtual: false,
|
||||
isPreapproved: false,
|
||||
releaseTagSameAsParent: false
|
||||
};
|
||||
const parserContext = declarationMetadata.tsdocParserContext;
|
||||
if (parserContext) {
|
||||
const modifierTagSet = parserContext.docComment.modifierTagSet;
|
||||
let declaredReleaseTag = api_extractor_model_1.ReleaseTag.None;
|
||||
let extraReleaseTags = false;
|
||||
if (modifierTagSet.isPublic()) {
|
||||
declaredReleaseTag = api_extractor_model_1.ReleaseTag.Public;
|
||||
}
|
||||
if (modifierTagSet.isBeta()) {
|
||||
if (declaredReleaseTag !== api_extractor_model_1.ReleaseTag.None) {
|
||||
extraReleaseTags = true;
|
||||
}
|
||||
else {
|
||||
declaredReleaseTag = api_extractor_model_1.ReleaseTag.Beta;
|
||||
}
|
||||
}
|
||||
if (modifierTagSet.isAlpha()) {
|
||||
if (declaredReleaseTag !== api_extractor_model_1.ReleaseTag.None) {
|
||||
extraReleaseTags = true;
|
||||
}
|
||||
else {
|
||||
declaredReleaseTag = api_extractor_model_1.ReleaseTag.Alpha;
|
||||
}
|
||||
}
|
||||
if (modifierTagSet.isInternal()) {
|
||||
if (declaredReleaseTag !== api_extractor_model_1.ReleaseTag.None) {
|
||||
extraReleaseTags = true;
|
||||
}
|
||||
else {
|
||||
declaredReleaseTag = api_extractor_model_1.ReleaseTag.Internal;
|
||||
}
|
||||
}
|
||||
if (extraReleaseTags) {
|
||||
if (!astDeclaration.astSymbol.isExternal) {
|
||||
// for now, don't report errors for external code
|
||||
this.messageRouter.addAnalyzerIssue("ae-extra-release-tag" /* ExtractorMessageId.ExtraReleaseTag */, 'The doc comment should not contain more than one release tag', astDeclaration);
|
||||
}
|
||||
}
|
||||
options.declaredReleaseTag = declaredReleaseTag;
|
||||
options.isEventProperty = modifierTagSet.isEventProperty();
|
||||
options.isOverride = modifierTagSet.isOverride();
|
||||
options.isSealed = modifierTagSet.isSealed();
|
||||
options.isVirtual = modifierTagSet.isVirtual();
|
||||
const preapprovedTag = this.extractorConfig.tsdocConfiguration.tryGetTagDefinition('@preapproved');
|
||||
if (preapprovedTag && modifierTagSet.hasTag(preapprovedTag)) {
|
||||
// This feature only makes sense for potentially big declarations.
|
||||
switch (astDeclaration.declaration.kind) {
|
||||
case ts.SyntaxKind.ClassDeclaration:
|
||||
case ts.SyntaxKind.EnumDeclaration:
|
||||
case ts.SyntaxKind.InterfaceDeclaration:
|
||||
case ts.SyntaxKind.ModuleDeclaration:
|
||||
if (declaredReleaseTag === api_extractor_model_1.ReleaseTag.Internal) {
|
||||
options.isPreapproved = true;
|
||||
}
|
||||
else {
|
||||
this.messageRouter.addAnalyzerIssue("ae-preapproved-bad-release-tag" /* ExtractorMessageId.PreapprovedBadReleaseTag */, `The @preapproved tag cannot be applied to "${astDeclaration.astSymbol.localName}"` +
|
||||
` without an @internal release tag`, astDeclaration);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this.messageRouter.addAnalyzerIssue("ae-preapproved-unsupported-type" /* ExtractorMessageId.PreapprovedUnsupportedType */, `The @preapproved tag cannot be applied to "${astDeclaration.astSymbol.localName}"` +
|
||||
` because it is not a supported declaration type`, astDeclaration);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// This needs to be set regardless of whether or not a parserContext exists
|
||||
if (astDeclaration.parent) {
|
||||
const parentApiItemMetadata = this.fetchApiItemMetadata(astDeclaration.parent);
|
||||
options.effectiveReleaseTag =
|
||||
options.declaredReleaseTag === api_extractor_model_1.ReleaseTag.None
|
||||
? parentApiItemMetadata.effectiveReleaseTag
|
||||
: options.declaredReleaseTag;
|
||||
options.releaseTagSameAsParent =
|
||||
parentApiItemMetadata.effectiveReleaseTag === options.effectiveReleaseTag;
|
||||
}
|
||||
else {
|
||||
options.effectiveReleaseTag = options.declaredReleaseTag;
|
||||
}
|
||||
if (options.effectiveReleaseTag === api_extractor_model_1.ReleaseTag.None) {
|
||||
if (!astDeclaration.astSymbol.isExternal) {
|
||||
// for now, don't report errors for external code
|
||||
// Don't report missing release tags for forgotten exports (unless we're including forgotten exports
|
||||
// in either the API report or doc model).
|
||||
const astSymbol = astDeclaration.astSymbol;
|
||||
const entity = this._entitiesByAstEntity.get(astSymbol.rootAstSymbol);
|
||||
if (entity &&
|
||||
(entity.consumable ||
|
||||
this.extractorConfig.apiReportIncludeForgottenExports ||
|
||||
this.extractorConfig.docModelIncludeForgottenExports)) {
|
||||
// We also don't report errors for the default export of an entry point, since its doc comment
|
||||
// isn't easy to obtain from the .d.ts file
|
||||
if (astSymbol.rootAstSymbol.localName !== '_default') {
|
||||
this.messageRouter.addAnalyzerIssue("ae-missing-release-tag" /* ExtractorMessageId.MissingReleaseTag */, `"${entity.astEntity.localName}" is part of the package's API, but it is missing ` +
|
||||
`a release tag (@alpha, @beta, @public, or @internal)`, astSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
options.effectiveReleaseTag = api_extractor_model_1.ReleaseTag.Public;
|
||||
}
|
||||
const apiItemMetadata = new ApiItemMetadata_1.ApiItemMetadata(options);
|
||||
if (parserContext) {
|
||||
apiItemMetadata.tsdocComment = parserContext.docComment;
|
||||
}
|
||||
astDeclaration.apiItemMetadata = apiItemMetadata;
|
||||
// Lastly, share the result with any ancillary declarations
|
||||
for (const ancillaryDeclaration of declarationMetadata.ancillaryDeclarations) {
|
||||
ancillaryDeclaration.apiItemMetadata = apiItemMetadata;
|
||||
}
|
||||
}
|
||||
_parseTsdocForAstDeclaration(astDeclaration) {
|
||||
const declaration = astDeclaration.declaration;
|
||||
let nodeForComment = declaration;
|
||||
if (ts.isVariableDeclaration(declaration)) {
|
||||
// Variable declarations are special because they can be combined into a list. For example:
|
||||
//
|
||||
// /** A */ export /** B */ const /** C */ x = 1, /** D **/ [ /** E */ y, z] = [3, 4];
|
||||
//
|
||||
// The compiler will only emit comments A and C in the .d.ts file, so in general there isn't a well-defined
|
||||
// way to document these parts. API Extractor requires you to break them into separate exports like this:
|
||||
//
|
||||
// /** A */ export const x = 1;
|
||||
//
|
||||
// But _getReleaseTagForDeclaration() still receives a node corresponding to "x", so we need to walk upwards
|
||||
// and find the containing statement in order for getJSDocCommentRanges() to read the comment that we expect.
|
||||
const statement = TypeScriptHelpers_1.TypeScriptHelpers.findFirstParent(declaration, ts.SyntaxKind.VariableStatement);
|
||||
if (statement !== undefined) {
|
||||
// For a compound declaration, fall back to looking for C instead of A
|
||||
if (statement.declarationList.declarations.length === 1) {
|
||||
nodeForComment = statement;
|
||||
}
|
||||
}
|
||||
}
|
||||
const sourceFileText = declaration.getSourceFile().text;
|
||||
const ranges = TypeScriptInternals_1.TypeScriptInternals.getJSDocCommentRanges(nodeForComment, sourceFileText) || [];
|
||||
if (ranges.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
// We use the JSDoc comment block that is closest to the definition, i.e.
|
||||
// the last one preceding it
|
||||
const range = ranges[ranges.length - 1];
|
||||
const tsdocTextRange = tsdoc.TextRange.fromStringRange(sourceFileText, range.pos, range.end);
|
||||
const parserContext = this._tsdocParser.parseRange(tsdocTextRange);
|
||||
this.messageRouter.addTsdocMessages(parserContext, declaration.getSourceFile(), astDeclaration);
|
||||
// We delete the @privateRemarks block as early as possible, to ensure that it never leaks through
|
||||
// into one of the output files.
|
||||
parserContext.docComment.privateRemarks = undefined;
|
||||
return parserContext;
|
||||
}
|
||||
_collectReferenceDirectives(astEntity) {
|
||||
if (astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
const sourceFiles = astEntity.astDeclarations.map((astDeclaration) => astDeclaration.declaration.getSourceFile());
|
||||
return this._collectReferenceDirectivesFromSourceFiles(sourceFiles);
|
||||
}
|
||||
if (astEntity instanceof AstNamespaceImport_1.AstNamespaceImport) {
|
||||
const sourceFiles = [astEntity.astModule.sourceFile];
|
||||
return this._collectReferenceDirectivesFromSourceFiles(sourceFiles);
|
||||
}
|
||||
}
|
||||
_collectReferenceDirectivesFromSourceFiles(sourceFiles) {
|
||||
const seenFilenames = new Set();
|
||||
for (const sourceFile of sourceFiles) {
|
||||
if (sourceFile && sourceFile.fileName) {
|
||||
if (!seenFilenames.has(sourceFile.fileName)) {
|
||||
seenFilenames.add(sourceFile.fileName);
|
||||
for (const typeReferenceDirective of sourceFile.typeReferenceDirectives) {
|
||||
const name = sourceFile.text.substring(typeReferenceDirective.pos, typeReferenceDirective.end);
|
||||
this._dtsTypeReferenceDirectives.add(name);
|
||||
}
|
||||
for (const libReferenceDirective of sourceFile.libReferenceDirectives) {
|
||||
const name = sourceFile.text.substring(libReferenceDirective.pos, libReferenceDirective.end);
|
||||
this._dtsLibReferenceDirectives.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Collector = Collector;
|
||||
//# sourceMappingURL=Collector.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/Collector.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/Collector.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
135
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.d.ts
generated
vendored
Normal file
135
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.d.ts
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
import type { AstEntity } from '../analyzer/AstEntity';
|
||||
/**
|
||||
* This is a data structure used by the Collector to track an AstEntity that may be emitted in the *.d.ts file.
|
||||
*
|
||||
* @remarks
|
||||
* The additional contextual state beyond AstSymbol is:
|
||||
* - Whether it's an export of this entry point or not
|
||||
* - The nameForEmit, which may get renamed by DtsRollupGenerator._makeUniqueNames()
|
||||
* - The export name (or names, if the same symbol is exported multiple times)
|
||||
*/
|
||||
export declare class CollectorEntity {
|
||||
/**
|
||||
* The AstEntity that this entry represents.
|
||||
*/
|
||||
readonly astEntity: AstEntity;
|
||||
private _exportNames;
|
||||
private _exportNamesSorted;
|
||||
private _singleExportName;
|
||||
private _localExportNamesByParent;
|
||||
private _nameForEmit;
|
||||
private _sortKey;
|
||||
constructor(astEntity: AstEntity);
|
||||
/**
|
||||
* The declaration name that will be emitted in the .d.ts rollup, .api.md, and .api.json files. Generated by
|
||||
* `Collector._makeUniqueNames`. Be aware that the declaration may be renamed to avoid conflicts with (1)
|
||||
* global names (e.g. `Promise`) and (2) if local, other local names across different files.
|
||||
*/
|
||||
get nameForEmit(): string | undefined;
|
||||
set nameForEmit(value: string | undefined);
|
||||
/**
|
||||
* The list of export names if this symbol is exported from the entry point.
|
||||
*
|
||||
* @remarks
|
||||
* Note that a given symbol may be exported more than once:
|
||||
* ```
|
||||
* class X { }
|
||||
* export { X }
|
||||
* export { X as Y }
|
||||
* ```
|
||||
*/
|
||||
get exportNames(): ReadonlySet<string>;
|
||||
/**
|
||||
* If exportNames contains only one string, then singleExportName is that string.
|
||||
* In all other cases, it is undefined.
|
||||
*/
|
||||
get singleExportName(): string | undefined;
|
||||
/**
|
||||
* This is true if exportNames contains only one string, and the declaration can be exported using the inline syntax
|
||||
* such as "export class X { }" instead of "export { X }".
|
||||
*/
|
||||
get shouldInlineExport(): boolean;
|
||||
/**
|
||||
* Indicates that this entity is exported from the package entry point. Compare to `CollectorEntity.exported`.
|
||||
*/
|
||||
get exportedFromEntryPoint(): boolean;
|
||||
/**
|
||||
* Indicates that this entity is exported from its parent module (i.e. either the package entry point or
|
||||
* a local namespace). Compare to `CollectorEntity.consumable`.
|
||||
*
|
||||
* @remarks
|
||||
* In the example below:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Namespace `calculator` is neither exported nor consumable, function `add` is exported (from `calculator`)
|
||||
* but not consumable.
|
||||
*/
|
||||
get exported(): boolean;
|
||||
/**
|
||||
* Indicates that it is possible for a consumer of the API to "consume" this entity, either by importing
|
||||
* it directly or via a namespace. If an entity is not consumable, then API Extractor will report an
|
||||
* `ae-forgotten-export` warning. Compare to `CollectorEntity.exported`.
|
||||
*
|
||||
* @remarks
|
||||
* An API item is consumable if:
|
||||
*
|
||||
* 1. It is exported from the top-level entry point OR
|
||||
* 2. It is exported from a consumable parent entity.
|
||||
*
|
||||
* For an example of #2, consider how `AstNamespaceImport` entities are processed. A generated rollup.d.ts
|
||||
* might look like this:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* export { calculator }
|
||||
* ```
|
||||
*
|
||||
* In this example, `add` is exported via the consumable `calculator` namespace.
|
||||
*/
|
||||
get consumable(): boolean;
|
||||
/**
|
||||
* Return the first consumable parent that exports this entity. If there is none, returns
|
||||
* `undefined`.
|
||||
*/
|
||||
getFirstExportingConsumableParent(): CollectorEntity | undefined;
|
||||
/**
|
||||
* Adds a new export name to the entity.
|
||||
*/
|
||||
addExportName(exportName: string): void;
|
||||
/**
|
||||
* Adds a new local export name to the entity.
|
||||
*
|
||||
* @remarks
|
||||
* In the example below:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* `add` is the local export name for the `CollectorEntity` for `add`.
|
||||
*/
|
||||
addLocalExportName(localExportName: string, parent: CollectorEntity): void;
|
||||
/**
|
||||
* A sorting key used by DtsRollupGenerator._makeUniqueNames()
|
||||
*/
|
||||
getSortKey(): string;
|
||||
}
|
||||
//# sourceMappingURL=CollectorEntity.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"CollectorEntity.d.ts","sourceRoot":"","sources":["../../src/collector/CollectorEntity.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,SAAgB,SAAS,EAAE,SAAS,CAAC;IAErC,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,kBAAkB,CAAkB;IAC5C,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,yBAAyB,CAAgD;IAEjF,OAAO,CAAC,YAAY,CAAiC;IAErD,OAAO,CAAC,QAAQ,CAAiC;gBAE9B,SAAS,EAAE,SAAS;IAIvC;;;;OAIG;IACH,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAE3C;IAED,IAAW,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAG/C;IAED;;;;;;;;;;OAUG;IACH,IAAW,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,CAM5C;IAED;;;OAGG;IACH,IAAW,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAEhD;IAED;;;OAGG;IACH,IAAW,kBAAkB,IAAI,OAAO,CAYvC;IAED;;OAEG;IACH,IAAW,sBAAsB,IAAI,OAAO,CAE3C;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAW,QAAQ,IAAI,OAAO,CAY7B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAW,UAAU,IAAI,OAAO,CAY/B;IAED;;;OAGG;IACI,iCAAiC,IAAI,eAAe,GAAG,SAAS;IASvE;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAa9C;;;;;;;;;;;;;;;;OAgBG;IACI,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI;IAOjF;;OAEG;IACI,UAAU,IAAI,MAAM;CAM5B"}
|
241
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.js
generated
vendored
Normal file
241
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.js
generated
vendored
Normal file
@ -0,0 +1,241 @@
|
||||
"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.CollectorEntity = void 0;
|
||||
const ts = __importStar(require("typescript"));
|
||||
const AstSymbol_1 = require("../analyzer/AstSymbol");
|
||||
const Collector_1 = require("./Collector");
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
/**
|
||||
* This is a data structure used by the Collector to track an AstEntity that may be emitted in the *.d.ts file.
|
||||
*
|
||||
* @remarks
|
||||
* The additional contextual state beyond AstSymbol is:
|
||||
* - Whether it's an export of this entry point or not
|
||||
* - The nameForEmit, which may get renamed by DtsRollupGenerator._makeUniqueNames()
|
||||
* - The export name (or names, if the same symbol is exported multiple times)
|
||||
*/
|
||||
class CollectorEntity {
|
||||
constructor(astEntity) {
|
||||
this._exportNames = new Set();
|
||||
this._exportNamesSorted = false;
|
||||
this._singleExportName = undefined;
|
||||
this._localExportNamesByParent = new Map();
|
||||
this._nameForEmit = undefined;
|
||||
this._sortKey = undefined;
|
||||
this.astEntity = astEntity;
|
||||
}
|
||||
/**
|
||||
* The declaration name that will be emitted in the .d.ts rollup, .api.md, and .api.json files. Generated by
|
||||
* `Collector._makeUniqueNames`. Be aware that the declaration may be renamed to avoid conflicts with (1)
|
||||
* global names (e.g. `Promise`) and (2) if local, other local names across different files.
|
||||
*/
|
||||
get nameForEmit() {
|
||||
return this._nameForEmit;
|
||||
}
|
||||
set nameForEmit(value) {
|
||||
this._nameForEmit = value;
|
||||
this._sortKey = undefined; // invalidate the cached value
|
||||
}
|
||||
/**
|
||||
* The list of export names if this symbol is exported from the entry point.
|
||||
*
|
||||
* @remarks
|
||||
* Note that a given symbol may be exported more than once:
|
||||
* ```
|
||||
* class X { }
|
||||
* export { X }
|
||||
* export { X as Y }
|
||||
* ```
|
||||
*/
|
||||
get exportNames() {
|
||||
if (!this._exportNamesSorted) {
|
||||
node_core_library_1.Sort.sortSet(this._exportNames);
|
||||
this._exportNamesSorted = true;
|
||||
}
|
||||
return this._exportNames;
|
||||
}
|
||||
/**
|
||||
* If exportNames contains only one string, then singleExportName is that string.
|
||||
* In all other cases, it is undefined.
|
||||
*/
|
||||
get singleExportName() {
|
||||
return this._singleExportName;
|
||||
}
|
||||
/**
|
||||
* This is true if exportNames contains only one string, and the declaration can be exported using the inline syntax
|
||||
* such as "export class X { }" instead of "export { X }".
|
||||
*/
|
||||
get shouldInlineExport() {
|
||||
// We don't inline an AstImport
|
||||
if (this.astEntity instanceof AstSymbol_1.AstSymbol) {
|
||||
// We don't inline a symbol with more than one exported name
|
||||
if (this._singleExportName !== undefined && this._singleExportName !== ts.InternalSymbolName.Default) {
|
||||
// We can't inline a symbol whose emitted name is different from the export name
|
||||
if (this._nameForEmit === undefined || this._nameForEmit === this._singleExportName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Indicates that this entity is exported from the package entry point. Compare to `CollectorEntity.exported`.
|
||||
*/
|
||||
get exportedFromEntryPoint() {
|
||||
return this.exportNames.size > 0;
|
||||
}
|
||||
/**
|
||||
* Indicates that this entity is exported from its parent module (i.e. either the package entry point or
|
||||
* a local namespace). Compare to `CollectorEntity.consumable`.
|
||||
*
|
||||
* @remarks
|
||||
* In the example below:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Namespace `calculator` is neither exported nor consumable, function `add` is exported (from `calculator`)
|
||||
* but not consumable.
|
||||
*/
|
||||
get exported() {
|
||||
// Exported from top-level?
|
||||
if (this.exportedFromEntryPoint)
|
||||
return true;
|
||||
// Exported from parent?
|
||||
for (const localExportNames of this._localExportNamesByParent.values()) {
|
||||
if (localExportNames.size > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Indicates that it is possible for a consumer of the API to "consume" this entity, either by importing
|
||||
* it directly or via a namespace. If an entity is not consumable, then API Extractor will report an
|
||||
* `ae-forgotten-export` warning. Compare to `CollectorEntity.exported`.
|
||||
*
|
||||
* @remarks
|
||||
* An API item is consumable if:
|
||||
*
|
||||
* 1. It is exported from the top-level entry point OR
|
||||
* 2. It is exported from a consumable parent entity.
|
||||
*
|
||||
* For an example of #2, consider how `AstNamespaceImport` entities are processed. A generated rollup.d.ts
|
||||
* might look like this:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* export { calculator }
|
||||
* ```
|
||||
*
|
||||
* In this example, `add` is exported via the consumable `calculator` namespace.
|
||||
*/
|
||||
get consumable() {
|
||||
// Exported from top-level?
|
||||
if (this.exportedFromEntryPoint)
|
||||
return true;
|
||||
// Exported from consumable parent?
|
||||
for (const [parent, localExportNames] of this._localExportNamesByParent) {
|
||||
if (localExportNames.size > 0 && parent.consumable) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Return the first consumable parent that exports this entity. If there is none, returns
|
||||
* `undefined`.
|
||||
*/
|
||||
getFirstExportingConsumableParent() {
|
||||
for (const [parent, localExportNames] of this._localExportNamesByParent) {
|
||||
if (parent.consumable && localExportNames.size > 0) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Adds a new export name to the entity.
|
||||
*/
|
||||
addExportName(exportName) {
|
||||
if (!this._exportNames.has(exportName)) {
|
||||
this._exportNamesSorted = false;
|
||||
this._exportNames.add(exportName);
|
||||
if (this._exportNames.size === 1) {
|
||||
this._singleExportName = exportName;
|
||||
}
|
||||
else {
|
||||
this._singleExportName = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds a new local export name to the entity.
|
||||
*
|
||||
* @remarks
|
||||
* In the example below:
|
||||
*
|
||||
* ```ts
|
||||
* declare function add(): void;
|
||||
* declare namespace calculator {
|
||||
* export {
|
||||
* add
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* `add` is the local export name for the `CollectorEntity` for `add`.
|
||||
*/
|
||||
addLocalExportName(localExportName, parent) {
|
||||
const localExportNames = this._localExportNamesByParent.get(parent) || new Set();
|
||||
localExportNames.add(localExportName);
|
||||
this._localExportNamesByParent.set(parent, localExportNames);
|
||||
}
|
||||
/**
|
||||
* A sorting key used by DtsRollupGenerator._makeUniqueNames()
|
||||
*/
|
||||
getSortKey() {
|
||||
if (!this._sortKey) {
|
||||
this._sortKey = Collector_1.Collector.getSortKeyIgnoringUnderscore(this.nameForEmit || this.astEntity.localName);
|
||||
}
|
||||
return this._sortKey;
|
||||
}
|
||||
}
|
||||
exports.CollectorEntity = CollectorEntity;
|
||||
//# sourceMappingURL=CollectorEntity.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/CollectorEntity.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.d.ts
generated
vendored
Normal file
41
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.d.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import type * as tsdoc from '@microsoft/tsdoc';
|
||||
import type { AstDeclaration } from '../analyzer/AstDeclaration';
|
||||
/**
|
||||
* Stores the Collector's additional analysis for a specific `AstDeclaration` signature. This object is assigned to
|
||||
* `AstDeclaration.declarationMetadata` but consumers must always obtain it by calling
|
||||
* `Collector.fetchDeclarationMetadata()`.
|
||||
*
|
||||
* Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,
|
||||
* whereas a separate `DeclarationMetadata` object is created for each declaration.
|
||||
*/
|
||||
export declare abstract class DeclarationMetadata {
|
||||
/**
|
||||
* The ParserContext from when the TSDoc comment was parsed from the source code.
|
||||
* If the source code did not contain a doc comment, then this will be undefined.
|
||||
*
|
||||
* Note that if an ancillary declaration has a doc comment, it is tracked here, whereas
|
||||
* `ApiItemMetadata.tsdocComment` corresponds to documentation for the main declaration.
|
||||
*/
|
||||
abstract readonly tsdocParserContext: tsdoc.ParserContext | undefined;
|
||||
/**
|
||||
* If true, then this declaration is treated as part of another declaration.
|
||||
*/
|
||||
abstract readonly isAncillary: boolean;
|
||||
/**
|
||||
* A list of other declarations that are treated as being part of this declaration. For example, a property
|
||||
* getter/setter pair will be treated as a single API item, with the setter being treated as ancillary to the getter.
|
||||
*
|
||||
* If the `ancillaryDeclarations` array is non-empty, then `isAncillary` will be false for this declaration,
|
||||
* and `isAncillary` will be true for all the array items.
|
||||
*/
|
||||
abstract readonly ancillaryDeclarations: ReadonlyArray<AstDeclaration>;
|
||||
}
|
||||
/**
|
||||
* Used internally by the `Collector` to build up `DeclarationMetadata`.
|
||||
*/
|
||||
export declare class InternalDeclarationMetadata extends DeclarationMetadata {
|
||||
tsdocParserContext: tsdoc.ParserContext | undefined;
|
||||
isAncillary: boolean;
|
||||
ancillaryDeclarations: AstDeclaration[];
|
||||
}
|
||||
//# sourceMappingURL=DeclarationMetadata.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DeclarationMetadata.d.ts","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;GAOG;AACH,8BAAsB,mBAAmB;IACvC;;;;;;OAMG;IACH,kBAAyB,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAE7E;;OAEG;IACH,kBAAyB,WAAW,EAAE,OAAO,CAAC;IAE9C;;;;;;OAMG;IACH,kBAAyB,qBAAqB,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CAC/E;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,mBAAmB;IAC3D,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAa;IAEhE,WAAW,EAAE,OAAO,CAAS;IAE7B,qBAAqB,EAAE,cAAc,EAAE,CAAM;CACrD"}
|
29
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.js
generated
vendored
Normal file
29
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"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.InternalDeclarationMetadata = exports.DeclarationMetadata = void 0;
|
||||
/**
|
||||
* Stores the Collector's additional analysis for a specific `AstDeclaration` signature. This object is assigned to
|
||||
* `AstDeclaration.declarationMetadata` but consumers must always obtain it by calling
|
||||
* `Collector.fetchDeclarationMetadata()`.
|
||||
*
|
||||
* Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,
|
||||
* whereas a separate `DeclarationMetadata` object is created for each declaration.
|
||||
*/
|
||||
class DeclarationMetadata {
|
||||
}
|
||||
exports.DeclarationMetadata = DeclarationMetadata;
|
||||
/**
|
||||
* Used internally by the `Collector` to build up `DeclarationMetadata`.
|
||||
*/
|
||||
class InternalDeclarationMetadata extends DeclarationMetadata {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.tsdocParserContext = undefined;
|
||||
this.isAncillary = false;
|
||||
this.ancillaryDeclarations = [];
|
||||
}
|
||||
}
|
||||
exports.InternalDeclarationMetadata = InternalDeclarationMetadata;
|
||||
//# sourceMappingURL=DeclarationMetadata.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/DeclarationMetadata.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"DeclarationMetadata.js","sourceRoot":"","sources":["../../src/collector/DeclarationMetadata.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D;;;;;;;GAOG;AACH,MAAsB,mBAAmB;CAuBxC;AAvBD,kDAuBC;AAED;;GAEG;AACH,MAAa,2BAA4B,SAAQ,mBAAmB;IAApE;;QACS,uBAAkB,GAAoC,SAAS,CAAC;QAEhE,gBAAW,GAAY,KAAK,CAAC;QAE7B,0BAAqB,GAAqB,EAAE,CAAC;IACtD,CAAC;CAAA;AAND,kEAMC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as tsdoc from '@microsoft/tsdoc';\nimport type { AstDeclaration } from '../analyzer/AstDeclaration';\n\n/**\n * Stores the Collector's additional analysis for a specific `AstDeclaration` signature. This object is assigned to\n * `AstDeclaration.declarationMetadata` but consumers must always obtain it by calling\n * `Collector.fetchDeclarationMetadata()`.\n *\n * Note that ancillary declarations share their `ApiItemMetadata` with the main declaration,\n * whereas a separate `DeclarationMetadata` object is created for each declaration.\n */\nexport abstract class DeclarationMetadata {\n /**\n * The ParserContext from when the TSDoc comment was parsed from the source code.\n * If the source code did not contain a doc comment, then this will be undefined.\n *\n * Note that if an ancillary declaration has a doc comment, it is tracked here, whereas\n * `ApiItemMetadata.tsdocComment` corresponds to documentation for the main declaration.\n */\n public abstract readonly tsdocParserContext: tsdoc.ParserContext | undefined;\n\n /**\n * If true, then this declaration is treated as part of another declaration.\n */\n public abstract readonly isAncillary: boolean;\n\n /**\n * A list of other declarations that are treated as being part of this declaration. For example, a property\n * getter/setter pair will be treated as a single API item, with the setter being treated as ancillary to the getter.\n *\n * If the `ancillaryDeclarations` array is non-empty, then `isAncillary` will be false for this declaration,\n * and `isAncillary` will be true for all the array items.\n */\n public abstract readonly ancillaryDeclarations: ReadonlyArray<AstDeclaration>;\n}\n\n/**\n * Used internally by the `Collector` to build up `DeclarationMetadata`.\n */\nexport class InternalDeclarationMetadata extends DeclarationMetadata {\n public tsdocParserContext: tsdoc.ParserContext | undefined = undefined;\n\n public isAncillary: boolean = false;\n\n public ancillaryDeclarations: AstDeclaration[] = [];\n}\n"]}
|
121
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.d.ts
generated
vendored
Normal file
121
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.d.ts
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
import * as ts from 'typescript';
|
||||
import type * as tsdoc from '@microsoft/tsdoc';
|
||||
import { AstDeclaration } from '../analyzer/AstDeclaration';
|
||||
import type { AstSymbol } from '../analyzer/AstSymbol';
|
||||
import { ExtractorMessage, type IExtractorMessageProperties } from '../api/ExtractorMessage';
|
||||
import { type ExtractorMessageId } from '../api/ExtractorMessageId';
|
||||
import type { IExtractorMessagesConfig } from '../api/IConfigFile';
|
||||
import type { SourceMapper } from './SourceMapper';
|
||||
import { ConsoleMessageId } from '../api/ConsoleMessageId';
|
||||
export interface IMessageRouterOptions {
|
||||
workingPackageFolder: string | undefined;
|
||||
messageCallback: ((message: ExtractorMessage) => void) | undefined;
|
||||
messagesConfig: IExtractorMessagesConfig;
|
||||
showVerboseMessages: boolean;
|
||||
showDiagnostics: boolean;
|
||||
tsdocConfiguration: tsdoc.TSDocConfiguration;
|
||||
sourceMapper: SourceMapper;
|
||||
}
|
||||
export interface IBuildJsonDumpObjectOptions {
|
||||
/**
|
||||
* {@link MessageRouter.buildJsonDumpObject} will omit any objects keys with these names.
|
||||
*/
|
||||
keyNamesToOmit?: string[];
|
||||
}
|
||||
export declare class MessageRouter {
|
||||
static readonly DIAGNOSTICS_LINE: string;
|
||||
private readonly _workingPackageFolder;
|
||||
private readonly _messageCallback;
|
||||
private readonly _messages;
|
||||
private readonly _associatedMessagesForAstDeclaration;
|
||||
private readonly _sourceMapper;
|
||||
private readonly _tsdocConfiguration;
|
||||
private _reportingRuleByMessageId;
|
||||
private _compilerDefaultRule;
|
||||
private _extractorDefaultRule;
|
||||
private _tsdocDefaultRule;
|
||||
errorCount: number;
|
||||
warningCount: number;
|
||||
/**
|
||||
* See {@link IExtractorInvokeOptions.showVerboseMessages}
|
||||
*/
|
||||
readonly showVerboseMessages: boolean;
|
||||
/**
|
||||
* See {@link IExtractorInvokeOptions.showDiagnostics}
|
||||
*/
|
||||
readonly showDiagnostics: boolean;
|
||||
constructor(options: IMessageRouterOptions);
|
||||
/**
|
||||
* Read the api-extractor.json configuration and build up the tables of routing rules.
|
||||
*/
|
||||
private _applyMessagesConfig;
|
||||
private static _getNormalizedRule;
|
||||
get messages(): ReadonlyArray<ExtractorMessage>;
|
||||
/**
|
||||
* Add a diagnostic message reported by the TypeScript compiler
|
||||
*/
|
||||
addCompilerDiagnostic(diagnostic: ts.Diagnostic): void;
|
||||
/**
|
||||
* Add a message from the API Extractor analysis
|
||||
*/
|
||||
addAnalyzerIssue(messageId: ExtractorMessageId, messageText: string, astDeclarationOrSymbol: AstDeclaration | AstSymbol, properties?: IExtractorMessageProperties): void;
|
||||
/**
|
||||
* Add all messages produced from an invocation of the TSDoc parser, assuming they refer to
|
||||
* code in the specified source file.
|
||||
*/
|
||||
addTsdocMessages(parserContext: tsdoc.ParserContext, sourceFile: ts.SourceFile, astDeclaration?: AstDeclaration): void;
|
||||
/**
|
||||
* Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that
|
||||
* is JSON serializable. This is used by the "--diagnostics" feature to dump the state of configuration objects.
|
||||
*
|
||||
* @returns a JSON serializable object (possibly including `null` values)
|
||||
* or `undefined` if the input cannot be represented as JSON
|
||||
*/
|
||||
static buildJsonDumpObject(input: any, options?: IBuildJsonDumpObjectOptions): any | undefined;
|
||||
private static _buildJsonDumpObject;
|
||||
/**
|
||||
* Record this message in _associatedMessagesForAstDeclaration
|
||||
*/
|
||||
private _associateMessageWithAstDeclaration;
|
||||
/**
|
||||
* Add a message for a location in an arbitrary source file.
|
||||
*/
|
||||
addAnalyzerIssueForPosition(messageId: ExtractorMessageId, messageText: string, sourceFile: ts.SourceFile, pos: number, properties?: IExtractorMessageProperties): ExtractorMessage;
|
||||
/**
|
||||
* This is used when writing the API report file. It looks up any messages that were configured to get emitted
|
||||
* in the API report file and returns them. It also records that they were emitted, which suppresses them from
|
||||
* being shown on the console.
|
||||
*/
|
||||
fetchAssociatedMessagesForReviewFile(astDeclaration: AstDeclaration): ExtractorMessage[];
|
||||
/**
|
||||
* This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not
|
||||
* retreieved using `fetchAssociatedMessagesForReviewFile()`.
|
||||
*/
|
||||
fetchUnassociatedMessagesForReviewFile(): ExtractorMessage[];
|
||||
/**
|
||||
* This returns the list of remaining messages that were not already processed by
|
||||
* `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.
|
||||
* These messages will be shown on the console.
|
||||
*/
|
||||
handleRemainingNonConsoleMessages(): void;
|
||||
logError(messageId: ConsoleMessageId, message: string, properties?: IExtractorMessageProperties): void;
|
||||
logWarning(messageId: ConsoleMessageId, message: string, properties?: IExtractorMessageProperties): void;
|
||||
logInfo(messageId: ConsoleMessageId, message: string, properties?: IExtractorMessageProperties): void;
|
||||
logVerbose(messageId: ConsoleMessageId, message: string, properties?: IExtractorMessageProperties): void;
|
||||
logDiagnosticHeader(title: string): void;
|
||||
logDiagnosticFooter(): void;
|
||||
logDiagnostic(message: string): void;
|
||||
/**
|
||||
* Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.
|
||||
*/
|
||||
private _handleMessage;
|
||||
/**
|
||||
* For a given message, determine the IReportingRule based on the rule tables.
|
||||
*/
|
||||
private _getRuleForMessage;
|
||||
/**
|
||||
* Sorts an array of messages according to a reasonable ordering
|
||||
*/
|
||||
private _sortMessagesForOutput;
|
||||
}
|
||||
//# sourceMappingURL=MessageRouter.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"MessageRouter.d.ts","sourceRoot":"","sources":["../../src/collector/MessageRouter.ts"],"names":[],"mappings":"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"}
|
504
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.js
generated
vendored
Normal file
504
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.js
generated
vendored
Normal file
@ -0,0 +1,504 @@
|
||||
"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.MessageRouter = void 0;
|
||||
const colors_1 = __importDefault(require("colors"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const AstDeclaration_1 = require("../analyzer/AstDeclaration");
|
||||
const ExtractorMessage_1 = require("../api/ExtractorMessage");
|
||||
const ExtractorMessageId_1 = require("../api/ExtractorMessageId");
|
||||
class MessageRouter {
|
||||
constructor(options) {
|
||||
// Normalized representation of the routing rules from api-extractor.json
|
||||
this._reportingRuleByMessageId = new Map();
|
||||
this._compilerDefaultRule = {
|
||||
logLevel: "none" /* ExtractorLogLevel.None */,
|
||||
addToApiReportFile: false
|
||||
};
|
||||
this._extractorDefaultRule = {
|
||||
logLevel: "none" /* ExtractorLogLevel.None */,
|
||||
addToApiReportFile: false
|
||||
};
|
||||
this._tsdocDefaultRule = { logLevel: "none" /* ExtractorLogLevel.None */, addToApiReportFile: false };
|
||||
this.errorCount = 0;
|
||||
this.warningCount = 0;
|
||||
this._workingPackageFolder = options.workingPackageFolder;
|
||||
this._messageCallback = options.messageCallback;
|
||||
this._messages = [];
|
||||
this._associatedMessagesForAstDeclaration = new Map();
|
||||
this._sourceMapper = options.sourceMapper;
|
||||
this._tsdocConfiguration = options.tsdocConfiguration;
|
||||
// showDiagnostics implies showVerboseMessages
|
||||
this.showVerboseMessages = options.showVerboseMessages || options.showDiagnostics;
|
||||
this.showDiagnostics = options.showDiagnostics;
|
||||
this._applyMessagesConfig(options.messagesConfig);
|
||||
}
|
||||
/**
|
||||
* Read the api-extractor.json configuration and build up the tables of routing rules.
|
||||
*/
|
||||
_applyMessagesConfig(messagesConfig) {
|
||||
if (messagesConfig.compilerMessageReporting) {
|
||||
for (const messageId of Object.getOwnPropertyNames(messagesConfig.compilerMessageReporting)) {
|
||||
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.compilerMessageReporting[messageId]);
|
||||
if (messageId === 'default') {
|
||||
this._compilerDefaultRule = reportingRule;
|
||||
}
|
||||
else if (!/^TS[0-9]+$/.test(messageId)) {
|
||||
throw new Error(`Error in API Extractor config: The messages.compilerMessageReporting table contains` +
|
||||
` an invalid entry "${messageId}". The identifier format is "TS" followed by an integer.`);
|
||||
}
|
||||
else {
|
||||
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messagesConfig.extractorMessageReporting) {
|
||||
for (const messageId of Object.getOwnPropertyNames(messagesConfig.extractorMessageReporting)) {
|
||||
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.extractorMessageReporting[messageId]);
|
||||
if (messageId === 'default') {
|
||||
this._extractorDefaultRule = reportingRule;
|
||||
}
|
||||
else if (!/^ae-/.test(messageId)) {
|
||||
throw new Error(`Error in API Extractor config: The messages.extractorMessageReporting table contains` +
|
||||
` an invalid entry "${messageId}". The name should begin with the "ae-" prefix.`);
|
||||
}
|
||||
else if (!ExtractorMessageId_1.allExtractorMessageIds.has(messageId)) {
|
||||
throw new Error(`Error in API Extractor config: The messages.extractorMessageReporting table contains` +
|
||||
` an unrecognized identifier "${messageId}". Is it spelled correctly?`);
|
||||
}
|
||||
else {
|
||||
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messagesConfig.tsdocMessageReporting) {
|
||||
for (const messageId of Object.getOwnPropertyNames(messagesConfig.tsdocMessageReporting)) {
|
||||
const reportingRule = MessageRouter._getNormalizedRule(messagesConfig.tsdocMessageReporting[messageId]);
|
||||
if (messageId === 'default') {
|
||||
this._tsdocDefaultRule = reportingRule;
|
||||
}
|
||||
else if (!/^tsdoc-/.test(messageId)) {
|
||||
throw new Error(`Error in API Extractor config: The messages.tsdocMessageReporting table contains` +
|
||||
` an invalid entry "${messageId}". The name should begin with the "tsdoc-" prefix.`);
|
||||
}
|
||||
else if (!this._tsdocConfiguration.isKnownMessageId(messageId)) {
|
||||
throw new Error(`Error in API Extractor config: The messages.tsdocMessageReporting table contains` +
|
||||
` an unrecognized identifier "${messageId}". Is it spelled correctly?`);
|
||||
}
|
||||
else {
|
||||
this._reportingRuleByMessageId.set(messageId, reportingRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static _getNormalizedRule(rule) {
|
||||
return {
|
||||
logLevel: rule.logLevel || 'none',
|
||||
addToApiReportFile: rule.addToApiReportFile || false
|
||||
};
|
||||
}
|
||||
get messages() {
|
||||
return this._messages;
|
||||
}
|
||||
/**
|
||||
* Add a diagnostic message reported by the TypeScript compiler
|
||||
*/
|
||||
addCompilerDiagnostic(diagnostic) {
|
||||
switch (diagnostic.category) {
|
||||
case ts.DiagnosticCategory.Suggestion:
|
||||
case ts.DiagnosticCategory.Message:
|
||||
return; // ignore noise
|
||||
}
|
||||
const messageText = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
const options = {
|
||||
category: "Compiler" /* ExtractorMessageCategory.Compiler */,
|
||||
messageId: `TS${diagnostic.code}`,
|
||||
text: messageText
|
||||
};
|
||||
if (diagnostic.file) {
|
||||
// NOTE: Since compiler errors pertain to issues specific to the .d.ts files,
|
||||
// we do not apply source mappings for them.
|
||||
const sourceFile = diagnostic.file;
|
||||
const sourceLocation = this._sourceMapper.getSourceLocation({
|
||||
sourceFile,
|
||||
pos: diagnostic.start || 0,
|
||||
useDtsLocation: true
|
||||
});
|
||||
options.sourceFilePath = sourceLocation.sourceFilePath;
|
||||
options.sourceFileLine = sourceLocation.sourceFileLine;
|
||||
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
||||
}
|
||||
this._messages.push(new ExtractorMessage_1.ExtractorMessage(options));
|
||||
}
|
||||
/**
|
||||
* Add a message from the API Extractor analysis
|
||||
*/
|
||||
addAnalyzerIssue(messageId, messageText, astDeclarationOrSymbol, properties) {
|
||||
let astDeclaration;
|
||||
if (astDeclarationOrSymbol instanceof AstDeclaration_1.AstDeclaration) {
|
||||
astDeclaration = astDeclarationOrSymbol;
|
||||
}
|
||||
else {
|
||||
astDeclaration = astDeclarationOrSymbol.astDeclarations[0];
|
||||
}
|
||||
const extractorMessage = this.addAnalyzerIssueForPosition(messageId, messageText, astDeclaration.declaration.getSourceFile(), astDeclaration.declaration.getStart(), properties);
|
||||
this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);
|
||||
}
|
||||
/**
|
||||
* Add all messages produced from an invocation of the TSDoc parser, assuming they refer to
|
||||
* code in the specified source file.
|
||||
*/
|
||||
addTsdocMessages(parserContext, sourceFile, astDeclaration) {
|
||||
for (const message of parserContext.log.messages) {
|
||||
const options = {
|
||||
category: "TSDoc" /* ExtractorMessageCategory.TSDoc */,
|
||||
messageId: message.messageId,
|
||||
text: message.unformattedText
|
||||
};
|
||||
const sourceLocation = this._sourceMapper.getSourceLocation({
|
||||
sourceFile,
|
||||
pos: message.textRange.pos
|
||||
});
|
||||
options.sourceFilePath = sourceLocation.sourceFilePath;
|
||||
options.sourceFileLine = sourceLocation.sourceFileLine;
|
||||
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
||||
const extractorMessage = new ExtractorMessage_1.ExtractorMessage(options);
|
||||
if (astDeclaration) {
|
||||
this._associateMessageWithAstDeclaration(extractorMessage, astDeclaration);
|
||||
}
|
||||
this._messages.push(extractorMessage);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Recursively collects the primitive members (numbers, strings, arrays, etc) into an object that
|
||||
* is JSON serializable. This is used by the "--diagnostics" feature to dump the state of configuration objects.
|
||||
*
|
||||
* @returns a JSON serializable object (possibly including `null` values)
|
||||
* or `undefined` if the input cannot be represented as JSON
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
static buildJsonDumpObject(input, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const keyNamesToOmit = new Set(options.keyNamesToOmit);
|
||||
return MessageRouter._buildJsonDumpObject(input, keyNamesToOmit);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
static _buildJsonDumpObject(input, keyNamesToOmit) {
|
||||
if (input === null || input === undefined) {
|
||||
return null; // JSON uses null instead of undefined
|
||||
}
|
||||
switch (typeof input) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
case 'string':
|
||||
return input;
|
||||
case 'object':
|
||||
if (Array.isArray(input)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const outputArray = [];
|
||||
for (const element of input) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const serializedElement = MessageRouter._buildJsonDumpObject(element, keyNamesToOmit);
|
||||
if (serializedElement !== undefined) {
|
||||
outputArray.push(serializedElement);
|
||||
}
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
const outputObject = {};
|
||||
for (const key of Object.getOwnPropertyNames(input)) {
|
||||
if (keyNamesToOmit.has(key)) {
|
||||
continue;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const value = input[key];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const serializedValue = MessageRouter._buildJsonDumpObject(value, keyNamesToOmit);
|
||||
if (serializedValue !== undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
outputObject[key] = serializedValue;
|
||||
}
|
||||
}
|
||||
return outputObject;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Record this message in _associatedMessagesForAstDeclaration
|
||||
*/
|
||||
_associateMessageWithAstDeclaration(extractorMessage, astDeclaration) {
|
||||
let associatedMessages = this._associatedMessagesForAstDeclaration.get(astDeclaration);
|
||||
if (!associatedMessages) {
|
||||
associatedMessages = [];
|
||||
this._associatedMessagesForAstDeclaration.set(astDeclaration, associatedMessages);
|
||||
}
|
||||
associatedMessages.push(extractorMessage);
|
||||
}
|
||||
/**
|
||||
* Add a message for a location in an arbitrary source file.
|
||||
*/
|
||||
addAnalyzerIssueForPosition(messageId, messageText, sourceFile, pos, properties) {
|
||||
const options = {
|
||||
category: "Extractor" /* ExtractorMessageCategory.Extractor */,
|
||||
messageId,
|
||||
text: messageText,
|
||||
properties
|
||||
};
|
||||
const sourceLocation = this._sourceMapper.getSourceLocation({
|
||||
sourceFile,
|
||||
pos
|
||||
});
|
||||
options.sourceFilePath = sourceLocation.sourceFilePath;
|
||||
options.sourceFileLine = sourceLocation.sourceFileLine;
|
||||
options.sourceFileColumn = sourceLocation.sourceFileColumn;
|
||||
const extractorMessage = new ExtractorMessage_1.ExtractorMessage(options);
|
||||
this._messages.push(extractorMessage);
|
||||
return extractorMessage;
|
||||
}
|
||||
/**
|
||||
* This is used when writing the API report file. It looks up any messages that were configured to get emitted
|
||||
* in the API report file and returns them. It also records that they were emitted, which suppresses them from
|
||||
* being shown on the console.
|
||||
*/
|
||||
fetchAssociatedMessagesForReviewFile(astDeclaration) {
|
||||
const messagesForApiReportFile = [];
|
||||
const associatedMessages = this._associatedMessagesForAstDeclaration.get(astDeclaration) || [];
|
||||
for (const associatedMessage of associatedMessages) {
|
||||
// Make sure we didn't already report this message for some reason
|
||||
if (!associatedMessage.handled) {
|
||||
// Is this message type configured to go in the API report file?
|
||||
const reportingRule = this._getRuleForMessage(associatedMessage);
|
||||
if (reportingRule.addToApiReportFile) {
|
||||
// Include it in the result, and record that it went to the API report file
|
||||
messagesForApiReportFile.push(associatedMessage);
|
||||
associatedMessage.handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._sortMessagesForOutput(messagesForApiReportFile);
|
||||
return messagesForApiReportFile;
|
||||
}
|
||||
/**
|
||||
* This returns all remaining messages that were flagged with `addToApiReportFile`, but which were not
|
||||
* retreieved using `fetchAssociatedMessagesForReviewFile()`.
|
||||
*/
|
||||
fetchUnassociatedMessagesForReviewFile() {
|
||||
const messagesForApiReportFile = [];
|
||||
for (const unassociatedMessage of this.messages) {
|
||||
// Make sure we didn't already report this message for some reason
|
||||
if (!unassociatedMessage.handled) {
|
||||
// Is this message type configured to go in the API report file?
|
||||
const reportingRule = this._getRuleForMessage(unassociatedMessage);
|
||||
if (reportingRule.addToApiReportFile) {
|
||||
// Include it in the result, and record that it went to the API report file
|
||||
messagesForApiReportFile.push(unassociatedMessage);
|
||||
unassociatedMessage.handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._sortMessagesForOutput(messagesForApiReportFile);
|
||||
return messagesForApiReportFile;
|
||||
}
|
||||
/**
|
||||
* This returns the list of remaining messages that were not already processed by
|
||||
* `fetchAssociatedMessagesForReviewFile()` or `fetchUnassociatedMessagesForReviewFile()`.
|
||||
* These messages will be shown on the console.
|
||||
*/
|
||||
handleRemainingNonConsoleMessages() {
|
||||
const messagesForLogger = [];
|
||||
for (const message of this.messages) {
|
||||
// Make sure we didn't already report this message
|
||||
if (!message.handled) {
|
||||
messagesForLogger.push(message);
|
||||
}
|
||||
}
|
||||
this._sortMessagesForOutput(messagesForLogger);
|
||||
for (const message of messagesForLogger) {
|
||||
this._handleMessage(message);
|
||||
}
|
||||
}
|
||||
logError(messageId, message, properties) {
|
||||
this._handleMessage(new ExtractorMessage_1.ExtractorMessage({
|
||||
category: "console" /* ExtractorMessageCategory.Console */,
|
||||
messageId,
|
||||
text: message,
|
||||
properties,
|
||||
logLevel: "error" /* ExtractorLogLevel.Error */
|
||||
}));
|
||||
}
|
||||
logWarning(messageId, message, properties) {
|
||||
this._handleMessage(new ExtractorMessage_1.ExtractorMessage({
|
||||
category: "console" /* ExtractorMessageCategory.Console */,
|
||||
messageId,
|
||||
text: message,
|
||||
properties,
|
||||
logLevel: "warning" /* ExtractorLogLevel.Warning */
|
||||
}));
|
||||
}
|
||||
logInfo(messageId, message, properties) {
|
||||
this._handleMessage(new ExtractorMessage_1.ExtractorMessage({
|
||||
category: "console" /* ExtractorMessageCategory.Console */,
|
||||
messageId,
|
||||
text: message,
|
||||
properties,
|
||||
logLevel: "info" /* ExtractorLogLevel.Info */
|
||||
}));
|
||||
}
|
||||
logVerbose(messageId, message, properties) {
|
||||
this._handleMessage(new ExtractorMessage_1.ExtractorMessage({
|
||||
category: "console" /* ExtractorMessageCategory.Console */,
|
||||
messageId,
|
||||
text: message,
|
||||
properties,
|
||||
logLevel: "verbose" /* ExtractorLogLevel.Verbose */
|
||||
}));
|
||||
}
|
||||
logDiagnosticHeader(title) {
|
||||
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);
|
||||
this.logDiagnostic(`DIAGNOSTIC: ` + title);
|
||||
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE);
|
||||
}
|
||||
logDiagnosticFooter() {
|
||||
this.logDiagnostic(MessageRouter.DIAGNOSTICS_LINE + '\n');
|
||||
}
|
||||
logDiagnostic(message) {
|
||||
if (this.showDiagnostics) {
|
||||
this.logVerbose("console-diagnostics" /* ConsoleMessageId.Diagnostics */, message);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Give the calling application a chance to handle the `ExtractorMessage`, and if not, display it on the console.
|
||||
*/
|
||||
_handleMessage(message) {
|
||||
// Don't tally messages that were already "handled" by writing them into the API report
|
||||
if (message.handled) {
|
||||
return;
|
||||
}
|
||||
// Assign the ExtractorMessage.logLevel; the message callback may adjust it below
|
||||
if (message.category === "console" /* ExtractorMessageCategory.Console */) {
|
||||
// Console messages have their category log level assigned via logInfo(), logVerbose(), etc.
|
||||
}
|
||||
else {
|
||||
const reportingRule = this._getRuleForMessage(message);
|
||||
message.logLevel = reportingRule.logLevel;
|
||||
}
|
||||
// If there is a callback, allow it to modify and/or handle the message
|
||||
if (this._messageCallback) {
|
||||
this._messageCallback(message);
|
||||
}
|
||||
// Update the statistics
|
||||
switch (message.logLevel) {
|
||||
case "error" /* ExtractorLogLevel.Error */:
|
||||
++this.errorCount;
|
||||
break;
|
||||
case "warning" /* ExtractorLogLevel.Warning */:
|
||||
++this.warningCount;
|
||||
break;
|
||||
}
|
||||
if (message.handled) {
|
||||
return;
|
||||
}
|
||||
// The messageCallback did not handle the message, so perform default handling
|
||||
message.handled = true;
|
||||
if (message.logLevel === "none" /* ExtractorLogLevel.None */) {
|
||||
return;
|
||||
}
|
||||
let messageText;
|
||||
if (message.category === "console" /* ExtractorMessageCategory.Console */) {
|
||||
messageText = message.text;
|
||||
}
|
||||
else {
|
||||
messageText = message.formatMessageWithLocation(this._workingPackageFolder);
|
||||
}
|
||||
switch (message.logLevel) {
|
||||
case "error" /* ExtractorLogLevel.Error */:
|
||||
console.error(colors_1.default.red('Error: ' + messageText));
|
||||
break;
|
||||
case "warning" /* ExtractorLogLevel.Warning */:
|
||||
console.warn(colors_1.default.yellow('Warning: ' + messageText));
|
||||
break;
|
||||
case "info" /* ExtractorLogLevel.Info */:
|
||||
console.log(messageText);
|
||||
break;
|
||||
case "verbose" /* ExtractorLogLevel.Verbose */:
|
||||
if (this.showVerboseMessages) {
|
||||
console.log(colors_1.default.cyan(messageText));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Invalid logLevel value: ${JSON.stringify(message.logLevel)}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* For a given message, determine the IReportingRule based on the rule tables.
|
||||
*/
|
||||
_getRuleForMessage(message) {
|
||||
const reportingRule = this._reportingRuleByMessageId.get(message.messageId);
|
||||
if (reportingRule) {
|
||||
return reportingRule;
|
||||
}
|
||||
switch (message.category) {
|
||||
case "Compiler" /* ExtractorMessageCategory.Compiler */:
|
||||
return this._compilerDefaultRule;
|
||||
case "Extractor" /* ExtractorMessageCategory.Extractor */:
|
||||
return this._extractorDefaultRule;
|
||||
case "TSDoc" /* ExtractorMessageCategory.TSDoc */:
|
||||
return this._tsdocDefaultRule;
|
||||
case "console" /* ExtractorMessageCategory.Console */:
|
||||
throw new node_core_library_1.InternalError('ExtractorMessageCategory.Console is not supported with IReportingRule');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sorts an array of messages according to a reasonable ordering
|
||||
*/
|
||||
_sortMessagesForOutput(messages) {
|
||||
messages.sort((a, b) => {
|
||||
let diff;
|
||||
// First sort by file name
|
||||
diff = node_core_library_1.Sort.compareByValue(a.sourceFilePath, b.sourceFilePath);
|
||||
if (diff !== 0) {
|
||||
return diff;
|
||||
}
|
||||
// Then sort by line number
|
||||
diff = node_core_library_1.Sort.compareByValue(a.sourceFileLine, b.sourceFileLine);
|
||||
if (diff !== 0) {
|
||||
return diff;
|
||||
}
|
||||
// Then sort by messageId
|
||||
return node_core_library_1.Sort.compareByValue(a.messageId, b.messageId);
|
||||
});
|
||||
}
|
||||
}
|
||||
MessageRouter.DIAGNOSTICS_LINE = '============================================================';
|
||||
exports.MessageRouter = MessageRouter;
|
||||
//# sourceMappingURL=MessageRouter.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/MessageRouter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.d.ts
generated
vendored
Normal file
48
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.d.ts
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import type ts from 'typescript';
|
||||
export interface ISourceLocation {
|
||||
/**
|
||||
* The absolute path to the source file.
|
||||
*/
|
||||
sourceFilePath: string;
|
||||
/**
|
||||
* The line number in the source file. The first line number is 1.
|
||||
*/
|
||||
sourceFileLine: number;
|
||||
/**
|
||||
* The column number in the source file. The first column number is 1.
|
||||
*/
|
||||
sourceFileColumn: number;
|
||||
}
|
||||
export interface IGetSourceLocationOptions {
|
||||
/**
|
||||
* The source file to get the source location from.
|
||||
*/
|
||||
sourceFile: ts.SourceFile;
|
||||
/**
|
||||
* The position within the source file to get the source location from.
|
||||
*/
|
||||
pos: number;
|
||||
/**
|
||||
* If `false` or not provided, then we attempt to follow source maps in order to resolve the
|
||||
* location to the original `.ts` file. If resolution isn't possible for some reason, we fall
|
||||
* back to the `.d.ts` location.
|
||||
*
|
||||
* If `true`, then we don't bother following source maps, and the location refers to the `.d.ts`
|
||||
* location.
|
||||
*/
|
||||
useDtsLocation?: boolean;
|
||||
}
|
||||
export declare class SourceMapper {
|
||||
private _sourceMapByFilePath;
|
||||
private _originalFileInfoByPath;
|
||||
/**
|
||||
* Given a `.d.ts` source file and a specific position within the file, return the corresponding
|
||||
* `ISourceLocation`.
|
||||
*/
|
||||
getSourceLocation(options: IGetSourceLocationOptions): ISourceLocation;
|
||||
private _getMappedSourceLocation;
|
||||
private _getSourceMap;
|
||||
private static _findNearestMappingItem;
|
||||
private static _compareMappingItem;
|
||||
}
|
||||
//# sourceMappingURL=SourceMapper.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"SourceMapper.d.ts","sourceRoot":"","sources":["../../src/collector/SourceMapper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAoBjC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;IAE1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,YAAY;IAEvB,OAAO,CAAC,oBAAoB,CAAwE;IAGpG,OAAO,CAAC,uBAAuB,CAAwE;IAEvG;;;OAGG;IACI,iBAAiB,CAAC,OAAO,EAAE,yBAAyB,GAAG,eAAe;IAkB7E,OAAO,CAAC,wBAAwB;IA4EhC,OAAO,CAAC,aAAa;IAwDrB,OAAO,CAAC,MAAM,CAAC,uBAAuB;IA+BtC,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAOnC"}
|
195
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.js
generated
vendored
Normal file
195
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.js
generated
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
"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.SourceMapper = void 0;
|
||||
const path = __importStar(require("path"));
|
||||
const source_map_1 = require("source-map");
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
class SourceMapper {
|
||||
constructor() {
|
||||
// Map from .d.ts file path --> ISourceMap if a source map was found, or null if not found
|
||||
this._sourceMapByFilePath = new Map();
|
||||
// Cache the FileSystem.exists() result for mapped .ts files
|
||||
this._originalFileInfoByPath = new Map();
|
||||
}
|
||||
/**
|
||||
* Given a `.d.ts` source file and a specific position within the file, return the corresponding
|
||||
* `ISourceLocation`.
|
||||
*/
|
||||
getSourceLocation(options) {
|
||||
const lineAndCharacter = options.sourceFile.getLineAndCharacterOfPosition(options.pos);
|
||||
const sourceLocation = {
|
||||
sourceFilePath: options.sourceFile.fileName,
|
||||
sourceFileLine: lineAndCharacter.line + 1,
|
||||
sourceFileColumn: lineAndCharacter.character + 1
|
||||
};
|
||||
if (options.useDtsLocation) {
|
||||
return sourceLocation;
|
||||
}
|
||||
const mappedSourceLocation = this._getMappedSourceLocation(sourceLocation);
|
||||
return mappedSourceLocation || sourceLocation;
|
||||
}
|
||||
_getMappedSourceLocation(sourceLocation) {
|
||||
const { sourceFilePath, sourceFileLine, sourceFileColumn } = sourceLocation;
|
||||
if (!node_core_library_1.FileSystem.exists(sourceFilePath)) {
|
||||
// Sanity check
|
||||
throw new node_core_library_1.InternalError('The referenced path was not found: ' + sourceFilePath);
|
||||
}
|
||||
const sourceMap = this._getSourceMap(sourceFilePath);
|
||||
if (!sourceMap)
|
||||
return;
|
||||
const nearestMappingItem = SourceMapper._findNearestMappingItem(sourceMap.mappingItems, {
|
||||
line: sourceFileLine,
|
||||
column: sourceFileColumn
|
||||
});
|
||||
if (!nearestMappingItem)
|
||||
return;
|
||||
const mappedFilePath = path.resolve(path.dirname(sourceFilePath), nearestMappingItem.source);
|
||||
// Does the mapped filename exist? Use a cache to remember the answer.
|
||||
let originalFileInfo = this._originalFileInfoByPath.get(mappedFilePath);
|
||||
if (originalFileInfo === undefined) {
|
||||
originalFileInfo = {
|
||||
fileExists: node_core_library_1.FileSystem.exists(mappedFilePath),
|
||||
maxColumnForLine: []
|
||||
};
|
||||
if (originalFileInfo.fileExists) {
|
||||
// Read the file and measure the length of each line
|
||||
originalFileInfo.maxColumnForLine = node_core_library_1.FileSystem.readFile(mappedFilePath, {
|
||||
convertLineEndings: node_core_library_1.NewlineKind.Lf
|
||||
})
|
||||
.split('\n')
|
||||
.map((x) => x.length + 1); // +1 since columns are 1-based
|
||||
originalFileInfo.maxColumnForLine.unshift(0); // Extra item since lines are 1-based
|
||||
}
|
||||
this._originalFileInfoByPath.set(mappedFilePath, originalFileInfo);
|
||||
}
|
||||
// Don't translate coordinates to a file that doesn't exist
|
||||
if (!originalFileInfo.fileExists)
|
||||
return;
|
||||
// The nearestMappingItem anchor may be above/left of the real position, due to gaps in the mapping. Calculate
|
||||
// the delta and apply it to the original position.
|
||||
const guessedPosition = {
|
||||
line: nearestMappingItem.originalLine + sourceFileLine - nearestMappingItem.generatedLine,
|
||||
column: nearestMappingItem.originalColumn + sourceFileColumn - nearestMappingItem.generatedColumn
|
||||
};
|
||||
// Verify that the result is not out of bounds, in cause our heuristic failed
|
||||
if (guessedPosition.line >= 1 &&
|
||||
guessedPosition.line < originalFileInfo.maxColumnForLine.length &&
|
||||
guessedPosition.column >= 1 &&
|
||||
guessedPosition.column <= originalFileInfo.maxColumnForLine[guessedPosition.line]) {
|
||||
return {
|
||||
sourceFilePath: mappedFilePath,
|
||||
sourceFileLine: guessedPosition.line,
|
||||
sourceFileColumn: guessedPosition.column
|
||||
};
|
||||
}
|
||||
else {
|
||||
// The guessed position was out of bounds, so use the nearestMappingItem position instead.
|
||||
return {
|
||||
sourceFilePath: mappedFilePath,
|
||||
sourceFileLine: nearestMappingItem.originalLine,
|
||||
sourceFileColumn: nearestMappingItem.originalColumn
|
||||
};
|
||||
}
|
||||
}
|
||||
_getSourceMap(sourceFilePath) {
|
||||
let sourceMap = this._sourceMapByFilePath.get(sourceFilePath);
|
||||
if (sourceMap === undefined) {
|
||||
// Normalize the path and redo the lookup
|
||||
const normalizedPath = node_core_library_1.FileSystem.getRealPath(sourceFilePath);
|
||||
sourceMap = this._sourceMapByFilePath.get(normalizedPath);
|
||||
if (sourceMap !== undefined) {
|
||||
// Copy the result from the normalized to the non-normalized key
|
||||
this._sourceMapByFilePath.set(sourceFilePath, sourceMap);
|
||||
}
|
||||
else {
|
||||
// Given "folder/file.d.ts", check for a corresponding "folder/file.d.ts.map"
|
||||
const sourceMapPath = normalizedPath + '.map';
|
||||
if (node_core_library_1.FileSystem.exists(sourceMapPath)) {
|
||||
// Load up the source map
|
||||
const rawSourceMap = node_core_library_1.JsonFile.load(sourceMapPath);
|
||||
const sourceMapConsumer = new source_map_1.SourceMapConsumer(rawSourceMap);
|
||||
const mappingItems = [];
|
||||
// Extract the list of mapping items
|
||||
sourceMapConsumer.eachMapping((mappingItem) => {
|
||||
mappingItems.push(Object.assign(Object.assign({}, mappingItem), {
|
||||
// The "source-map" package inexplicably uses 1-based line numbers but 0-based column numbers.
|
||||
// Fix that up proactively so we don't have to deal with it later.
|
||||
generatedColumn: mappingItem.generatedColumn + 1, originalColumn: mappingItem.originalColumn + 1 }));
|
||||
}, this, source_map_1.SourceMapConsumer.GENERATED_ORDER);
|
||||
sourceMap = { sourceMapConsumer, mappingItems };
|
||||
}
|
||||
else {
|
||||
// No source map for this filename
|
||||
sourceMap = null;
|
||||
}
|
||||
this._sourceMapByFilePath.set(normalizedPath, sourceMap);
|
||||
if (sourceFilePath !== normalizedPath) {
|
||||
// Add both keys to the map
|
||||
this._sourceMapByFilePath.set(sourceFilePath, sourceMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sourceMap;
|
||||
}
|
||||
// The `mappingItems` array is sorted by generatedLine/generatedColumn (GENERATED_ORDER).
|
||||
// The _findNearestMappingItem() lookup is a simple binary search that returns the previous item
|
||||
// if there is no exact match.
|
||||
static _findNearestMappingItem(mappingItems, position) {
|
||||
if (mappingItems.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
let startIndex = 0;
|
||||
let endIndex = mappingItems.length - 1;
|
||||
while (startIndex <= endIndex) {
|
||||
const middleIndex = startIndex + Math.floor((endIndex - startIndex) / 2);
|
||||
const diff = SourceMapper._compareMappingItem(mappingItems[middleIndex], position);
|
||||
if (diff < 0) {
|
||||
startIndex = middleIndex + 1;
|
||||
}
|
||||
else if (diff > 0) {
|
||||
endIndex = middleIndex - 1;
|
||||
}
|
||||
else {
|
||||
// Exact match
|
||||
return mappingItems[middleIndex];
|
||||
}
|
||||
}
|
||||
// If we didn't find an exact match, then endIndex < startIndex.
|
||||
// Take endIndex because it's the smaller value.
|
||||
return mappingItems[endIndex];
|
||||
}
|
||||
static _compareMappingItem(mappingItem, position) {
|
||||
const diff = mappingItem.generatedLine - position.line;
|
||||
if (diff !== 0) {
|
||||
return diff;
|
||||
}
|
||||
return mappingItem.generatedColumn - position.column;
|
||||
}
|
||||
}
|
||||
exports.SourceMapper = SourceMapper;
|
||||
//# sourceMappingURL=SourceMapper.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/SourceMapper.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.d.ts
generated
vendored
Normal file
16
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
import type { ReleaseTag } from '@microsoft/api-extractor-model';
|
||||
/**
|
||||
* Constructor parameters for `SymbolMetadata`.
|
||||
*/
|
||||
export interface ISymbolMetadataOptions {
|
||||
maxEffectiveReleaseTag: ReleaseTag;
|
||||
}
|
||||
/**
|
||||
* Stores the Collector's additional analysis for an `AstSymbol`. This object is assigned to `AstSymbol.metadata`
|
||||
* but consumers must always obtain it by calling `Collector.fetchSymbolMetadata()`.
|
||||
*/
|
||||
export declare class SymbolMetadata {
|
||||
readonly maxEffectiveReleaseTag: ReleaseTag;
|
||||
constructor(options: ISymbolMetadataOptions);
|
||||
}
|
||||
//# sourceMappingURL=SymbolMetadata.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"SymbolMetadata.d.ts","sourceRoot":"","sources":["../../src/collector/SymbolMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED;;;GAGG;AACH,qBAAa,cAAc;IAGzB,SAAgB,sBAAsB,EAAE,UAAU,CAAC;gBAEhC,OAAO,EAAE,sBAAsB;CAGnD"}
|
16
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.js
generated
vendored
Normal file
16
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"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.SymbolMetadata = void 0;
|
||||
/**
|
||||
* Stores the Collector's additional analysis for an `AstSymbol`. This object is assigned to `AstSymbol.metadata`
|
||||
* but consumers must always obtain it by calling `Collector.fetchSymbolMetadata()`.
|
||||
*/
|
||||
class SymbolMetadata {
|
||||
constructor(options) {
|
||||
this.maxEffectiveReleaseTag = options.maxEffectiveReleaseTag;
|
||||
}
|
||||
}
|
||||
exports.SymbolMetadata = SymbolMetadata;
|
||||
//# sourceMappingURL=SymbolMetadata.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/SymbolMetadata.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"SymbolMetadata.js","sourceRoot":"","sources":["../../src/collector/SymbolMetadata.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAW3D;;;GAGG;AACH,MAAa,cAAc;IAKzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAC/D,CAAC;CACF;AARD,wCAQC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { ReleaseTag } from '@microsoft/api-extractor-model';\n\n/**\n * Constructor parameters for `SymbolMetadata`.\n */\nexport interface ISymbolMetadataOptions {\n maxEffectiveReleaseTag: ReleaseTag;\n}\n\n/**\n * Stores the Collector's additional analysis for an `AstSymbol`. This object is assigned to `AstSymbol.metadata`\n * but consumers must always obtain it by calling `Collector.fetchSymbolMetadata()`.\n */\nexport class SymbolMetadata {\n // For all declarations associated with this symbol, this is the\n // `ApiItemMetadata.effectiveReleaseTag` value that is most public.\n public readonly maxEffectiveReleaseTag: ReleaseTag;\n\n public constructor(options: ISymbolMetadataOptions) {\n this.maxEffectiveReleaseTag = options.maxEffectiveReleaseTag;\n }\n}\n"]}
|
20
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.d.ts
generated
vendored
Normal file
20
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Keeps track of a directed graph traversal that needs to detect cycles.
|
||||
*/
|
||||
export declare enum VisitorState {
|
||||
/**
|
||||
* We have not visited the node yet.
|
||||
*/
|
||||
Unvisited = 0,
|
||||
/**
|
||||
* We have visited the node, but have not finished traversing its references yet.
|
||||
* If we reach a node that is already in the `Visiting` state, this means we have
|
||||
* encountered a cyclic reference.
|
||||
*/
|
||||
Visiting = 1,
|
||||
/**
|
||||
* We are finished vising the node and all its references.
|
||||
*/
|
||||
Visited = 2
|
||||
}
|
||||
//# sourceMappingURL=VisitorState.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"VisitorState.d.ts","sourceRoot":"","sources":["../../src/collector/VisitorState.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,SAAS,IAAI;IAEb;;;;OAIG;IACH,QAAQ,IAAI;IAEZ;;OAEG;IACH,OAAO,IAAI;CACZ"}
|
26
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.js
generated
vendored
Normal file
26
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.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.VisitorState = void 0;
|
||||
/**
|
||||
* Keeps track of a directed graph traversal that needs to detect cycles.
|
||||
*/
|
||||
var VisitorState;
|
||||
(function (VisitorState) {
|
||||
/**
|
||||
* We have not visited the node yet.
|
||||
*/
|
||||
VisitorState[VisitorState["Unvisited"] = 0] = "Unvisited";
|
||||
/**
|
||||
* We have visited the node, but have not finished traversing its references yet.
|
||||
* If we reach a node that is already in the `Visiting` state, this means we have
|
||||
* encountered a cyclic reference.
|
||||
*/
|
||||
VisitorState[VisitorState["Visiting"] = 1] = "Visiting";
|
||||
/**
|
||||
* We are finished vising the node and all its references.
|
||||
*/
|
||||
VisitorState[VisitorState["Visited"] = 2] = "Visited";
|
||||
})(VisitorState = exports.VisitorState || (exports.VisitorState = {}));
|
||||
//# sourceMappingURL=VisitorState.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/VisitorState.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"VisitorState.js","sourceRoot":"","sources":["../../src/collector/VisitorState.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;GAEG;AACH,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB;;OAEG;IACH,yDAAa,CAAA;IAEb;;;;OAIG;IACH,uDAAY,CAAA;IAEZ;;OAEG;IACH,qDAAW,CAAA;AACb,CAAC,EAjBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAiBvB","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 * Keeps track of a directed graph traversal that needs to detect cycles.\n */\nexport enum VisitorState {\n /**\n * We have not visited the node yet.\n */\n Unvisited = 0,\n\n /**\n * We have visited the node, but have not finished traversing its references yet.\n * If we reach a node that is already in the `Visiting` state, this means we have\n * encountered a cyclic reference.\n */\n Visiting = 1,\n\n /**\n * We are finished vising the node and all its references.\n */\n Visited = 2\n}\n"]}
|
62
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.d.ts
generated
vendored
Normal file
62
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.d.ts
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
import type * as ts from 'typescript';
|
||||
import type * as tsdoc from '@microsoft/tsdoc';
|
||||
import type { INodePackageJson } from '@rushstack/node-core-library';
|
||||
/**
|
||||
* Constructor options for WorkingPackage
|
||||
*/
|
||||
export interface IWorkingPackageOptions {
|
||||
packageFolder: string;
|
||||
packageJson: INodePackageJson;
|
||||
entryPointSourceFile: ts.SourceFile;
|
||||
}
|
||||
/**
|
||||
* Information about the working package for a particular invocation of API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* API Extractor tries to model the world as a collection of NPM packages, such that each
|
||||
* .d.ts file belongs to at most one package. When API Extractor is invoked on a project,
|
||||
* we refer to that project as being the "working package". There is exactly one
|
||||
* "working package" for the duration of this analysis. Any files that do not belong to
|
||||
* the working package are referred to as "external": external declarations belonging to
|
||||
* external packages.
|
||||
*
|
||||
* If API Extractor is invoked on a standalone .d.ts file, the "working package" may not
|
||||
* have an actual package.json file on disk, but we still refer to it in concept.
|
||||
*/
|
||||
export declare class WorkingPackage {
|
||||
/**
|
||||
* Returns the folder for the package.json file of the working package.
|
||||
*
|
||||
* @remarks
|
||||
* If the entry point is `C:\Folder\project\src\index.ts` and the nearest package.json
|
||||
* is `C:\Folder\project\package.json`, then the packageFolder is `C:\Folder\project`
|
||||
*/
|
||||
readonly packageFolder: string;
|
||||
/**
|
||||
* The parsed package.json file for the working package.
|
||||
*/
|
||||
readonly packageJson: INodePackageJson;
|
||||
/**
|
||||
* The entry point being processed during this invocation of API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* The working package may have multiple entry points; however, today API Extractor
|
||||
* only processes a single entry point during an invocation. This will be improved
|
||||
* in the future.
|
||||
*/
|
||||
readonly entryPointSourceFile: ts.SourceFile;
|
||||
/**
|
||||
* The `@packageDocumentation` comment, if any, for the working package.
|
||||
*/
|
||||
tsdocComment: tsdoc.DocComment | undefined;
|
||||
/**
|
||||
* Additional parser information for `WorkingPackage.tsdocComment`.
|
||||
*/
|
||||
tsdocParserContext: tsdoc.ParserContext | undefined;
|
||||
constructor(options: IWorkingPackageOptions);
|
||||
/**
|
||||
* Returns the full name of the working package.
|
||||
*/
|
||||
get name(): string;
|
||||
}
|
||||
//# sourceMappingURL=WorkingPackage.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorkingPackage.d.ts","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;CACrC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAc;IACzB;;;;;;OAMG;IACH,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC;;OAEG;IACH,SAAgB,WAAW,EAAE,gBAAgB,CAAC;IAE9C;;;;;;;OAOG;IACH,SAAgB,oBAAoB,EAAE,EAAE,CAAC,UAAU,CAAC;IAEpD;;OAEG;IACI,YAAY,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC;IAElD;;OAEG;IACI,kBAAkB,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;gBAExC,OAAO,EAAE,sBAAsB;IAMlD;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;CACF"}
|
34
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.js
generated
vendored
Normal file
34
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"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.WorkingPackage = void 0;
|
||||
/**
|
||||
* Information about the working package for a particular invocation of API Extractor.
|
||||
*
|
||||
* @remarks
|
||||
* API Extractor tries to model the world as a collection of NPM packages, such that each
|
||||
* .d.ts file belongs to at most one package. When API Extractor is invoked on a project,
|
||||
* we refer to that project as being the "working package". There is exactly one
|
||||
* "working package" for the duration of this analysis. Any files that do not belong to
|
||||
* the working package are referred to as "external": external declarations belonging to
|
||||
* external packages.
|
||||
*
|
||||
* If API Extractor is invoked on a standalone .d.ts file, the "working package" may not
|
||||
* have an actual package.json file on disk, but we still refer to it in concept.
|
||||
*/
|
||||
class WorkingPackage {
|
||||
constructor(options) {
|
||||
this.packageFolder = options.packageFolder;
|
||||
this.packageJson = options.packageJson;
|
||||
this.entryPointSourceFile = options.entryPointSourceFile;
|
||||
}
|
||||
/**
|
||||
* Returns the full name of the working package.
|
||||
*/
|
||||
get name() {
|
||||
return this.packageJson.name;
|
||||
}
|
||||
}
|
||||
exports.WorkingPackage = WorkingPackage;
|
||||
//# sourceMappingURL=WorkingPackage.js.map
|
1
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/collector/WorkingPackage.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"WorkingPackage.js","sourceRoot":"","sources":["../../src/collector/WorkingPackage.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAgB3D;;;;;;;;;;;;;GAaG;AACH,MAAa,cAAc;IAmCzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;CACF;AA/CD,wCA+CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type * as ts from 'typescript';\nimport type * as tsdoc from '@microsoft/tsdoc';\n\nimport type { INodePackageJson } from '@rushstack/node-core-library';\n\n/**\n * Constructor options for WorkingPackage\n */\nexport interface IWorkingPackageOptions {\n packageFolder: string;\n packageJson: INodePackageJson;\n entryPointSourceFile: ts.SourceFile;\n}\n\n/**\n * Information about the working package for a particular invocation of API Extractor.\n *\n * @remarks\n * API Extractor tries to model the world as a collection of NPM packages, such that each\n * .d.ts file belongs to at most one package. When API Extractor is invoked on a project,\n * we refer to that project as being the \"working package\". There is exactly one\n * \"working package\" for the duration of this analysis. Any files that do not belong to\n * the working package are referred to as \"external\": external declarations belonging to\n * external packages.\n *\n * If API Extractor is invoked on a standalone .d.ts file, the \"working package\" may not\n * have an actual package.json file on disk, but we still refer to it in concept.\n */\nexport class WorkingPackage {\n /**\n * Returns the folder for the package.json file of the working package.\n *\n * @remarks\n * If the entry point is `C:\\Folder\\project\\src\\index.ts` and the nearest package.json\n * is `C:\\Folder\\project\\package.json`, then the packageFolder is `C:\\Folder\\project`\n */\n public readonly packageFolder: string;\n\n /**\n * The parsed package.json file for the working package.\n */\n public readonly packageJson: INodePackageJson;\n\n /**\n * The entry point being processed during this invocation of API Extractor.\n *\n * @remarks\n * The working package may have multiple entry points; however, today API Extractor\n * only processes a single entry point during an invocation. This will be improved\n * in the future.\n */\n public readonly entryPointSourceFile: ts.SourceFile;\n\n /**\n * The `@packageDocumentation` comment, if any, for the working package.\n */\n public tsdocComment: tsdoc.DocComment | undefined;\n\n /**\n * Additional parser information for `WorkingPackage.tsdocComment`.\n */\n public tsdocParserContext: tsdoc.ParserContext | undefined;\n\n public constructor(options: IWorkingPackageOptions) {\n this.packageFolder = options.packageFolder;\n this.packageJson = options.packageJson;\n this.entryPointSourceFile = options.entryPointSourceFile;\n }\n\n /**\n * Returns the full name of the working package.\n */\n public get name(): string {\n return this.packageJson.name;\n }\n}\n"]}
|
Reference in New Issue
Block a user