jsii-pacmak 1.111.0 → 1.113.0

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.
Files changed (46) hide show
  1. package/lib/dependency-graph.d.ts +1 -1
  2. package/lib/dependency-graph.js +1 -2
  3. package/lib/index.js +2 -2
  4. package/lib/logging.js +6 -6
  5. package/lib/markdown.js +2 -3
  6. package/lib/naming-util.js +1 -2
  7. package/lib/npm-modules.js +2 -3
  8. package/lib/target.js +2 -2
  9. package/lib/targets/_utils.js +2 -3
  10. package/lib/targets/dotnet/dotnetgenerator.d.ts +2 -1
  11. package/lib/targets/dotnet/dotnetgenerator.js +53 -58
  12. package/lib/targets/dotnet/dotnettyperesolver.d.ts +2 -2
  13. package/lib/targets/dotnet/dotnettyperesolver.js +7 -3
  14. package/lib/targets/dotnet/filegenerator.js +2 -2
  15. package/lib/targets/dotnet/runtime-type-checking.js +3 -3
  16. package/lib/targets/dotnet.js +4 -4
  17. package/lib/targets/go/comparators.d.ts +1 -1
  18. package/lib/targets/go/comparators.js +1 -2
  19. package/lib/targets/go/dependencies.js +3 -3
  20. package/lib/targets/go/package.d.ts +1 -1
  21. package/lib/targets/go/package.js +1 -1
  22. package/lib/targets/go/runtime/constants.d.ts +13 -13
  23. package/lib/targets/go/runtime/emit-arguments.js +1 -2
  24. package/lib/targets/go/runtime/runtime-type-checking.js +10 -10
  25. package/lib/targets/go/runtime/util.js +2 -3
  26. package/lib/targets/go/types/class.js +4 -6
  27. package/lib/targets/go/types/go-type-reference.d.ts +1 -1
  28. package/lib/targets/go/types/go-type-reference.js +1 -3
  29. package/lib/targets/go/util.js +7 -8
  30. package/lib/targets/index.d.ts +1 -1
  31. package/lib/targets/index.js +1 -1
  32. package/lib/targets/java.js +17 -17
  33. package/lib/targets/js.d.ts +1 -1
  34. package/lib/targets/python/requirements-dev.txt +1 -1
  35. package/lib/targets/python/type-name.js +9 -10
  36. package/lib/targets/python/util.js +2 -3
  37. package/lib/targets/python.d.ts +2 -2
  38. package/lib/targets/python.js +5 -11
  39. package/lib/targets/version-utils.js +4 -5
  40. package/lib/toposort.d.ts +3 -3
  41. package/lib/toposort.js +1 -2
  42. package/lib/util.d.ts +0 -1
  43. package/lib/util.js +17 -17
  44. package/lib/version.d.ts +1 -1
  45. package/lib/version.js +3 -3
  46. package/package.json +18 -18
