jsii 6.0.4 → 6.0.5-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 +7 -0
- package/lib/assembler.js +24 -1
- package/lib/assembler.js.map +1 -1
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/lib/version.js.map +1 -1
- package/package.json +6 -5
package/lib/assembler.d.ts
CHANGED
|
@@ -145,6 +145,13 @@ export declare class Assembler implements Emitter {
|
|
|
145
145
|
* (no messing around with binding 'self' and 'this' and doing multiple calls to _withBaseClass.)
|
|
146
146
|
*/
|
|
147
147
|
private _withBaseClass;
|
|
148
|
+
/**
|
|
149
|
+
* Whether a symbol is marked with the `@jsii ignore` directive on *all* of its
|
|
150
|
+
* declarations. We require every declaration to be ignored so that emission
|
|
151
|
+
* (`_visitNode`) and reference resolution (`_isPrivateOrInternal`) agree: a
|
|
152
|
+
* partially-ignored merged declaration stays a visible part of the public API.
|
|
153
|
+
*/
|
|
154
|
+
private _isIgnored;
|
|
148
155
|
/**
|
|
149
156
|
* @returns true if this member is internal and should be omitted from the type manifest
|
|
150
157
|
*/
|
package/lib/assembler.js
CHANGED
|
@@ -745,6 +745,19 @@ class Assembler {
|
|
|
745
745
|
if ((ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export) === 0) {
|
|
746
746
|
return [];
|
|
747
747
|
}
|
|
748
|
+
// Early exit if the declaration is marked with `@jsii ignore`. We resolve the
|
|
749
|
+
// symbol and require *every* declaration to be ignored (see `_isIgnored`) so
|
|
750
|
+
// this stays consistent with how references are resolved; otherwise a
|
|
751
|
+
// partially-ignored merged declaration would be dropped here but treated as
|
|
752
|
+
// public elsewhere. Without this, deriving from a `Partial<T>` would also
|
|
753
|
+
// raise spurious compiler errors on an ignored declaration.
|
|
754
|
+
const nodeSymbol = this._typeChecker.getSymbolAtLocation(ts.getNameOfDeclaration(node) ?? node);
|
|
755
|
+
const isIgnored = nodeSymbol != null
|
|
756
|
+
? this._isIgnored(nodeSymbol)
|
|
757
|
+
: directives_1.Directives.of(node, (diag) => this._diagnostics.push(diag)).ignore != null;
|
|
758
|
+
if (isIgnored) {
|
|
759
|
+
return [];
|
|
760
|
+
}
|
|
748
761
|
let jsiiType;
|
|
749
762
|
if (ts.isClassDeclaration(node) && _isExported(node)) {
|
|
750
763
|
// export class Name { ... }
|
|
@@ -1200,6 +1213,16 @@ class Assembler {
|
|
|
1200
1213
|
});
|
|
1201
1214
|
}
|
|
1202
1215
|
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Whether a symbol is marked with the `@jsii ignore` directive on *all* of its
|
|
1218
|
+
* declarations. We require every declaration to be ignored so that emission
|
|
1219
|
+
* (`_visitNode`) and reference resolution (`_isPrivateOrInternal`) agree: a
|
|
1220
|
+
* partially-ignored merged declaration stays a visible part of the public API.
|
|
1221
|
+
*/
|
|
1222
|
+
_isIgnored(symbol) {
|
|
1223
|
+
return ((symbol.declarations?.length ?? 0) > 0 &&
|
|
1224
|
+
symbol.declarations.every((decl) => directives_1.Directives.of(decl, (diag) => this._diagnostics.push(diag)).ignore != null));
|
|
1225
|
+
}
|
|
1203
1226
|
/**
|
|
1204
1227
|
* @returns true if this member is internal and should be omitted from the type manifest
|
|
1205
1228
|
*/
|
|
@@ -1212,7 +1235,7 @@ class Assembler {
|
|
|
1212
1235
|
return true;
|
|
1213
1236
|
}
|
|
1214
1237
|
// If all the declarations are marked with `@jsii ignore`, then this is effetcively private as far as jsii is concerned.
|
|
1215
|
-
if (
|
|
1238
|
+
if (this._isIgnored(symbol)) {
|
|
1216
1239
|
return true;
|
|
1217
1240
|
}
|
|
1218
1241
|
if (!hasInternalJsDocTag && !hasUnderscorePrefix) {
|