1 | import * as ts from 'typescript';
|
2 | import { PackageJsonLookup } from '@rushstack/node-core-library';
|
3 | import { CollectorEntity } from './CollectorEntity';
|
4 | import { AstSymbolTable } from '../analyzer/AstSymbolTable';
|
5 | import { AstEntity } from '../analyzer/AstEntity';
|
6 | import { AstSymbol } from '../analyzer/AstSymbol';
|
7 | import { AstDeclaration } from '../analyzer/AstDeclaration';
|
8 | import { WorkingPackage } from './WorkingPackage';
|
9 | import { DeclarationMetadata } from './DeclarationMetadata';
|
10 | import { ApiItemMetadata } from './ApiItemMetadata';
|
11 | import { SymbolMetadata } from './SymbolMetadata';
|
12 | import { IGlobalVariableAnalyzer } from '../analyzer/TypeScriptInternals';
|
13 | import { MessageRouter } from './MessageRouter';
|
14 | import { AstReferenceResolver } from '../analyzer/AstReferenceResolver';
|
15 | import { ExtractorConfig } from '../api/ExtractorConfig';
|
16 |
|
17 |
|
18 |
|
19 | export interface ICollectorOptions {
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | program: ts.Program;
|
29 | messageRouter: MessageRouter;
|
30 | extractorConfig: ExtractorConfig;
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export declare class Collector {
|
39 | readonly program: ts.Program;
|
40 | readonly typeChecker: ts.TypeChecker;
|
41 | readonly globalVariableAnalyzer: IGlobalVariableAnalyzer;
|
42 | readonly astSymbolTable: AstSymbolTable;
|
43 | readonly astReferenceResolver: AstReferenceResolver;
|
44 | readonly packageJsonLookup: PackageJsonLookup;
|
45 | readonly messageRouter: MessageRouter;
|
46 | readonly workingPackage: WorkingPackage;
|
47 | readonly extractorConfig: ExtractorConfig;
|
48 | |
49 |
|
50 |
|
51 | readonly bundledPackageNames: ReadonlySet<string>;
|
52 | private readonly _program;
|
53 | private readonly _tsdocParser;
|
54 | private _astEntryPoint;
|
55 | private readonly _entities;
|
56 | private readonly _entitiesByAstEntity;
|
57 | private readonly _starExportedExternalModulePaths;
|
58 | private readonly _dtsTypeReferenceDirectives;
|
59 | private readonly _dtsLibReferenceDirectives;
|
60 | private readonly _cachedOverloadIndexesByDeclaration;
|
61 | constructor(options: ICollectorOptions);
|
62 | /**
|
63 | * Returns a list of names (e.g. "example-library") that should appear in a reference like this:
|
64 | *
|
65 | * ```
|
66 | * /// <reference types="example-library" />
|
67 | * ```
|
68 | */
|
69 | get dtsTypeReferenceDirectives(): ReadonlySet<string>;
|
70 | /**
|
71 | * A list of names (e.g. "runtime-library") that should appear in a reference like this:
|
72 | *
|
73 | * ```
|
74 | * /// <reference lib="runtime-library" />
|
75 | * ```
|
76 | */
|
77 | get dtsLibReferenceDirectives(): ReadonlySet<string>;
|
78 | get entities(): ReadonlyArray<CollectorEntity>;
|
79 | /**
|
80 | * A list of module specifiers (e.g. `"@rushstack/node-core-library/lib/FileSystem"`) that should be emitted
|
81 | * as star exports (e.g. `export * from "@rushstack/node-core-library/lib/FileSystem"`).
|
82 | */
|
83 | get starExportedExternalModulePaths(): ReadonlyArray<string>;
|
84 | /**
|
85 | * Perform the analysis.
|
86 | */
|
87 | analyze(): void;
|
88 | /**
|
89 | * For a given ts.Identifier that is part of an AstSymbol that we analyzed, return the CollectorEntity that
|
90 | * it refers to. Returns undefined if it doesn't refer to anything interesting.
|
91 | * @remarks
|
92 | * Throws an Error if the ts.Identifier is not part of node tree that was analyzed.
|
93 | */
|
94 | tryGetEntityForNode(identifier: ts.Identifier | ts.ImportTypeNode): CollectorEntity | undefined;
|
95 | /**
|
96 | * Returns the associated `CollectorEntity` for the given `astEntity`, if one was created during analysis.
|
97 | */
|
98 | tryGetCollectorEntity(astEntity: AstEntity): CollectorEntity | undefined;
|
99 | fetchSymbolMetadata(astSymbol: AstSymbol): SymbolMetadata;
|
100 | fetchDeclarationMetadata(astDeclaration: AstDeclaration): DeclarationMetadata;
|
101 | fetchApiItemMetadata(astDeclaration: AstDeclaration): ApiItemMetadata;
|
102 | tryFetchMetadataForAstEntity(astEntity: AstEntity): SymbolMetadata | undefined;
|
103 | isAncillaryDeclaration(astDeclaration: AstDeclaration): boolean;
|
104 | getNonAncillaryDeclarations(astSymbol: AstSymbol): ReadonlyArray<AstDeclaration>;
|
105 | /**
|
106 | * Removes the leading underscore, for example: "_Example" --> "example*Example*_"
|
107 | *
|
108 | * @remarks
|
109 | * This causes internal definitions to sort alphabetically case-insensitive, then case-sensitive, and
|
110 | * initially ignoring the underscore prefix, while still deterministically comparing it.
|
111 | * The star is used as a delimiter because it is not a legal identifier character.
|
112 | */
|
113 | static getSortKeyIgnoringUnderscore(identifier: string | undefined): string;
|
114 | /**
|
115 | * For function-like signatures, this returns the TSDoc "overload index" which can be used to identify
|
116 | * a specific overload.
|
117 | */
|
118 | getOverloadIndex(astDeclaration: AstDeclaration): number;
|
119 | private _createCollectorEntity;
|
120 | private _createEntityForIndirectReferences;
|
121 | /**
|
122 | * Ensures a unique name for each item in the package typings file.
|
123 | */
|
124 | private _makeUniqueNames;
|
125 | private _fetchSymbolMetadata;
|
126 | private _calculateDeclarationMetadataForDeclarations;
|
127 | private _addAncillaryDeclaration;
|
128 | private _calculateApiItemMetadata;
|
129 | private _parseTsdocForAstDeclaration;
|
130 | private _collectReferenceDirectives;
|
131 | private _collectReferenceDirectivesFromSourceFiles;
|
132 | }
|
133 | //# sourceMappingURL=Collector.d.ts.map |
\ | No newline at end of file |