@@ -25,7 +25,7 @@ export declare function traverseDependencyGraph(packageDir: string, callback: Ca
25
25
  * @returns `true` if this package's own dependencies should be processed,
26
26
  * `false` otherwise.
27
27
  */
28
- export declare type Callback = (packageDir: string, meta: PackageJson, root: boolean) => boolean | Promise<boolean>;
28
+ export type Callback = (packageDir: string, meta: PackageJson, root: boolean) => boolean | Promise<boolean>;
29
29
  /**
30
30
  * Host methods for traversing dependency graphs.
31
31
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.traverseDependencyGraph = void 0;
3
+ exports.traverseDependencyGraph = traverseDependencyGraph;
4
4
  const fs = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const util = require("./util");
@@ -23,7 +23,6 @@ async function traverseDependencyGraph(packageDir, callback, host = {
23
23
  }) {
24
24
  return real$traverseDependencyGraph(packageDir, callback, host, new Set());
25
25
  }
26
- exports.traverseDependencyGraph = traverseDependencyGraph;
27
26
  async function real$traverseDependencyGraph(packageDir, callback, host, visited) {
28
27
  // We're at the root if we have not visited anything yet. How convenient!
29
28
  const isRoot = visited.size === 0;
package/lib/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pacmak = exports.configureLogging = exports.TargetName = void 0;
3
+ exports.configureLogging = exports.TargetName = void 0;
4
+ exports.pacmak = pacmak;
4
5
  const jsii_reflect_1 = require("jsii-reflect");
5
6
  const jsii_rosetta_1 = require("jsii-rosetta");
6
7
  const path_1 = require("path");
@@ -95,7 +96,6 @@ async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint =
95
96
  }
96
97
  logging.info(`Packaged. ${timers.display()}`);
97
98
  }
98
- exports.pacmak = pacmak;
99
99
  //#endregion
100
100
  //#region Building
101
101
  async function buildTargetsForLanguage(targetLanguage, modules, { argv, clean, codeOnly, fingerprint, force, perLanguageDirectory, rosetta, runtimeTypeChecking, }) {
package/lib/logging.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debug = exports.info = exports.warn = exports.configure = exports.level = exports.LEVEL_SILLY = exports.LEVEL_VERBOSE = exports.LEVEL_INFO = exports.Level = void 0;
3
+ exports.level = exports.LEVEL_SILLY = exports.LEVEL_VERBOSE = exports.LEVEL_INFO = exports.Level = void 0;
4
+ exports.configure = configure;
5
+ exports.warn = warn;
6
+ exports.info = info;
7
+ exports.debug = debug;
4
8
  var Level;
5
9
  (function (Level) {
6
10
  Level[Level["WARN"] = -1] = "WARN";
@@ -8,7 +12,7 @@ var Level;
8
12
  Level[Level["INFO"] = 1] = "INFO";
9
13
  Level[Level["VERBOSE"] = 2] = "VERBOSE";
10
14
  Level[Level["SILLY"] = 3] = "SILLY";
11
- })(Level = exports.Level || (exports.Level = {}));
15
+ })(Level || (exports.Level = Level = {}));
12
16
  exports.LEVEL_INFO = Level.INFO;
13
17
  exports.LEVEL_VERBOSE = Level.VERBOSE;
14
18
  exports.LEVEL_SILLY = Level.SILLY;
@@ -17,19 +21,15 @@ exports.level = Level.QUIET;
17
21
  function configure({ level: newLevel }) {
18
22
  exports.level = newLevel;
19
23
  }
20
- exports.configure = configure;
21
24
  function warn(fmt, ...args) {
22
25
  log(Level.WARN, fmt, ...args);
23
26
  }
24
- exports.warn = warn;
25
27
  function info(fmt, ...args) {
26
28
  log(Level.INFO, fmt, ...args);
27
29
  }
28
- exports.info = info;
29
30
  function debug(fmt, ...args) {
30
31
  log(Level.VERBOSE, fmt, ...args);
31
32
  }
32
- exports.debug = debug;
33
33
  function log(messageLevel, fmt, ...args) {
34
34
  if (exports.level >= messageLevel) {
35
35
  const levelName = Level[messageLevel];
package/lib/markdown.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.md2html = exports.md2rst = void 0;
3
+ exports.md2rst = md2rst;
4
+ exports.md2html = md2html;
4
5
  const commonmark = require("commonmark");
5
6
  /**
6
7
  * Convert MarkDown to RST
@@ -113,13 +114,11 @@ function md2rst(text) {
113
114
  });
114
115
  return doc.toString();
115
116
  }
116
- exports.md2rst = md2rst;
117
117
  function md2html(text) {
118
118
  const parser = new commonmark.Parser({ smart: false });
119
119
  const renderer = new commonmark.HtmlRenderer({ smart: false, safe: true });
120
120
  return renderer.render(parser.parse(text));
121
121
  }
122
- exports.md2html = md2html;
123
122
  /**
124
123
  * Build a document incrementally
125
124
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsiiToPascalCase = void 0;
3
+ exports.jsiiToPascalCase = jsiiToPascalCase;
4
4
  /**
5
5
  * Converts a jsii method/property names to pascal-case.
6
6
  *
@@ -14,5 +14,4 @@ exports.jsiiToPascalCase = void 0;
14
14
  function jsiiToPascalCase(camelCase) {
15
15
  return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
16
16
  }
17
- exports.jsiiToPascalCase = jsiiToPascalCase;
18
17
  //# sourceMappingURL=naming-util.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAllNpmIgnores = exports.findJsiiModules = void 0;
3
+ exports.findJsiiModules = findJsiiModules;
4
+ exports.updateAllNpmIgnores = updateAllNpmIgnores;
4
5
  const spec = require("@jsii/spec");
5
6
  const fs = require("fs-extra");
6
7
  const path = require("path");
@@ -75,11 +76,9 @@ async function findJsiiModules(directories, recurse) {
75
76
  }));
76
77
  }
77
78
  }
78
- exports.findJsiiModules = findJsiiModules;
79
79
  async function updateAllNpmIgnores(packages) {
80
80
  await Promise.all(packages.map((pkg) => updateNpmIgnore(pkg.moduleDirectory, pkg.outputDirectory)));
81
81
  }
82
- exports.updateAllNpmIgnores = updateAllNpmIgnores;
83
82
  async function updateNpmIgnore(packageDir, excludeOutdir) {
84
83
  const npmIgnorePath = path.join(packageDir, '.npmignore');
85
84
  let lines = new Array();
package/lib/target.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findLocalBuildDirs = exports.Target = void 0;
3
+ exports.Target = void 0;
4
+ exports.findLocalBuildDirs = findLocalBuildDirs;
4
5
  const fs = require("fs-extra");
5
6
  const path = require("path");
6
7
  const spdx = require("spdx-license-list/full");
@@ -93,5 +94,4 @@ async function findLocalBuildDirs(rootPackageDir, targetName) {
93
94
  return true;
94
95
  }
95
96
  }
96
- exports.findLocalBuildDirs = findLocalBuildDirs;
97
97
  //# sourceMappingURL=target.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderSummary = exports.stabilityPrefixFor = void 0;
3
+ exports.stabilityPrefixFor = stabilityPrefixFor;
4
+ exports.renderSummary = renderSummary;
4
5
  const spec = require("@jsii/spec");
5
6
  function stabilityPrefixFor(element) {
6
7
  if (element.docs?.stability === spec.Stability.Experimental) {
@@ -11,9 +12,7 @@ function stabilityPrefixFor(element) {
11
12
  }
12
13
  return '';
13
14
  }
14
- exports.stabilityPrefixFor = stabilityPrefixFor;
15
15
  function renderSummary(docs) {
16
16
  return docs?.summary ? stabilityPrefixFor({ docs }) + docs.summary : '';
17
17
  }
18
- exports.renderSummary = renderSummary;
19
18
  //# sourceMappingURL=_utils.js.map
@@ -58,6 +58,7 @@ export declare class DotNetGenerator extends Generator {
58
58
  protected onEnumMember(enm: spec.EnumType, member: spec.EnumMember): void;
59
59
  private namespaceFor;
60
60
  private emitMethod;
61
+ private memberKeywords;
61
62
  /**
62
63
  * Emits type checks for values passed for type union parameters.
63
64
  *
@@ -117,7 +118,7 @@ export declare class DotNetGenerator extends Generator {
117
118
  */
118
119
  private emitProperty;
119
120
  /**
120
- * Emits a constant property
121
+ * Emits a (static) constant property
121
122
  */
122
123
  private emitConstProperty;
123
124
  private renderAccessLevel;
@@ -387,37 +387,7 @@ class DotNetGenerator extends generator_1.Generator {
387
387
  ? this.typeresolver.toDotNetType(method.returns.type)
388
388
  : 'void';
389
389
  const staticKeyWord = method.static ? 'static ' : '';
390
- let overrideKeyWord = '';
391
- let virtualKeyWord = '';
392
- let definedOnAncestor = false;
393
- // In the case of the source being a class, we check if it is already defined on an ancestor
394
- if (spec.isClassType(cls)) {
395
- definedOnAncestor = this.isMemberDefinedOnAncestor(cls, method);
396
- }
397
- // The method is an override if it's defined on the ancestor, or if the parent is a class and we are generating a proxy or datatype class
398
- let overrides = definedOnAncestor || (spec.isClassType(cls) && emitForProxyOrDatatype);
399
- // We also inspect the jsii model to see if it overrides a class member.
400
- if (method.overrides) {
401
- const overrideType = this.findType(method.overrides);
402
- if (spec.isClassType(overrideType)) {
403
- // Overrides a class, needs overrides keyword
404
- overrides = true;
405
- }
406
- }
407
- if (overrides) {
408
- // Add the override key word if the method is emitted for a proxy or data type or is defined on an ancestor. If
409
- // the member is static, use the "new" keyword instead, to indicate we are intentionally hiding the ancestor
410
- // declaration (as C# does not inherit statics, they can be hidden but not overridden). The "new" keyword is
411
- // optional in this context, but helps clarify intention.
412
- overrideKeyWord = method.static ? 'new ' : 'override ';
413
- }
414
- else if (!method.static &&
415
- (method.abstract || !definedOnAncestor) &&
416
- !emitForProxyOrDatatype) {
417
- // Add the virtual key word if the method is abstract or not defined on an ancestor and we are NOT generating a proxy or datatype class
418
- // Methods should always be virtual when possible
419
- virtualKeyWord = 'virtual ';
420
- }
390
+ const { overrideKeyword, virtualKeyword } = this.memberKeywords(cls, method, emitForProxyOrDatatype);
421
391
  const access = this.renderAccessLevel(method);
422
392
  const methodName = this.nameutils.convertMethodName(method.name);
423
393
  const isOptional = method.returns && method.returns.optional ? '?' : '';
@@ -429,16 +399,50 @@ class DotNetGenerator extends generator_1.Generator {
429
399
  });
430
400
  this.dotnetRuntimeGenerator.emitAttributesForMethod(cls, method /*, emitForProxyOrDatatype*/);
431
401
  if (method.abstract) {
432
- this.code.line(`${access} ${overrideKeyWord}abstract ${signature};`);
402
+ this.code.line(`${access} ${overrideKeyword}abstract ${signature};`);
433
403
  this.code.line();
434
404
  }
435
405
  else {
436
- this.code.openBlock(`${access} ${staticKeyWord}${overrideKeyWord}${virtualKeyWord}${signature}`);
406
+ this.code.openBlock(`${access} ${staticKeyWord}${overrideKeyword}${virtualKeyword}${signature}`);
437
407
  this.emitUnionParameterValdation(this.reflectAssembly.findType(cls.fqn).allMethods.find((m) => m.name === method.name).parameters);
438
408
  this.code.line(this.dotnetRuntimeGenerator.createInvokeMethodIdentifier(method, cls));
439
409
  this.code.closeBlock();
440
410
  }
441
411
  }
