jsii 6.0.22-dev.0 → 7.1.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assembler.d.ts +254 -196
- package/lib/assembler.js +2105 -2327
- package/lib/assembler.js.map +1 -1
- package/lib/case.js.map +1 -1
- package/lib/common/find-utils.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +2 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/symbol-id.d.ts +23 -4
- package/lib/common/symbol-id.js +13 -9
- package/lib/common/symbol-id.js.map +1 -1
- package/lib/compiler-host.d.ts +60 -0
- package/lib/compiler-host.js +201 -0
- package/lib/compiler-host.js.map +1 -0
- package/lib/compiler.d.ts +74 -62
- package/lib/compiler.js +332 -254
- package/lib/compiler.js.map +1 -1
- package/lib/diagnostic.d.ts +34 -0
- package/lib/diagnostic.js +141 -0
- package/lib/diagnostic.js.map +1 -0
- package/lib/emitter.d.ts +40 -10
- package/lib/emitter.js +188 -0
- package/lib/emitter.js.map +1 -1
- package/lib/helpers.d.ts +1 -1
- package/lib/helpers.js +2 -2
- package/lib/helpers.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jsii-diagnostic.d.ts +27 -22
- package/lib/jsii-diagnostic.js +22 -38
- package/lib/jsii-diagnostic.js.map +1 -1
- package/lib/literate.js.map +1 -1
- package/lib/main.js +3 -2
- package/lib/main.js.map +1 -1
- package/lib/project-info.d.ts +23 -4
- package/lib/project-info.js +5 -5
- package/lib/project-info.js.map +1 -1
- package/lib/support-types.d.ts +2 -0
- package/lib/support-types.js +3 -0
- package/lib/support-types.js.map +1 -0
- package/lib/support.js.map +1 -1
- package/lib/tsconfig/compiler-options.d.ts +12 -46
- package/lib/tsconfig/compiler-options.js +45 -87
- package/lib/tsconfig/compiler-options.js.map +1 -1
- package/lib/tsconfig/index.d.ts +24 -5
- package/lib/tsconfig/index.js.map +1 -1
- package/lib/tsconfig/read.d.ts +15 -0
- package/lib/tsconfig/read.js +196 -0
- package/lib/tsconfig/read.js.map +1 -0
- package/lib/tsconfig/rule-set-format.js.map +1 -1
- package/lib/tsconfig/rulesets/configurable-options.js.map +1 -1
- package/lib/tsconfig/rulesets/deprecated-options.js.map +1 -1
- package/lib/tsconfig/rulesets/generated.public.js.map +1 -1
- package/lib/tsconfig/rulesets/incompatible-options.js.map +1 -1
- package/lib/tsconfig/rulesets/jsii-configured-options.js.map +1 -1
- package/lib/tsconfig/rulesets/minimal.public.js.map +1 -1
- package/lib/tsconfig/rulesets/strict-family-options.js.map +1 -1
- package/lib/tsconfig/rulesets/strict.public.js.map +1 -1
- package/lib/tsconfig/tsconfig-validator.js +2 -50
- package/lib/tsconfig/tsconfig-validator.js.map +1 -1
- package/lib/tsconfig/validator.js.map +1 -1
- package/lib/type-analysis.js.map +1 -1
- package/lib/type-reference.js.map +1 -1
- package/lib/type-visitor.js.map +1 -1
- package/lib/utils.d.ts +6 -6
- package/lib/utils.js +8 -13
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +3 -3
- package/lib/version.js +4 -4
- package/lib/version.js.map +1 -1
- package/lib/warnings.d.ts +2 -2
- package/lib/warnings.js +3 -77
- package/lib/warnings.js.map +1 -1
- package/package.json +15 -11
- package/scripts/ts7-compare-jsii.mjs +101 -0
- package/lib/directives.d.ts +0 -24
- package/lib/directives.js +0 -139
- package/lib/directives.js.map +0 -1
- package/lib/docs.d.ts +0 -64
- package/lib/docs.js +0 -293
- package/lib/docs.js.map +0 -1
- package/lib/node-bindings.d.ts +0 -19
- package/lib/node-bindings.js +0 -49
- package/lib/node-bindings.js.map +0 -1
- package/lib/reserved-words.d.ts +0 -6
- package/lib/reserved-words.js +0 -258
- package/lib/reserved-words.js.map +0 -1
- package/lib/sets.d.ts +0 -16
- package/lib/sets.js +0 -41
- package/lib/sets.js.map +0 -1
- package/lib/transforms/deprecated-remover.d.ts +0 -44
- package/lib/transforms/deprecated-remover.js +0 -545
- package/lib/transforms/deprecated-remover.js.map +0 -1
- package/lib/transforms/deprecation-warnings.d.ts +0 -37
- package/lib/transforms/deprecation-warnings.js +0 -616
- package/lib/transforms/deprecation-warnings.js.map +0 -1
- package/lib/transforms/runtime-info.d.ts +0 -39
- package/lib/transforms/runtime-info.js +0 -128
- package/lib/transforms/runtime-info.js.map +0 -1
- package/lib/transforms/utils.d.ts +0 -11
- package/lib/transforms/utils.js +0 -31
- package/lib/transforms/utils.js.map +0 -1
- package/lib/type-tracker.d.ts +0 -13
- package/lib/type-tracker.js +0 -67
- package/lib/type-tracker.js.map +0 -1
- package/lib/validator.d.ts +0 -19
- package/lib/validator.js +0 -602
- package/lib/validator.js.map +0 -1
package/lib/assembler.d.ts
CHANGED
|
@@ -1,249 +1,307 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
|
|
1
|
+
import * as spec from '@jsii/spec';
|
|
2
|
+
import { TypeScriptApi, TypeScriptProject } from './compiler-host';
|
|
3
|
+
import { JsiiDiagnostic } from './jsii-diagnostic';
|
|
4
|
+
import { type ProjectInfo } from './project-info';
|
|
5
|
+
export interface AssemblerOptions {
|
|
6
|
+
/** package.json contents of the package being assembled. */
|
|
7
|
+
readonly packageJson: any;
|
|
8
|
+
/** The fully-resolved jsii project info (targets, metadata, dependency closure, ...). */
|
|
8
9
|
readonly projectInfo: ProjectInfo;
|
|
9
|
-
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
private readonly _types;
|
|
24
|
-
private readonly _packageInfoCache;
|
|
25
|
-
/** Map of Symbol to namespace export Symbol */
|
|
26
|
-
private readonly _submoduleMap;
|
|
27
|
-
/**
|
|
28
|
-
* Submodule information
|
|
29
|
-
*
|
|
30
|
-
* Contains submodule information for all namespaces that have been seen
|
|
31
|
-
* across all assemblies (this and dependencies).
|
|
32
|
-
*
|
|
33
|
-
* Filtered to local submodules only at time of writing the assembly out to disk.
|
|
34
|
-
*/
|
|
35
|
-
private readonly _submodules;
|
|
36
|
-
private readonly _typeTracker;
|
|
10
|
+
/** The rendered package README, when one exists. */
|
|
11
|
+
readonly readme?: spec.ReadMe;
|
|
12
|
+
/** Absolute path to the package root. */
|
|
13
|
+
readonly projectRoot: string;
|
|
14
|
+
/** Absolute path to the entrypoint .ts (derived from `types`/`main`). */
|
|
15
|
+
readonly entry: string;
|
|
16
|
+
/** Assembly name (package name). */
|
|
17
|
+
readonly assemblyName: string;
|
|
18
|
+
/** Default stability for the package. */
|
|
19
|
+
readonly defaultStability?: spec.Stability;
|
|
20
|
+
/** Whether to strip deprecated members (cdk-build.stripDeprecated). */
|
|
21
|
+
readonly stripDeprecated?: boolean;
|
|
22
|
+
/** Optional allowlist file of FQNs to strip (one per line). */
|
|
23
|
+
readonly stripDeprecatedAllowListFile?: string;
|
|
37
24
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param stdlib the directory where the TypeScript stdlib is rooted
|
|
25
|
+
* The effective tsc `rootDir`/`outDir` of the compilation, recorded in the
|
|
26
|
+
* assembly metadata. Defaults to the values of the jsii config.
|
|
41
27
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
readonly tscRootDir?: string;
|
|
29
|
+
readonly tscOutDir?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class Assembler {
|
|
32
|
+
private readonly options;
|
|
33
|
+
private readonly ts;
|
|
34
|
+
private readonly checker;
|
|
35
|
+
private readonly program;
|
|
36
|
+
private readonly project;
|
|
37
|
+
private readonly root;
|
|
38
|
+
private readonly assemblyName;
|
|
39
|
+
private readonly entry;
|
|
40
|
+
private readonly defaultStability?;
|
|
41
|
+
private currentStability?;
|
|
42
|
+
private readonly types;
|
|
43
|
+
private readonly submodules;
|
|
44
|
+
private readonly typeFqnBySymbolId;
|
|
45
|
+
private readonly exported;
|
|
46
|
+
private readonly _jsDocTagsCache;
|
|
47
|
+
private readonly _docCommentCache;
|
|
48
|
+
private readonly _sourceTextCache;
|
|
49
|
+
private _docCacheHits;
|
|
50
|
+
/** Number of doc-read cache hits (RPCs avoided). Exposed for perf reporting. */
|
|
51
|
+
get docCacheHits(): number;
|
|
52
|
+
/** The jsii diagnostics (warnings and errors) collected while assembling. */
|
|
53
|
+
get diagnostics(): readonly JsiiDiagnostic[];
|
|
54
|
+
private readonly _diagnostics;
|
|
55
|
+
/** The jsii features the assembly makes use of (classic `usedFeatures`). */
|
|
56
|
+
private readonly usedFeatures;
|
|
57
|
+
/** FQNs of classes without their own constructor, whose initializer is the base type's. */
|
|
58
|
+
private readonly inheritsInitializer;
|
|
59
|
+
/** Declaration rank of each own type FQN, for ordering union constituents (see _declarationRank). */
|
|
60
|
+
private readonly declarationRanks;
|
|
61
|
+
private programFileIndex?;
|
|
62
|
+
private readonly externalDeps;
|
|
63
|
+
private readonly externalTypeByFqn;
|
|
64
|
+
private readonly externalFqnBySymbolId;
|
|
65
|
+
private readonly externalAssemblies;
|
|
66
|
+
private readonly externalDepDirs;
|
|
67
|
+
private readonly stripDeprecated;
|
|
68
|
+
private stripAllowList?;
|
|
69
|
+
private readonly strippedTypeSymIds;
|
|
70
|
+
constructor(ts: TypeScriptApi, project: TypeScriptProject, options: AssemblerOptions);
|
|
44
71
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @return the result of the assembly emission.
|
|
72
|
+
* Build the assembly. Mirrors strada `Assembler.emit()`'s high-level flow:
|
|
73
|
+
* load dependency assemblies, walk module exports, register types, visit each.
|
|
48
74
|
*/
|
|
49
|
-
|
|
50
|
-
private
|
|
75
|
+
assemble(): spec.Assembly;
|
|
76
|
+
private _resolveAlias;
|
|
51
77
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* Will not invoke the function with any 'undefined's; an error will already have been emitted in
|
|
58
|
-
* that case anyway.
|
|
59
|
-
*
|
|
60
|
-
* @param fqn FQN of the current type (the type that has a dependency on baseTypes)
|
|
61
|
-
* @param baseTypes Array of type references to be looked up
|
|
62
|
-
* @param referencingNode Node to report a diagnostic on if we fail to look up a type
|
|
63
|
-
* @param cb Callback to be invoked with the Types corresponding to the TypeReferences in baseTypes
|
|
78
|
+
* Whether every declaration of the symbol carries the `@jsii ignore` directive.
|
|
79
|
+
* All declarations must be ignored so that a partially-ignored merged
|
|
80
|
+
* declaration stays a visible part of the public API, as in the classic
|
|
81
|
+
* compiler. The tags of a symbol are aggregated over its declarations, so a
|
|
82
|
+
* merged declaration is checked per declaration on the raw JSDoc text.
|
|
64
83
|
*/
|
|
65
|
-
private
|
|
84
|
+
private _isIgnored;
|
|
85
|
+
private _isDeprecated;
|
|
66
86
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* @param dependedFqns List of FQNs of types this callback depends on. All deferreds for all
|
|
75
|
-
* @param cb the function to be called in a deferred way. It will be bound with ``this``, so it can depend on using
|
|
76
|
-
* ``this``.
|
|
87
|
+
* Memoized `symbol.getJsDocTags(checker)`. The same symbol's tags are consulted
|
|
88
|
+
* multiple times per member (isInternal + isDeprecated + _visitDocumentation),
|
|
89
|
+
* and each call is an out-of-process round-trip. Keyed by the symbol's first
|
|
90
|
+
* declaration coordinate `path:index` (a NodeHandle field readable WITHOUT a
|
|
91
|
+
* resolve() RPC and stable across re-materialization — unlike `symbol.id`,
|
|
92
|
+
* which is undefined/unstable here and made the previous cache inert). Results
|
|
93
|
+
* are value-identical to the uncached call (pure read), so parity is unaffected.
|
|
77
94
|
*/
|
|
78
|
-
private
|
|
95
|
+
private _jsDocTags;
|
|
79
96
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
97
|
+
* The documentation comment of a symbol with `{@link ...}` references rendered
|
|
98
|
+
* the way the classic language service did (`buildLinkParts`): a link whose
|
|
99
|
+
* name resolves keeps its text verbatim, `{@link Name text}`; a link that does
|
|
100
|
+
* not resolve (or uses a `#member` name, which the classic checker never
|
|
101
|
+
* resolved) is rendered as `{@link Name` + ' ' + `text}`, which is where the
|
|
102
|
+
* trailing space in `{@link Foo }` comes from. The TypeScript 7 checker renders
|
|
103
|
+
* links as plain text, so the raw JSDoc block is consulted when it has links.
|
|
85
104
|
*/
|
|
86
|
-
private
|
|
105
|
+
private _docCommentWithClassicLinks;
|
|
106
|
+
/** Whether a `{@link A.b.c}` name resolves at `location` (classic `getSymbolAtLocation` on the link name). */
|
|
107
|
+
private _resolvesLinkName;
|
|
108
|
+
/** Memoized `symbol.getDocumentationComment(checker)` (keyed by declaration coordinate). */
|
|
109
|
+
private _docComment;
|
|
110
|
+
/** Stable per-symbol key from its first declaration's (path, index); undefined if none. */
|
|
111
|
+
private _symbolDocKey;
|
|
87
112
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @param type the type for which a JSII fully qualified name is needed.
|
|
93
|
-
* @param typeAnnotationNode the type annotation for which this FQN is generated. This is used for attaching the error
|
|
94
|
-
* marker. When there is no explicit type annotation (e.g: inferred method return type), the
|
|
95
|
-
* preferred substitute is the "type-inferred" element's name.
|
|
96
|
-
* @param typeUse the reason why this type was resolved (e.g: "return type")
|
|
97
|
-
* @param isThisType whether this type was specified or inferred as "this" or not
|
|
98
|
-
*
|
|
99
|
-
* @returns the FQN of the type, or some "unknown" marker.
|
|
113
|
+
* Documentation is read per symbol: on TypeScript 7.1 the request-batching
|
|
114
|
+
* combinator was measured slower than individual requests for this workload.
|
|
115
|
+
* Kept as a no-op hook so call sites document where a prefetch would go.
|
|
100
116
|
*/
|
|
101
|
-
private
|
|
117
|
+
private _prefetchDocs;
|
|
118
|
+
private _shouldStrip;
|
|
119
|
+
private _loadDependencyAssemblies;
|
|
102
120
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
121
|
+
* The (alias-resolved) symbol of a heritage-clause entry (`extends X` /
|
|
122
|
+
* `implements X`). Newer API clients materialize some resolved child nodes
|
|
123
|
+
* (e.g. the `expression` of ExpressionWithTypeArguments) as local-only
|
|
124
|
+
* objects that `getSymbolAtLocation` rejects, so prefer resolving the base
|
|
125
|
+
* TYPE at the heritage node itself and taking its symbol.
|
|
107
126
|
*/
|
|
108
|
-
private
|
|
109
|
-
|
|
127
|
+
private _heritageBaseSymbol;
|
|
128
|
+
/** `checker.getSymbolAtLocation` that tolerates local-only / missing nodes. */
|
|
129
|
+
private _symbolAtNodeSafe;
|
|
130
|
+
/** The alias symbol of the type at a node (e.g. a TypeReference to a type alias). */
|
|
131
|
+
private _aliasSymbolAt;
|
|
110
132
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* @param ns the symbol that identifies the submodule.
|
|
116
|
-
* @param moduleLike the module-like symbol bound to the submodule.
|
|
117
|
-
* @param packageRoot the root of the package being traversed.
|
|
133
|
+
* The loaded jsii dependency a declaration path belongs to, if any: the
|
|
134
|
+
* dependency whose (real) directory is a prefix of the path, falling back to
|
|
135
|
+
* the `node_modules/<name>/` segment for paths that were not resolved.
|
|
118
136
|
*/
|
|
119
|
-
private
|
|
137
|
+
private _dependencyOfPath;
|
|
138
|
+
private _externalFqnOf;
|
|
139
|
+
private _registerModuleExports;
|
|
140
|
+
private _registerType;
|
|
120
141
|
/**
|
|
121
|
-
*
|
|
142
|
+
* The assembly entry for a submodule (classic `_registerNamespaces`): the
|
|
143
|
+
* location of the `export * as ns from '...'` (or `export namespace ns`)
|
|
144
|
+
* declaration, its symbolId and, for module-file submodules, the targets
|
|
145
|
+
* configured in the module's `.jsiirc.json` and its README.
|
|
122
146
|
*
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
147
|
+
* @param exportSym the (alias) symbol the submodule is exported as
|
|
148
|
+
* @param moduleSym the resolved module-like symbol
|
|
149
|
+
* @param isModuleFile whether the submodule is a source file (vs an inline namespace)
|
|
125
150
|
*/
|
|
126
|
-
private
|
|
127
|
-
private getSymbolId;
|
|
128
|
-
private _validateHeritageClauses;
|
|
129
|
-
private declarationLocation;
|
|
130
|
-
private _processBaseInterfaces;
|
|
131
|
-
private _visitClass;
|
|
132
|
-
/**
|
|
133
|
-
* Use the TypeChecker's getTypeFromTypeNode, but throw a descriptive error if it fails
|
|
134
|
-
*/
|
|
135
|
-
private _getTypeFromTypeNode;
|
|
151
|
+
private _submoduleSpec;
|
|
136
152
|
/**
|
|
137
|
-
*
|
|
153
|
+
* Make sure that no 2 submodules are emitting into the same target namespaces
|
|
154
|
+
* (classic `validateSubmoduleConfigs`).
|
|
138
155
|
*/
|
|
139
|
-
private
|
|
156
|
+
private _validateSubmoduleConfigs;
|
|
140
157
|
/**
|
|
141
|
-
*
|
|
158
|
+
* Records the inheritance relationships of members and the jsii features the
|
|
159
|
+
* assembly uses, then returns the sorted feature list (or `undefined` when
|
|
160
|
+
* there is none; classic `_assemblyFeatures`).
|
|
142
161
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* (
|
|
162
|
+
* This is the data-producing half of the classic validator's
|
|
163
|
+
* `_inheritanceDoesNotChangeContracts` pass: every member of a class that
|
|
164
|
+
* redeclares a member of a base class gets `overrides` set to that base, and
|
|
165
|
+
* members (own or inherited) that implement an interface member get
|
|
166
|
+
* `overrides` set to that interface, with class overrides taking precedence.
|
|
167
|
+
* `class-covariant-overrides` is recorded when an override changes the type
|
|
168
|
+
* of a non-static member in an allowed covariant way (immutable properties and
|
|
169
|
+
* method return types only). The diagnostics half of that pass (contract
|
|
170
|
+
* violations) is not performed here.
|
|
147
171
|
*/
|
|
148
|
-
private
|
|
172
|
+
private _finalizeInheritance;
|
|
149
173
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* (`_visitNode`) and reference resolution (`_isPrivateOrInternal`) agree: a
|
|
153
|
-
* partially-ignored merged declaration stays a visible part of the public API.
|
|
174
|
+
* Declaration rank of a type FQN for union ordering: own types by (program file
|
|
175
|
+
* order, position in file); types of dependencies before them, by name.
|
|
154
176
|
*/
|
|
155
|
-
private
|
|
177
|
+
private _declarationRank;
|
|
178
|
+
private _registerDeclarationRank;
|
|
156
179
|
/**
|
|
157
|
-
*
|
|
180
|
+
* The symbolId of a symbol, computed by the same `symbolIdentifier` the
|
|
181
|
+
* classic compiler (and jsii-rosetta) use: the path is made relative to the
|
|
182
|
+
* package the declaration lives in, with the package's `jsii.outdir` and, when
|
|
183
|
+
* an assembly is given, its tscOutDir -> tscRootDir mapping applied.
|
|
158
184
|
*/
|
|
159
|
-
private
|
|
185
|
+
private _symbolIdOf;
|
|
186
|
+
private _visitNode;
|
|
160
187
|
private _visitEnum;
|
|
161
|
-
private assertNoDuplicateEnumValues;
|
|
162
|
-
/**
|
|
163
|
-
* Return docs for a symbol
|
|
164
|
-
*/
|
|
165
|
-
private _visitDocumentation;
|
|
166
|
-
/**
|
|
167
|
-
* Check that all parameters the doc block refers to with a @param declaration actually exist
|
|
168
|
-
*/
|
|
169
|
-
private _validateReferencedDocParams;
|
|
170
188
|
private _visitInterface;
|
|
171
|
-
private _visitMethod;
|
|
172
|
-
private _warnAboutReservedWords;
|
|
173
|
-
private _visitProperty;
|
|
174
|
-
private _toParameter;
|
|
175
|
-
private _typeReference;
|
|
176
|
-
private _optionalValue;
|
|
177
|
-
/**
|
|
178
|
-
* Validate the restrictions on an intersection type reference
|
|
179
|
-
*
|
|
180
|
-
* - Type only consists of (behavioral) interface types
|
|
181
|
-
* - For all types referenced in the intersection, the definitions of all shared
|
|
182
|
-
* members must match exactly.
|
|
183
|
-
*/
|
|
184
|
-
private validateIntersectionType;
|
|
185
|
-
private comparePropForIntersection;
|
|
186
|
-
private compareMethodForIntersection;
|
|
187
|
-
private callDeferredsInOrder;
|
|
188
189
|
/**
|
|
189
|
-
*
|
|
190
|
+
* Fixpoint post-pass for datatype propagation: an interface loses `datatype`
|
|
191
|
+
* when any of its base interfaces is not a datatype (classic Assembler's
|
|
192
|
+
* "Calculate datatype based on the datatypeness of this interface and all of
|
|
193
|
+
* its parents", run via _deferUntilTypesAvailable). External bases are looked
|
|
194
|
+
* up in the loaded dependency assemblies.
|
|
190
195
|
*/
|
|
191
|
-
private
|
|
196
|
+
private _propagateDatatype;
|
|
192
197
|
/**
|
|
193
|
-
*
|
|
198
|
+
* Flatten a type's base interfaces the way strada's `_processBaseInterfaces`
|
|
199
|
+
* does: keep public/exported base interfaces as `interfaces` entries, but for
|
|
200
|
+
* private/internal bases, erase them and recurse into *their* bases (so their
|
|
201
|
+
* public ancestors surface, and their members get re-listed on this type).
|
|
202
|
+
*
|
|
203
|
+
* `getBaseTypes()` alone under-reports for interfaces whose heritage goes
|
|
204
|
+
* through erased/aliased/multi-`extends` chains — recursion fixes that.
|
|
194
205
|
*/
|
|
195
|
-
private
|
|
196
|
-
private
|
|
197
|
-
private
|
|
206
|
+
private _processBaseInterfaces;
|
|
207
|
+
private _visitClass;
|
|
208
|
+
private _visitMembers;
|
|
198
209
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
210
|
+
* Documentation of a class/interface member, inherited like the classic
|
|
211
|
+
* services did it (`findBaseOfDeclaration`): a member without JSDoc of its own
|
|
212
|
+
* takes the documentation of the same-named member of the first super type
|
|
213
|
+
* (`extends` then `implements`, recursively) that documents it. The TypeScript 7
|
|
214
|
+
* checker already follows base classes, but not implemented interfaces, so the
|
|
215
|
+
* walk is done here when the checker returns nothing.
|
|
201
216
|
*/
|
|
202
|
-
private
|
|
217
|
+
private _visitMemberDocumentation;
|
|
218
|
+
private _visitMethod;
|
|
219
|
+
private _visitProperty;
|
|
220
|
+
private _visitParameter;
|
|
203
221
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
222
|
+
* Extract the `@param <name>` description for a parameter from the JSDoc
|
|
223
|
+
* block that immediately precedes its owning function declaration. Returns
|
|
224
|
+
* undefined when the declaration has no JSDoc or no matching @param tag.
|
|
206
225
|
*/
|
|
207
|
-
private
|
|
208
|
-
|
|
226
|
+
private _paramDocComment;
|
|
227
|
+
/** Source text of a declaration's file (client-side cache; no RPC). */
|
|
228
|
+
private _sourceTextOf;
|
|
229
|
+
/** The last JSDoc block in a node's leading trivia, or undefined. */
|
|
230
|
+
private _leadingJsDocBlock;
|
|
231
|
+
/** Margin-stripped lines of a JSDoc block. */
|
|
232
|
+
private _jsDocLines;
|
|
233
|
+
/** Full text of an inline JSDoc block attached to a declaration, or undefined. */
|
|
234
|
+
private _inlineJsDocText;
|
|
209
235
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
236
|
+
* Build a jsii docs object from a declaration's leading JSDoc, mirroring what
|
|
237
|
+
* `_visitDocumentation` produces from the symbol doc APIs (summary/remarks +
|
|
238
|
+
* the doc tags jsii consumes). Used for constructor (initializer) docs, where
|
|
239
|
+
* no symbol-level doc read exists on the ts path.
|
|
214
240
|
*/
|
|
215
|
-
private
|
|
241
|
+
private _docsFromDeclJsDoc;
|
|
216
242
|
/**
|
|
217
|
-
*
|
|
243
|
+
* TS5 `findBaseOfDeclaration` fallback for constructor parameters: the first
|
|
244
|
+
* super type (extends/implements, in source order) that has a PROPERTY named
|
|
245
|
+
* like the parameter contributes that property's documentation; the search
|
|
246
|
+
* stops at the first super type owning such a property even when its docs
|
|
247
|
+
* are empty. Method parameters have no such fallback.
|
|
218
248
|
*/
|
|
219
|
-
private
|
|
220
|
-
}
|
|
221
|
-
export interface AssemblerOptions {
|
|
249
|
+
private _inheritedCtorParamDoc;
|
|
222
250
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
251
|
+
* TS5 `findBaseOfDeclaration` search: the first super type (extends /
|
|
252
|
+
* implements, in source order) of a class/interface declaration that has a
|
|
253
|
+
* property with the given name contributes that property's documentation —
|
|
254
|
+
* even when empty (the search stops there). Doc resolution for the found
|
|
255
|
+
* property is itself recursive: a class element with no own JSDoc inherits
|
|
256
|
+
* from ITS super types (e.g. a getter overriding an interface property).
|
|
226
257
|
*/
|
|
227
|
-
|
|
258
|
+
private _inheritedPropDocFromBases;
|
|
228
259
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
260
|
+
* Documentation text of a member symbol, read from source (the tsgo doc APIs
|
|
261
|
+
* return an empty comment for several of these members — one of the JSDoc
|
|
262
|
+
* behaviour gaps this backend works around). A constructor parameter
|
|
263
|
+
* property's docs come from an inline JSDoc on the parameter or the
|
|
264
|
+
* constructor's `@param` tag; other members use their leading JSDoc. Empty
|
|
265
|
+
* own docs recurse into the owner's super types.
|
|
234
266
|
*/
|
|
235
|
-
|
|
267
|
+
private _symbolDocTextFromSource;
|
|
268
|
+
private _unionNodeOf;
|
|
236
269
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
270
|
+
* Client-side array-type check to avoid an out-of-process `checker.isArrayType`
|
|
271
|
+
* RPC on every type reference (~85k on aws-cdk-lib). `type.isTypeReference()`
|
|
272
|
+
* is a local objectFlags bit; the target's symbol name (`Array`/`ReadonlyArray`
|
|
273
|
+
* from a `lib.*.d.ts`) is resolved client-side after the global Array type is
|
|
274
|
+
* fetched once. Verified to produce identical `.jsii` vs `checker.isArrayType`.
|
|
240
275
|
*/
|
|
241
|
-
|
|
276
|
+
private _isArrayType;
|
|
277
|
+
/** Whether the symbol's first declaration lives in a standard-library lib.*.d.ts. */
|
|
278
|
+
private _isStdlibDecl;
|
|
279
|
+
private _typeReference;
|
|
280
|
+
private _unionTypeReference;
|
|
242
281
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
282
|
+
* Build an intersection type reference (`A & B`), e.g. jsii models
|
|
283
|
+
* `IFooRef & IGrantable` as `{ intersection: { types: [...] } }`. Mirrors
|
|
284
|
+
* strada's `type.isIntersection()` branch: each constituent is turned into a
|
|
285
|
+
* type reference, deduplicated.
|
|
246
286
|
*/
|
|
247
|
-
|
|
287
|
+
private _intersectionTypeReference;
|
|
288
|
+
private _visitDocumentation;
|
|
289
|
+
private _splitSummary;
|
|
290
|
+
private _withDefaultDocs;
|
|
291
|
+
private _locationOf;
|
|
292
|
+
private _buildAssembly;
|
|
248
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Port of the classic Assembler's `isInterfaceName`: a name denotes a
|
|
296
|
+
* behavioral interface when it starts with `I` and the second character is
|
|
297
|
+
* uppercase (so `IonicColumnProps` is not treated as one).
|
|
298
|
+
*/
|
|
299
|
+
export declare function isInterfaceName(name: string): boolean;
|
|
300
|
+
/** Whether a declaration path points into a TypeScript standard-library `lib.*.d.ts`. */
|
|
301
|
+
export declare function isStdlibDeclPath(declPath: string): boolean;
|
|
302
|
+
/** Split a doc comment block into the summary sentence and the remaining remarks. */
|
|
303
|
+
export declare function splitSummary(docBlock: string): {
|
|
304
|
+
summary?: string;
|
|
305
|
+
remarks?: string;
|
|
306
|
+
};
|
|
249
307
|
//# sourceMappingURL=assembler.d.ts.map
|