jsii 5.9.35 → 5.9.36-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.
@@ -32,6 +32,7 @@ export declare class Assembler implements Emitter {
32
32
  * Filtered to local submodules only at time of writing the assembly out to disk.
33
33
  */
34
34
  private readonly _submodules;
35
+ private readonly _typeTracker;
35
36
  /**
36
37
  * @param projectInfo information about the package being assembled
37
38
  * @param program the TypeScript program to be assembled from
package/lib/assembler.js CHANGED
@@ -26,6 +26,7 @@ const deprecation_warnings_1 = require("./transforms/deprecation-warnings");
26
26
  const runtime_info_1 = require("./transforms/runtime-info");
27
27
  const utils_1 = require("./transforms/utils");
28
28
  const type_reference_1 = require("./type-reference");
29
+ const type_tracker_1 = require("./type-tracker");
29
30
  const type_visitor_1 = require("./type-visitor");
30
31
  const utils_2 = require("./utils");
31
32
  const validator_1 = require("./validator");
@@ -63,6 +64,7 @@ class Assembler {
63
64
  * Filtered to local submodules only at time of writing the assembly out to disk.
64
65
  */
65
66
  this._submodules = new Map();
67
+ this._typeTracker = new type_tracker_1.TypeTracker();
66
68
  this._typeChecker = this.program.getTypeChecker();
67
69
  if (options.stripDeprecated) {
68
70
  let allowlistedDeprecations;
@@ -75,7 +77,7 @@ class Assembler {
75
77
  this.deprecatedRemover = new deprecated_remover_1.DeprecatedRemover(this._typeChecker, allowlistedDeprecations);
76
78
  }
77
79
  if (options.addDeprecationWarnings) {
78
- this.warningsInjector = new deprecation_warnings_1.DeprecationWarningsInjector(this._typeChecker);
80
+ this.warningsInjector = new deprecation_warnings_1.DeprecationWarningsInjector(this._typeChecker, this._typeTracker);
79
81
  }
80
82
  this.compressAssembly = options.compressAssembly;
81
83
  const dts = projectInfo.types ?? 'index.d.ts';
@@ -1206,6 +1208,11 @@ class Assembler {
1206
1208
  if (flags & ts.ModifierFlags.Const) {
1207
1209
  this._diagnostics.push(jsii_diagnostic_1.JsiiDiagnostic.JSII_1000_NO_CONST_ENUM.create(decl.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ConstKeyword) ?? decl));
1208
1210
  }
1211
+ for (const memberDecl of decl.members) {
1212
+ if (this._typeChecker.getConstantValue(memberDecl) === undefined) {
1213
+ this._diagnostics.push(jsii_diagnostic_1.JsiiDiagnostic.JSII_1012_ONLY_CONST_ENUM_MEMBERS.create(memberDecl));
1214
+ }
1215
+ }
1209
1216
  const { docs } = this._visitDocumentation(symbol, ctx);
1210
1217
  const typeContext = ctx.replaceStability(docs?.stability);
1211
1218
  const members = type.isUnion() ? type.types : [type];
@@ -1228,6 +1235,7 @@ class Assembler {
1228
1235
  // as the target symbol if possible.
1229
1236
  symbolId: (0, symbol_id_1.symbolIdentifier)(this._typeChecker, symbol),
1230
1237
  }, decl);
1238
+ this._typeTracker.registerEnum(jsiiType.fqn, decl);
1231
1239
  return jsiiType;
1232
1240
  }
1233
1241
  assertNoDuplicateEnumValues(decl) {