412
+ memberKeywords(currentClass, member, proxyOrDataType) {
413
+ if (!spec.isClassType(currentClass)) {
414
+ return { overrideKeyword: '', virtualKeyword: '' };
415
+ }
416
+ const implementedInBase = this.isMemberDefinedOnAncestor(currentClass, member);
417
+ if (implementedInBase || proxyOrDataType) {
418
+ // Override if the property is in a datatype or proxy class or declared in a parent class. If the member is
419
+ // static, use the "new" keyword instead, to indicate we are intentionally hiding the ancestor declaration (as
420
+ // C# does not inherit statics, they can be hidden but not overridden).The "new" keyword is optional in this
421
+ // context, but helps clarify intention.
422
+ return {
423
+ overrideKeyword: member.static ? 'new ' : 'override ',
424
+ virtualKeyword: '',
425
+ };
426
+ }
427
+ else if (member.abstract) {
428
+ // Abstract members get decorated as such
429
+ return {
430
+ overrideKeyword: '',
431
+ virtualKeyword: 'abstract ',
432
+ };
433
+ }
434
+ else if (!member.static && !implementedInBase) {
435
+ // Virtual if the prop is not static, and is not implemented in base member, this way we can later override it.
436
+ return {
437
+ overrideKeyword: '',
438
+ virtualKeyword: 'virtual ',
439
+ };
440
+ }
441
+ return {
442
+ overrideKeyword: '',
443
+ virtualKeyword: '',
444
+ };
445
+ }
442
446
  /**
443
447
  * Emits type checks for values passed for type union parameters.
444
448
  *
@@ -471,6 +475,15 @@ class DotNetGenerator extends generator_1.Generator {
471
475
  return true;
472
476
  }
473
477
  }
478
+ // Check the `overrides` directive directly from the jsii assembly
479
+ if (member.overrides) {
480
+ const overrideType = this.findType(member.overrides);
481
+ if (spec.isClassType(overrideType)) {
482
+ // Overrides a class, needs overrides keyword
483
+ return true;
484
+ }
485
+ }
486
+ // Look for something that's named the same
474
487
  const base = cls.base;
475
488
  if (base) {
476
489
  const baseType = this.findType(base);
@@ -735,29 +748,8 @@ class DotNetGenerator extends generator_1.Generator {
735
748
  this.code.line('[JsiiOptional]');
736
749
  }
737
750
  this.dotnetRuntimeGenerator.emitAttributesForProperty(prop);
738
- let isOverrideKeyWord = '';
739
- let isVirtualKeyWord = '';
740
- let isAbstractKeyword = '';
741
- // If the prop parent is a class
742
- if (spec.isClassType(cls)) {
743
- const implementedInBase = this.isMemberDefinedOnAncestor(cls, prop);
744
- if (implementedInBase || datatype || proxy) {
745
- // Override if the property is in a datatype or proxy class or declared in a parent class. If the member is
746
- // static, use the "new" keyword instead, to indicate we are intentionally hiding the ancestor declaration (as
747
- // C# does not inherit statics, they can be hidden but not overridden).The "new" keyword is optional in this
748
- // context, but helps clarify intention.
749
- isOverrideKeyWord = prop.static ? 'new ' : 'override ';
750
- }
751
- else if (prop.abstract) {
752
- // Abstract members get decorated as such
753
- isAbstractKeyword = 'abstract ';
754
- }
755
- else if (!prop.static && !implementedInBase) {
756
- // Virtual if the prop is not static, and is not implemented in base member, this way we can later override it.
757
- isVirtualKeyWord = 'virtual ';
758
- }
759
- }
760
- const statement = `${access} ${isAbstractKeyword}${isVirtualKeyWord}${staticKeyWord}${isOverrideKeyWord}${propTypeFQN}${isOptional} ${propName}`;
751
+ const { virtualKeyword, overrideKeyword } = this.memberKeywords(cls, prop, datatype || proxy);
752
+ const statement = `${access} ${virtualKeyword}${staticKeyWord}${overrideKeyword}${propTypeFQN}${isOptional} ${propName}`;
761
753
  this.code.openBlock(statement);
762
754
  // Emit getters
763
755
  if (backingFieldName != null) {
@@ -815,7 +807,7 @@ class DotNetGenerator extends generator_1.Generator {
815
807
  this.flagFirstMemberWritten(true);
816
808
  }
817
809
  /**
818
- * Emits a constant property
810
+ * Emits a (static) constant property
819
811
  */
820
812
  emitConstProperty(cls, prop) {
821
813
  this.emitNewLineIfNecessary();
@@ -831,7 +823,10 @@ class DotNetGenerator extends generator_1.Generator {
831
823
  const access = this.renderAccessLevel(prop);
832
824
  const propName = this.nameutils.convertPropertyName(prop.name);
833
825
  const staticKeyword = prop.static ? 'static ' : '';
834
- this.code.openBlock(`${access} ${staticKeyword}${propType}${isOptional} ${propName}`);
826
+ const { overrideKeyword } = this.memberKeywords(cls, prop,
827
+ // Static properties are never on proxies or datatypes (because those come from TS interfaces)
828
+ false);
829
+ this.code.openBlock(`${access} ${staticKeyword}${overrideKeyword}${propType}${isOptional} ${propName}`);
835
830
  this.code.line('get;');
836
831
  this.code.closeBlock();
837
832
  const className = this.typeresolver.toNativeFqn(cls.fqn);
@@ -1,7 +1,7 @@
1
1
  import * as spec from '@jsii/spec';
2
2
  import { DotNetDependency } from './filegenerator';
3
- declare type FindModuleCallback = (fqn: string) => spec.AssemblyConfiguration;
4
- declare type FindTypeCallback = (fqn: string) => spec.Type;
3
+ type FindModuleCallback = (fqn: string) => spec.AssemblyConfiguration;
4
+ type FindTypeCallback = (fqn: string) => spec.Type;
5
5
  export declare class DotNetTypeResolver {
6
6
  private readonly assembliesCurrentlyBeingCompiled;
7
7
  namespaceDependencies: Map<string, DotNetDependency>;
@@ -134,11 +134,15 @@ class DotNetTypeResolver {
134
134
  for (let i = 0; i < segments.length; i++) {
135
135
  const submoduleName = `${assmName}.${segments.slice(0, i + 1).join('.')}`;
136
136
  const submodule = assm.submodules?.[submoduleName];
137
- if (submodule && submodule.targets?.dotnet?.namespace) {
138
- resolved = submodule.targets.dotnet.namespace;
137
+ if (submodule) {
138
+ // This is a submodule, either it has an explicit namespace or we do the name conversion here
139
+ resolved =
140
+ submodule.targets?.dotnet?.namespace ??
141
+ `${resolved}.${(0, codemaker_1.toPascalCase)(segments[i])}`;
139
142
  }
140
143
  else {
141
- resolved = `${resolved}.${(0, codemaker_1.toPascalCase)(segments[i])}`;
144
+ // If it's not a submodule, it's a type and we need to convert the name the way we would convert names normally.
145
+ resolved = `${resolved}.${new nameutils_1.DotNetNameUtils().convertTypeName(segments[i])}`;
142
146
  }
143
147
  }
144
148
  return resolved;
@@ -92,7 +92,7 @@ class FileGenerator {
92
92
  propertyGroup.ele('Nullable', 'enable');
93
93
  propertyGroup.ele('SymbolPackageFormat', 'snupkg');
94
94
  propertyGroup.ele('TargetFramework', dotnet_1.TARGET_FRAMEWORK);
95
- // Transparently rolll forward across major SDK releases if needed
95
+ // Transparently roll forward across major SDK releases if needed
96
96
  propertyGroup.ele('RollForward', 'Major');
97
97
  const itemGroup1 = rootNode.ele('ItemGroup');
98
98
  const embeddedResource = itemGroup1.ele('EmbeddedResource');
@@ -119,7 +119,7 @@ class FileGenerator {
119
119
  // Treat select warnings as errors, as these are likely codegen bugs:
120
120
  warnings.comment('Treat warnings symptomatic of code generation bugs as errors');
121
121
  warnings.ele('WarningsAsErrors', [
122
- '0108',
122
+ '0108', // 'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended.
123
123
  '0109', // The member 'member' does not hide an inherited member. The new keyword is not required.
124
124
  ].join(','));
125
125
  const xml = rootNode.end({ pretty: true, spaceBeforeSlash: true });
@@ -5,9 +5,6 @@ const spec_1 = require("@jsii/spec");
5
5
  const crypto_1 = require("crypto");
6
6
  const jsii_reflect_1 = require("jsii-reflect");
7
7
  class ParameterValidator {
8
- constructor(validations) {
9
- this.validations = validations;
10
- }
11
8
  static forParameters(parameters, nameUtils, { noMangle }) {
12
9
  if (parameters.length === 0) {
13
10
  return undefined;
@@ -39,6 +36,9 @@ class ParameterValidator {
39
36
  }
40
37
  return new ParameterValidator(parameterValidations);
41
38
  }
39
+ constructor(validations) {
40
+ this.validations = validations;
41
+ }
42
42
  emit(code, resolver) {
43
43
  for (const [_parameter, validations] of this.validations) {
44
44
  for (const validation of validations) {
@@ -184,10 +184,6 @@ function projectLocation(module) {
184
184
  };
185
185
  }
186
186
  class Dotnet extends target_1.Target {
187
- constructor(options, assembliesCurrentlyBeingCompiled) {
188
- super(options);
189
- this.generator = new dotnetgenerator_1.DotNetGenerator(assembliesCurrentlyBeingCompiled, options);
190
- }
191
187
  static toPackageInfos(assm) {
192
188
  const packageId = assm.targets.dotnet.packageId;
193
189
  const version = (0, version_utils_1.toReleaseVersion)(assm.version, _1.TargetName.DOTNET);
@@ -216,6 +212,10 @@ class Dotnet extends target_1.Target {
216
212
  'c#': `using ${options.namespace};`,
217
213
  };
218
214
  }
215
+ constructor(options, assembliesCurrentlyBeingCompiled) {
216
+ super(options);
217
+ this.generator = new dotnetgenerator_1.DotNetGenerator(assembliesCurrentlyBeingCompiled, options);
218
+ }
219
219
  // eslint-disable-next-line @typescript-eslint/require-await
220
220
  async build(_sourceDir, _outDir) {
221
221
  throw new Error('Should not be called; use builder instead');
@@ -1,4 +1,4 @@
1
- declare type Named = {
1
+ type Named = {
2
2
  readonly name: string;
3
3
  };
4
4
  export declare function byName(l: Named, r: Named): number;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.byName = void 0;
3
+ exports.byName = byName;
4
4
  function byName(l, r) {
5
5
  return l.name.localeCompare(r.name);
6
6
  }
7
- exports.byName = byName;
8
7
  //# sourceMappingURL=comparators.js.map
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GO_REFLECT = exports.JSII_RT_MODULE = exports.INTERNAL_PACKAGE_NAME = exports.toImportedModules = exports.reduceSpecialDependencies = void 0;
3
+ exports.GO_REFLECT = exports.JSII_RT_MODULE = exports.INTERNAL_PACKAGE_NAME = void 0;
4
+ exports.reduceSpecialDependencies = reduceSpecialDependencies;
5
+ exports.toImportedModules = toImportedModules;
4
6
  const assert = require("assert");
5
7
  const runtime_1 = require("./runtime");
6
8
  function reduceSpecialDependencies(...specialDepsList) {
@@ -23,7 +25,6 @@ function reduceSpecialDependencies(...specialDepsList) {
23
25
  time: acc.time || elt.time,
24
26
  }), first);
25
27
  }
26
- exports.reduceSpecialDependencies = reduceSpecialDependencies;
27
28
  function toImportedModules(specialDeps, context) {
28
29
  const result = new Array();
29
30
  if (specialDeps.fmt) {
@@ -48,7 +49,6 @@ function toImportedModules(specialDeps, context) {
48
49
  }
49
50
  return result;
50
51
  }
51
- exports.toImportedModules = toImportedModules;
52
52
  /**
53
53
  * The name of a sub-package that includes internal type aliases it has to be
54
54
  * "internal" so it not published.
@@ -3,7 +3,7 @@ import { Assembly, ModuleLike as JsiiModuleLike, Submodule as JsiiSubmodule } fr
3
3
  import { EmitContext } from './emit-context';
4
4
  import { GoClass, GoType, GoInterface, GoTypeRef } from './types';
5
5
  export declare const GOMOD_FILENAME = "go.mod";
6
- export declare const GO_VERSION = "1.18";
6
+ export declare const GO_VERSION = "1.23";
7
7
  export declare abstract class Package {
8
8
  private readonly jsiiModule;
9
9
  readonly packageName: string;
@@ -11,7 +11,7 @@ const util_1 = require("./util");
11
11
  const version_file_1 = require("./version-file");
12
12
  const version_1 = require("../../version");
13
13
  exports.GOMOD_FILENAME = 'go.mod';
14
- exports.GO_VERSION = '1.18';
14
+ exports.GO_VERSION = '1.23';
15
15
  const MAIN_FILE = 'main.go';
16
16
  /*
17
17
  * Package represents a single `.go` source file within a package. This can be the root package file or a submodule
@@ -1,19 +1,19 @@
1
1
  export declare const JSII_RT_MODULE_NAME = "github.com/aws/jsii-runtime-go";
2
- export declare const JSII_RT_PACKAGE_NAME: string;
2
+ export declare const JSII_RT_PACKAGE_NAME = "github.com/aws/jsii-runtime-go/runtime";
3
3
  export declare const JSII_RT_ALIAS = "_jsii_";
4
4
  export declare const JSII_INIT_PACKAGE = "jsii";
5
5
  export declare const JSII_INIT_FUNC = "Initialize";
6
6
  export declare const JSII_INIT_ALIAS = "_init_";
7
- export declare const JSII_CREATE_FUNC: string;
8
- export declare const JSII_INVOKE_FUNC: string;
9
- export declare const JSII_INVOKE_VOID_FUNC: string;
10
- export declare const JSII_SINVOKE_FUNC: string;
11
- export declare const JSII_SINVOKE_VOID_FUNC: string;
12
- export declare const JSII_GET_FUNC: string;
13
- export declare const JSII_SGET_FUNC: string;
14
- export declare const JSII_SET_FUNC: string;
15
- export declare const JSII_SSET_FUNC: string;
16
- export declare const JSII_OVERRIDE: string;
17
- export declare const JSII_ANY: string;
18
- export declare const JSII_FQN: string;
7
+ export declare const JSII_CREATE_FUNC = "_jsii_.Create";
8
+ export declare const JSII_INVOKE_FUNC = "_jsii_.Invoke";
9
+ export declare const JSII_INVOKE_VOID_FUNC = "_jsii_.InvokeVoid";
10
+ export declare const JSII_SINVOKE_FUNC = "_jsii_.StaticInvoke";
11
+ export declare const JSII_SINVOKE_VOID_FUNC = "_jsii_.StaticInvokeVoid";
12
+ export declare const JSII_GET_FUNC = "_jsii_.Get";
13
+ export declare const JSII_SGET_FUNC = "_jsii_.StaticGet";
14
+ export declare const JSII_SET_FUNC = "_jsii_.Set";
15
+ export declare const JSII_SSET_FUNC = "_jsii_.StaticSet";
16
+ export declare const JSII_OVERRIDE = "_jsii_.Override";
17
+ export declare const JSII_ANY = "_jsii_.Any";
18
+ export declare const JSII_FQN = "_jsii_.FQN";
19
19
  //# sourceMappingURL=constants.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitArguments = void 0;
3
+ exports.emitArguments = emitArguments;
4
4
  const util_1 = require("./util");
5
5
  /**
6
6
  * Packages arguments such that they can be sent correctly to the jsii runtime
@@ -31,5 +31,4 @@ function emitArguments(code, parameters, returnVarName) {
31
31
  }
32
32
  return `[]interface{}{${argsList.join(', ')}}`;
33
33
  }
34
- exports.emitArguments = emitArguments;
35
34
  //# sourceMappingURL=emit-arguments.js.map
@@ -7,12 +7,6 @@ const dependencies_1 = require("../dependencies");
7
7
  const types_1 = require("../types");
8
8
  const constants_1 = require("./constants");
9
9
  class ParameterValidator {
10
- constructor(baseName, validations, receiver) {
11
- this.receiver = receiver;
12
- this.name = `validate${baseName}Parameters`;
13
- this.validations = validations;
14
- this.parameters = Array.from(validations.keys());
15
- }
16
10
  static forConstructor(ctor) {
17
11
  return ParameterValidator.fromParts(`New${ctor.parent.name}`, ctor.parameters);
18
12
  }
@@ -64,6 +58,12 @@ class ParameterValidator {
64
58
  }
65
59
  return new ParameterValidator(name, parameterValidations, receiver);
66
60
  }
61
+ constructor(baseName, validations, receiver) {
62
+ this.receiver = receiver;
63
+ this.name = `validate${baseName}Parameters`;
64
+ this.validations = validations;
65
+ this.parameters = Array.from(validations.keys());
66
+ }
67
67
  get dependencies() {
68
68
  return [
69
69
  ...this.parameters.flatMap((p) => p.reference.withTransparentUnions.dependencies),
@@ -106,10 +106,6 @@ class ParameterValidator {
106
106
  }
107
107
  exports.ParameterValidator = ParameterValidator;
108
108
  class StructValidator {
109
- constructor(receiver, validations) {
110
- this.receiver = receiver;
111
- this.validations = validations;
112
- }
113
109
  static for(struct) {
114
110
  const receiver = {
115
111
  name: struct.name.slice(0, 1).toLowerCase(),
@@ -136,6 +132,10 @@ class StructValidator {
136
132
  }
137
133
  return new StructValidator(receiver, fieldValidations);
138
134
  }
135
+ constructor(receiver, validations) {
136
+ this.receiver = receiver;
137
+ this.validations = validations;
138
+ }
139
139
  get dependencies() {
140
140
  return Array.from(this.validations.values()).flatMap((vs) => vs.flatMap((v) => v.dependencies));
141
141
  }
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.slugify = exports.emitInitialization = void 0;
3
+ exports.emitInitialization = emitInitialization;
4
+ exports.slugify = slugify;
4
5
  const constants_1 = require("./constants");
5
6
  // Emits call to initialize runtime client if not already
6
7
  function emitInitialization(code) {
7
8
  code.line(`${constants_1.JSII_INIT_ALIAS}.${constants_1.JSII_INIT_FUNC}()`);
8
9
  }
9
- exports.emitInitialization = emitInitialization;
10
10
  /**
11
11
  * Slugify a name by appending '_' at the end until the resulting name is not
12
12
  * present in the list of reserved names.
@@ -23,5 +23,4 @@ function slugify(name, reserved) {
23
23
  }
24
24
  return name;
25
25
  }
26
- exports.slugify = slugify;
27
26
  //# sourceMappingURL=util.js.map
@@ -85,12 +85,10 @@ class GoClass extends go_type_1.GoType {
85
85
  get implements() {
86
86
  // Cannot compute in constructor, as dependencies may not have finished
87
87
  // resolving just yet.
88
- if (this._implements === undefined) {
89
- this._implements = this.type.interfaces
90
- .map((iface) => this.pkg.root.findType(iface.fqn))
91
- // Ensure consistent order, mostly cosmetic.
92
- .sort((l, r) => l.fqn.localeCompare(r.fqn));
93
- }
88
+ this._implements ?? (this._implements = this.type.interfaces
89
+ .map((iface) => this.pkg.root.findType(iface.fqn))
90
+ // Ensure consistent order, mostly cosmetic.
91
+ .sort((l, r) => l.fqn.localeCompare(r.fqn)));
94
92
  return this._implements;
95
93
  }
96
94
  get baseTypes() {