jsii-pacmak 1.112.0 → 1.114.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.
Files changed (46) hide show
  1. package/bin/jsii-pacmak.js +1 -1
  2. package/lib/dependency-graph.d.ts +1 -1
  3. package/lib/dependency-graph.js +1 -2
  4. package/lib/index.js +4 -2
  5. package/lib/logging.js +6 -6
  6. package/lib/markdown.js +2 -3
  7. package/lib/naming-util.js +1 -2
  8. package/lib/npm-modules.js +2 -3
  9. package/lib/rosetta-assembly.d.ts +16 -0
  10. package/lib/rosetta-assembly.js +23 -0
  11. package/lib/target.js +2 -2
  12. package/lib/targets/_utils.js +2 -3
  13. package/lib/targets/dotnet/dotnetdocgenerator.js +3 -0
  14. package/lib/targets/dotnet/dotnettyperesolver.d.ts +2 -2
  15. package/lib/targets/dotnet/dotnettyperesolver.js +9 -5
  16. package/lib/targets/dotnet/filegenerator.js +2 -2
  17. package/lib/targets/dotnet/runtime-type-checking.js +3 -3
  18. package/lib/targets/dotnet.js +4 -4
  19. package/lib/targets/go/comparators.d.ts +1 -1
  20. package/lib/targets/go/comparators.js +1 -2
  21. package/lib/targets/go/dependencies.js +3 -3
  22. package/lib/targets/go/package.d.ts +1 -1
  23. package/lib/targets/go/package.js +1 -1
  24. package/lib/targets/go/runtime/constants.d.ts +13 -13
  25. package/lib/targets/go/runtime/emit-arguments.js +1 -2
  26. package/lib/targets/go/runtime/runtime-type-checking.js +10 -10
  27. package/lib/targets/go/runtime/util.js +2 -3
  28. package/lib/targets/go/types/go-type-reference.d.ts +1 -1
  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 +21 -18
  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 +7 -8
  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 +21 -20
@@ -172,7 +172,7 @@ const version_1 = require("../lib/version");
172
172
  force: argv.force,
173
173
  forceSubdirectory: argv['force-subdirectory'],
174
174
  forceTarget: argv['force-target'],
175
- inputDirectories: argv.PROJECTS,
175
+ inputDirectories: argv.PROJECTS, // type cast due to bug https://github.com/yargs/yargs/issues/2292
176
176
  outputDirectory: argv.outdir,
177
177
  parallel: argv.parallel,
178
178
  recurse: argv.recurse,
@@ -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,12 +1,14 @@
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");
7
8
  const process_1 = require("process");
8
9
  const logging = require("./logging");
9
10
  const npm_modules_1 = require("./npm-modules");
11
+ const rosetta_assembly_1 = require("./rosetta-assembly");
10
12
  const targets_1 = require("./targets");
11
13
  Object.defineProperty(exports, "TargetName", { enumerable: true, get: function () { return targets_1.TargetName; } });
12
14
  const timer_1 = require("./timer");
@@ -54,6 +56,7 @@ async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint =
54
56
  const system = new jsii_reflect_1.TypeSystem();
55
57
  return Promise.all(modulesToPackageFlat.map(async (m) => {
56
58
  await m.load(system, validateAssemblies);
59
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(m.assembly.spec);
57
60
  return rosetta.addAssembly(m.assembly.spec, m.moduleDirectory);
58
61
  }));
59
62
  });
@@ -95,7 +98,6 @@ async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint =
95
98
  }
96
99
  logging.info(`Packaged. ${timers.display()}`);
97
100
  }
98
- exports.pacmak = pacmak;
99
101
  //#endregion
100
102
  //#region Building
101
103
  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();
@@ -0,0 +1,16 @@
1
+ import * as spec from '@jsii/spec';
2
+ import { RosettaTabletReader } from 'jsii-rosetta';
3
+ /**
4
+ * Assert that the given spec is safe to give to Rosetta
5
+ *
6
+ * We have to do it like this, because Rosetta has its own internal copy of the
7
+ * spec and new schema additions may make it technically illegal to assign our
8
+ * Assembly instance to Rosetta's Assembly type.
9
+ *
10
+ * We do runtime validation here to make sure that assignment is safe,
11
+ * and then assert it in the type system.
12
+ *
13
+ * The check should be cheap, this gets called quite a lot.
14
+ */
15
+ export declare function assertSpecIsRosettaCompatible(x: spec.Assembly): asserts x is Parameters<RosettaTabletReader['addAssembly']>[0];
16
+ //# sourceMappingURL=rosetta-assembly.d.ts.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSpecIsRosettaCompatible = assertSpecIsRosettaCompatible;
4
+ /**
5
+ * Assert that the given spec is safe to give to Rosetta
6
+ *
7
+ * We have to do it like this, because Rosetta has its own internal copy of the
8
+ * spec and new schema additions may make it technically illegal to assign our
9
+ * Assembly instance to Rosetta's Assembly type.
10
+ *
11
+ * We do runtime validation here to make sure that assignment is safe,
12
+ * and then assert it in the type system.
13
+ *
14
+ * The check should be cheap, this gets called quite a lot.
15
+ */
16
+ function assertSpecIsRosettaCompatible(x) {
17
+ const rosettaSupportedFeatures = [];
18
+ const unsupported = (x.usedFeatures ?? []).filter((f) => !rosettaSupportedFeatures.includes(f));
19
+ if (unsupported.length > 0) {
20
+ throw new Error(`This assembly uses features Rosetta doesn't support yet: ${unsupported.join(', ')}`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=rosetta-assembly.js.map
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
@@ -6,6 +6,7 @@ const jsii_rosetta_1 = require("jsii-rosetta");
6
6
  const xmlbuilder = require("xmlbuilder");
7
7
  const _utils_1 = require("../_utils");
8
8
  const nameutils_1 = require("./nameutils");
9
+ const rosetta_assembly_1 = require("../../rosetta-assembly");
9
10
  /**
10
11
  * Generates the Jsii attributes and calls for the .NET runtime
11
12
  *
@@ -122,10 +123,12 @@ class DotNetDocGenerator {
122
123
  }
123
124
  }
124
125
  convertExample(example, apiLocation) {
126
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
125
127
  const translated = this.rosetta.translateExample(apiLocation, example, jsii_rosetta_1.TargetLanguage.CSHARP, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
126
128
  return translated.source;
127
129
  }
128
130
  convertSamplesInMarkdown(markdown, api) {
131
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
129
132
  return this.rosetta.translateSnippetsInMarkdown(api, markdown, jsii_rosetta_1.TargetLanguage.CSHARP, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
130
133
  }
131
134
  emitXmlDoc(tag, content, { attributes = {} } = {}) {
@@ -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>;
@@ -102,7 +102,7 @@ class DotNetTypeResolver {
102
102
  else if (spec.isNamedTypeReference(typeref)) {
103
103
  return this.toNativeFqn(typeref.fqn);
104
104
  }
105
- else if (typeref.union) {
105
+ else if (spec.isUnionTypeReference(typeref)) {
106
106
  return 'object';
107
107
  }
108
108
  throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`);
@@ -120,7 +120,7 @@ class DotNetTypeResolver {
120
120
  else if (spec.isNamedTypeReference(typeref)) {
121
121
  return `typeof(${this.toNativeFqn(typeref.fqn)}).FullName`;
122
122
  }
123
- else if (typeref.union) {
123
+ else if (spec.isUnionTypeReference(typeref)) {
124
124
  return '"object"';
125
125
  }
126
126
  throw new Error(`Invalid type reference: ${JSON.stringify(typeref)}`);
@@ -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
@@ -6,7 +6,7 @@ import { GoType } from './go-type';
6
6
  * TypeMap used to recursively resolve interfaces in nested types for use in
7
7
  * resolving scoped type names and implementation maps.
8
8
  */
9
- declare type TypeMap = {
9
+ type TypeMap = {
10
10
  readonly type: 'primitive';
11
11
  readonly value: string;
12
12
  } | {
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tarballName = exports.substituteReservedWords = exports.getParamDependencies = exports.getMemberDependencies = exports.flatMap = exports.goPackageNameForAssembly = exports.findTypeInTree = void 0;
3
+ exports.findTypeInTree = findTypeInTree;
4
+ exports.goPackageNameForAssembly = goPackageNameForAssembly;
5
+ exports.flatMap = flatMap;
6
+ exports.getMemberDependencies = getMemberDependencies;
7
+ exports.getParamDependencies = getParamDependencies;
8
+ exports.substituteReservedWords = substituteReservedWords;
9
+ exports.tarballName = tarballName;
4
10
  /*
5
11
  * Recursively search module for type with fqn
6
12
  */
@@ -13,7 +19,6 @@ function findTypeInTree(module, fqn) {
13
19
  return accum ?? findTypeInTree(sm, fqn);
14
20
  }, undefined);
15
21
  }
16
- exports.findTypeInTree = findTypeInTree;
17
22
  /*
18
23
  * Format NPM package names as idiomatic Go module name
19
24
  */
@@ -24,24 +29,20 @@ function goPackageNameForAssembly(assembly) {
24
29
  }
25
30
  return assembly.name.replace(/[^a-z0-9.]/gi, '').toLowerCase();
26
31
  }
27
- exports.goPackageNameForAssembly = goPackageNameForAssembly;
28
32
  function flatMap(collection, mapper) {
29
33
  return collection
30
34
  .map(mapper)
31
35
  .reduce((acc, elt) => acc.concat(elt), new Array());
32
36
  }
33
- exports.flatMap = flatMap;
34
37
  /*
35
38
  * Return module dependencies of a class or interface members
36
39
  */
37
40
  function getMemberDependencies(members) {
38
41
  return members.flatMap((member) => member.reference?.dependencies ?? []);
39
42
  }
40
- exports.getMemberDependencies = getMemberDependencies;
41
43
  function getParamDependencies(methods) {
42
44
  return methods.flatMap(({ parameters }) => parameters.flatMap((param) => param.reference?.dependencies ?? []));
43
45
  }
44
- exports.getParamDependencies = getParamDependencies;
45
46
  const RESERVED_WORDS = {
46
47
  break: 'break_',
47
48
  default: 'default_',
@@ -76,7 +77,6 @@ const RESERVED_WORDS = {
76
77
  function substituteReservedWords(name) {
77
78
  return RESERVED_WORDS[name] || name;
78
79
  }
79
- exports.substituteReservedWords = substituteReservedWords;
80
80
  /**
81
81
  * Computes a safe tarball name for the provided assembly.
82
82
  *
@@ -88,5 +88,4 @@ function tarballName(assm) {
88
88
  const name = assm.name.replace(/^@/, '').replace(/\//g, '-');
89
89
  return `${name}-${assm.version}.tgz`;
90
90
  }
91
- exports.tarballName = tarballName;
92
91
  //# sourceMappingURL=util.js.map
@@ -8,7 +8,7 @@ export declare enum TargetName {
8
8
  JAVASCRIPT = "js",
9
9
  PYTHON = "python"
10
10
  }
11
- export declare type BuilderFactory = (modules: Toposorted<JsiiModule>, options: BuildOptions) => TargetBuilder;
11
+ export type BuilderFactory = (modules: Toposorted<JsiiModule>, options: BuildOptions) => TargetBuilder;
12
12
  export declare const ALL_BUILDERS: {
13
13
  [key in TargetName]: BuilderFactory;
14
14
  };
@@ -15,7 +15,7 @@ var TargetName;
15
15
  TargetName["JAVA"] = "java";
16
16
  TargetName["JAVASCRIPT"] = "js";
17
17
  TargetName["PYTHON"] = "python";
18
- })(TargetName = exports.TargetName || (exports.TargetName = {}));
18
+ })(TargetName || (exports.TargetName = TargetName = {}));
19
19
  exports.ALL_BUILDERS = {
20
20
  dotnet: (ms, o) => new dotnet_1.DotnetBuilder((0, util_1.flatten)(ms), o),
21
21
  go: (ms, o) => new builder_1.IndependentPackageBuilder(TargetName.GO, go_1.Golang, ms, o),
@@ -18,6 +18,7 @@ const util_1 = require("../util");
18
18
  const version_1 = require("../version");
19
19
  const _utils_1 = require("./_utils");
20
20
  const version_utils_1 = require("./version-utils");
21
+ const rosetta_assembly_1 = require("../rosetta-assembly");
21
22
  const index_1 = require("./index");
22
23
  // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-require-imports
23
24
  const spdxLicenseList = require('spdx-license-list');
@@ -248,10 +249,6 @@ function moduleArtifactsSubdir(module) {
248
249
  return `${groupId.replace(/\./g, '/')}/${artifactId}`;
249
250
  }
250
251
  class Java extends target_1.Target {
251
- constructor(options) {
252
- super(options);
253
- this.generator = new JavaGenerator(options);
254
- }
255
252
  static toPackageInfos(assm) {
256
253
  const groupId = assm.targets.java.maven.groupId;
257
254
  const artifactId = assm.targets.java.maven.artifactId;
@@ -295,6 +292,10 @@ class Java extends target_1.Target {
295
292
  const [, ...name] = type.fqn.split('.');
296
293
  return { java: `import ${[options.package, ...name].join('.')};` };
297
294
  }
295
+ constructor(options) {
296
+ super(options);
297
+ this.generator = new JavaGenerator(options);
298
+ }
298
299
  async build(sourceDir, outDir) {
299
300
  const url = `file://${outDir}`;
300
301
  const mvnArguments = new Array();
@@ -332,17 +333,6 @@ const MODULE_CLASS_NAME = '$Module';
332
333
  const INTERFACE_PROXY_CLASS_NAME = 'Jsii$Proxy';
333
334
  const INTERFACE_DEFAULT_CLASS_NAME = 'Jsii$Default';
334
335
  class JavaGenerator extends generator_1.Generator {
335
- constructor(options) {
336
- super({ ...options, generateOverloadsForMethodWithOptionals: true });
337
- /**
338
- * A map of all the modules ever referenced during code generation. These include
339
- * direct dependencies but can potentially also include transitive dependencies, when,
340
- * for example, we need to refer to their types when flatting the class hierarchy for
341
- * interface proxies.
342
- */
343
- this.referencedModules = {};
344
- this.rosetta = options.rosetta;
345
- }
346
336
  /**
347
337
  * Turns a raw javascript property name (eg: 'default') into a safe Java property name (eg: 'defaultValue').
348
338
  * @param propertyName the raw JSII property Name
@@ -377,6 +367,17 @@ class JavaGenerator extends generator_1.Generator {
377
367
  }
378
368
  return methodName;
379
369
  }
370
+ constructor(options) {
371
+ super({ ...options, generateOverloadsForMethodWithOptionals: true });
372
+ /**
373
+ * A map of all the modules ever referenced during code generation. These include
374
+ * direct dependencies but can potentially also include transitive dependencies, when,
375
+ * for example, we need to refer to their types when flatting the class hierarchy for
376
+ * interface proxies.
377
+ */
378
+ this.referencedModules = {};
379
+ this.rosetta = options.rosetta;
380
+ }
380
381
  onBeginAssembly(assm, fingerprint) {
381
382
  this.emitFullGeneratorInfo = fingerprint;
382
383
  this.moduleClass = this.emitModuleFile(assm);
@@ -1521,7 +1522,7 @@ class JavaGenerator extends generator_1.Generator {
1521
1522
  parameters: [
1522
1523
  {
1523
1524
  name: fieldName,
1524
- type: spec.CANONICAL_ANY,
1525
+ type: spec.CANONICAL_ANY, // We don't quite care in this context!
1525
1526
  docs: prop.spec.docs,
1526
1527
  },
1527
1528
  ],
@@ -1531,7 +1532,7 @@ class JavaGenerator extends generator_1.Generator {
1531
1532
  })) {
1532
1533
  this.addJavaDocs(setter, {
1533
1534
  api: 'member',
1534
- fqn: prop.definingType.fqn,
1535
+ fqn: prop.definingType.fqn, // Could be inherited
1535
1536
  memberName: prop.name,
1536
1537
  });
1537
1538
  this.emitStabilityAnnotations(prop.spec);
@@ -1995,7 +1996,7 @@ class JavaGenerator extends generator_1.Generator {
1995
1996
  else if (spec.isNamedTypeReference(typeref)) {
1996
1997
  return [this.toNativeFqn(typeref.fqn)];
1997
1998
  }
1998
- else if (typeref.union) {
1999
+ else if (spec.isUnionTypeReference(typeref)) {
1999
2000
  const types = new Array();
2000
2001
  for (const subtype of typeref.union.types) {
2001
2002
  for (const t of this.toJavaTypes(subtype, {
@@ -2321,10 +2322,12 @@ class JavaGenerator extends generator_1.Generator {
2321
2322
  this.code.line(`@javax.annotation.Generated(value = "${generator}"${date})`);
2322
2323
  }
2323
2324
  convertExample(example, api) {
2325
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
2324
2326
  const translated = this.rosetta.translateExample(api, example, jsii_rosetta_1.TargetLanguage.JAVA, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
2325
2327
  return translated.source;
2326
2328
  }
2327
2329
  convertSamplesInMarkdown(markdown, api) {
2330
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
2328
2331
  return this.rosetta.translateSnippetsInMarkdown(api, markdown, jsii_rosetta_1.TargetLanguage.JAVA, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
2329
2332
  }
2330
2333
  /**
@@ -7,7 +7,7 @@ export default class JavaScript extends Target {
7
7
  };
8
8
  static toNativeReference(type: spec.Type): {
9
9
  typescript: string;
10
- javascript?: string | undefined;
10
+ javascript?: string;
11
11
  };
12
12
  protected readonly generator: PackOnly;
13
13
  build(sourceDir: string, outDir: string): Promise<void>;
@@ -4,7 +4,7 @@
4
4
  # package (wheel, sdist), but not declared as build-system dependencies.
5
5
 
6
6
  setuptools~=75.3.2 # build-system
7
- wheel~=0.42 # build-system
7
+ build~=1.3.0 # build-system
8
8
 
9
9
  twine~=6.1.0
10
10
 
@@ -12,7 +12,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  };
13
13
  var _Dict_element, _List_element, _Optional_wrapped, _Primitive_pythonType, _Union_options, _UserType_fqn;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.toPythonFqn = exports.mergePythonImports = exports.toPackageName = exports.toTypeName = void 0;
15
+ exports.toTypeName = toTypeName;
16
+ exports.toPackageName = toPackageName;
17
+ exports.mergePythonImports = mergePythonImports;
18
+ exports.toPythonFqn = toPythonFqn;
16
19
  const spec_1 = require("@jsii/spec");
17
20
  const codemaker_1 = require("codemaker");
18
21
  const crypto_1 = require("crypto");
@@ -44,7 +47,6 @@ function toTypeName(ref) {
44
47
  }
45
48
  return optional ? new Optional(result) : result;
46
49
  }
47
- exports.toTypeName = toTypeName;
48
50
  /**
49
51
  * Obtains the Python package name for a given submodule FQN.
50
52
  *
@@ -54,7 +56,6 @@ exports.toTypeName = toTypeName;
54
56
  function toPackageName(fqn, rootAssm) {
55
57
  return getPackageName(fqn, rootAssm).packageName;
56
58
  }
57
- exports.toPackageName = toPackageName;
58
59
  function mergePythonImports(...pythonImports) {
59
60
  const result = {};
60
61
  for (const bag of pythonImports) {
@@ -69,7 +70,6 @@ function mergePythonImports(...pythonImports) {
69
70
  }
70
71
  return result;
71
72
  }
72
- exports.mergePythonImports = mergePythonImports;
73
73
  function isOptionalValue(type) {
74
74
  return type.type != null;
75
75
  }
@@ -125,11 +125,6 @@ class Optional {
125
125
  }
126
126
  _Optional_wrapped = new WeakMap();
127
127
  class Primitive {
128
- constructor(pythonType) {
129
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
130
- _Primitive_pythonType.set(this, void 0);
131
- __classPrivateFieldSet(this, _Primitive_pythonType, pythonType, "f");
132
- }
133
128
  static of(type) {
134
129
  switch (type.primitive) {
135
130
  case spec_1.PrimitiveType.Boolean:
@@ -147,6 +142,11 @@ class Primitive {
147
142
  return Primitive.ANY;
148
143
  }
149
144
  }
145
+ constructor(pythonType) {
146
+ // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
147
+ _Primitive_pythonType.set(this, void 0);
148
+ __classPrivateFieldSet(this, _Primitive_pythonType, pythonType, "f");
149
+ }
150
150
  pythonType() {
151
151
  return __classPrivateFieldGet(this, _Primitive_pythonType, "f");
152
152
  }
@@ -277,7 +277,6 @@ function toPythonFqn(fqn, rootAssm) {
277
277
  }
278
278
  return { assemblyName, packageName, pythonFqn: fqnParts.join('.') };
279
279
  }
280
- exports.toPythonFqn = toPythonFqn;
281
280
  /**
282
281
  * Computes the python relative import path from `fromModule` to `toModule`.
283
282
  *
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toPythonIdentifier = exports.die = void 0;
3
+ exports.die = die;
4
+ exports.toPythonIdentifier = toPythonIdentifier;
4
5
  const PYTHON_KEYWORDS = new Set([
5
6
  'False',
6
7
  'None',
@@ -41,12 +42,10 @@ const PYTHON_KEYWORDS = new Set([
41
42
  function die(message) {
42
43
  throw new Error(message);
43
44
  }
44
- exports.die = die;
45
45
  function toPythonIdentifier(name) {
46
46
  if (PYTHON_KEYWORDS.has(name)) {
47
47
  return `${name}_`;
48
48
  }
49
49
  return name;
50
50
  }
51
- exports.toPythonIdentifier = toPythonIdentifier;
52
51
  //# sourceMappingURL=util.js.map
@@ -36,8 +36,8 @@ interface PythonType extends PythonBase {
36
36
  readonly fqn?: string;
37
37
  addMember(member: PythonBase): void;
38
38
  }
39
- declare type FindModuleCallback = (fqn: string) => spec.AssemblyConfiguration;
40
- declare type FindTypeCallback = (fqn: string) => spec.Type;
39
+ type FindModuleCallback = (fqn: string) => spec.AssemblyConfiguration;
40
+ type FindTypeCallback = (fqn: string) => spec.Type;
41
41
  declare class TypeResolver {
42
42
  private readonly types;
43
43
  private readonly boundTo?;
@@ -30,6 +30,7 @@ const _utils_1 = require("./_utils");
30
30
  const type_name_1 = require("./python/type-name");
31
31
  const util_2 = require("./python/util");
32
32
  const version_utils_1 = require("./version-utils");
33
+ const rosetta_assembly_1 = require("../rosetta-assembly");
33
34
  const index_1 = require("./index");
34
35
  // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-require-imports
35
36
  const spdxLicenseList = require('spdx-license-list');
@@ -57,7 +58,7 @@ class Python extends target_1.Target {
57
58
  await (0, util_1.shell)(process.platform === 'win32' ? 'python' : 'python3', [
58
59
  '-m',
59
60
  'venv',
60
- '--system-site-packages',
61
+ '--system-site-packages', // Allow using globally installed packages (saves time & disk space)
61
62
  venv,
62
63
  ]);
63
64
  const env = {
@@ -73,11 +74,7 @@ class Python extends target_1.Target {
73
74
  retry: { maxAttempts: 5 },
74
75
  });
75
76
  // Actually package up our code, both as a sdist and a wheel for publishing.
76
- await (0, util_1.shell)(python, ['setup.py', 'sdist', '--dist-dir', outDir], {
77
- cwd: sourceDir,
78
- env,
79
- });
80
- await (0, util_1.shell)(python, ['-m', 'pip', 'wheel', '--no-deps', '--wheel-dir', outDir, sourceDir], {
77
+ await (0, util_1.shell)(python, ['-m', 'build', '--outdir', outDir, sourceDir], {
81
78
  cwd: sourceDir,
82
79
  env,
83
80
  retry: { maxAttempts: 5 },
@@ -116,12 +113,12 @@ class TypeCheckingStub {
116
113
  __classPrivateFieldSet(this, _TypeCheckingStub_arguments, args.map((arg) => arg.replace(/"/g, '')), "f");
117
114
  __classPrivateFieldSet(this, _TypeCheckingStub_hash, crypto
118
115
  .createHash('sha256')
119
- .update(__classPrivateFieldGet(TypeCheckingStub, _a, "f", _TypeCheckingStub_PREFIX))
116
+ .update(__classPrivateFieldGet(_a, _a, "f", _TypeCheckingStub_PREFIX))
120
117
  .update(fqn)
121
118
  .digest('hex'), "f");
122
119
  }
123
120
  get name() {
124
- return `${__classPrivateFieldGet(TypeCheckingStub, _a, "f", _TypeCheckingStub_PREFIX)}${__classPrivateFieldGet(this, _TypeCheckingStub_hash, "f")}`;
121
+ return `${__classPrivateFieldGet(_a, _a, "f", _TypeCheckingStub_PREFIX)}${__classPrivateFieldGet(this, _TypeCheckingStub_hash, "f")}`;
125
122
  }
126
123
  emit(code) {
127
124
  code.line();
@@ -1805,10 +1802,12 @@ class PythonGenerator extends generator_1.Generator {
1805
1802
  }
1806
1803
  }
1807
1804
  convertExample(example, apiLoc) {
1805
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
1808
1806
  const translated = this.rosetta.translateExample(apiLoc, example, jsii_rosetta_1.TargetLanguage.PYTHON, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
1809
1807
  return translated.source;
1810
1808
  }
1811
1809
  convertMarkdown(markdown, apiLoc) {
1810
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
1812
1811
  return this.rosetta.translateSnippetsInMarkdown(apiLoc, markdown, jsii_rosetta_1.TargetLanguage.PYTHON, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
1813
1812
  }
1814
1813
  getPythonType(fqn) {
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toReleaseVersion = exports.toPythonVersionRange = exports.toNuGetVersionRange = exports.toMavenVersionRange = void 0;
3
+ exports.toMavenVersionRange = toMavenVersionRange;
4
+ exports.toNuGetVersionRange = toNuGetVersionRange;
5
+ exports.toPythonVersionRange = toPythonVersionRange;
6
+ exports.toReleaseVersion = toReleaseVersion;
4
7
  const semver_1 = require("semver");
5
8
  const util_1 = require("util");
6
9
  const _1 = require(".");
@@ -18,7 +21,6 @@ function toMavenVersionRange(semverRange, suffix) {
18
21
  target: _1.TargetName.JAVA,
19
22
  });
20
23
  }
21
- exports.toMavenVersionRange = toMavenVersionRange;
22
24
  /**
23
25
  * Converts a SemVer range expression to a NuGet version range expression.
24
26
  *
@@ -32,7 +34,6 @@ function toNuGetVersionRange(semverRange) {
32
34
  target: _1.TargetName.DOTNET,
33
35
  });
34
36
  }
35
- exports.toNuGetVersionRange = toNuGetVersionRange;
36
37
  /**
37
38
  * Converts a SemVer range expression to a Python setuptools compatible version
38
39
  * constraint expression.
@@ -60,7 +61,6 @@ function toPythonVersionRange(semverRange) {
60
61
  .join(', '))
61
62
  .join(', ');
62
63
  }
63
- exports.toPythonVersionRange = toPythonVersionRange;
64
64
  /**
65
65
  * Converts an original version number from the NPM convention to the target
66
66
  * language's convention for expressing the same. For versions that do not
@@ -139,7 +139,6 @@ function toReleaseVersion(assemblyVersion, target) {
139
139
  }
140
140
  return assemblyVersion;
141
141
  }
142
- exports.toReleaseVersion = toReleaseVersion;
143
142
  /**
144
143
  * Converts a semantic version range to the kind of bracket notation used by
145
144
  * Maven and NuGet. For example, this turns `^1.2.3` into `[1.2.3,2.0.0)`.
package/lib/toposort.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export declare type KeyFunc<T> = (x: T) => string;
2
- export declare type DepFunc<T> = (x: T) => string[];
1
+ export type KeyFunc<T> = (x: T) => string;
2
+ export type DepFunc<T> = (x: T) => string[];
3
3
  /**
4
4
  * Return a topological sort of all elements of xs, according to the given dependency functions
5
5
  *
@@ -34,5 +34,5 @@ export declare function topologicalSort<T>(xs: Iterable<T>, keyFn: KeyFunc<T>, d
34
34
  * We do declare the type `Toposorted<A>` here so that if we ever change
35
35
  * the type, we can find all usage sites quickly.
36
36
  */
37
- export declare type Toposorted<A> = readonly A[][];
37
+ export type Toposorted<A> = readonly A[][];
38
38
  //# sourceMappingURL=toposort.d.ts.map
package/lib/toposort.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.topologicalSort = void 0;
3
+ exports.topologicalSort = topologicalSort;
4
4
  /**
5
5
  * Return a topological sort of all elements of xs, according to the given dependency functions
6
6
  *
@@ -37,5 +37,4 @@ function topologicalSort(xs, keyFn, depFn) {
37
37
  }
38
38
  return ret;
39
39
  }
40
- exports.topologicalSort = topologicalSort;
41
40
  //# sourceMappingURL=toposort.js.map
package/lib/util.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { SpawnOptions } from 'child_process';
3
2
  /**
4
3
  * Find the directory that contains a given dependency, identified by its 'package.json', from a starting search directory
package/lib/util.js CHANGED
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flatten = exports.wait = exports.filterAsync = exports.setExtend = exports.Scratch = exports.slugify = exports.shell = exports.retry = exports.AllAttemptsFailed = exports.findUp = exports.findPackageJsonUp = exports.isBuiltinModule = exports.findDependencyDirectory = void 0;
3
+ exports.Scratch = exports.AllAttemptsFailed = void 0;
4
+ exports.findDependencyDirectory = findDependencyDirectory;
5
+ exports.isBuiltinModule = isBuiltinModule;
6
+ exports.findPackageJsonUp = findPackageJsonUp;
7
+ exports.findUp = findUp;
8
+ exports.retry = retry;
9
+ exports.shell = shell;
10
+ exports.slugify = slugify;
11
+ exports.setExtend = setExtend;
12
+ exports.filterAsync = filterAsync;
13
+ exports.wait = wait;
14
+ exports.flatten = flatten;
4
15
  const child_process_1 = require("child_process");
5
16
  const fs = require("fs-extra");
6
17
  const os = require("os");
@@ -26,7 +37,6 @@ async function findDependencyDirectory(dependencyName, searchStart) {
26
37
  }
27
38
  return depPkgJsonPath;
28
39
  }
29
- exports.findDependencyDirectory = findDependencyDirectory;
30
40
  /**
31
41
  * Whether the given dependency is a built-in
32
42
  *
@@ -38,7 +48,6 @@ function isBuiltinModule(depName) {
38
48
  const { builtinModules } = require('module');
39
49
  return (builtinModules ?? []).includes(depName);
40
50
  }
41
- exports.isBuiltinModule = isBuiltinModule;
42
51
  /**
43
52
  * Find the package.json for a given package upwards from the given directory
44
53
  *
@@ -52,7 +61,6 @@ async function findPackageJsonUp(packageName, directory) {
52
61
  (await fs.readJson(pjFile)).name === packageName);
53
62
  });
54
63
  }
55
- exports.findPackageJsonUp = findPackageJsonUp;
56
64
  /**
57
65
  * Find a directory up the tree from a starting directory matching a condition
58
66
  *
@@ -75,7 +83,6 @@ async function findUp(directory, pred) {
75
83
  directory = parent;
76
84
  }
77
85
  }
78
- exports.findUp = findUp;
79
86
  class AllAttemptsFailed extends Error {
80
87
  constructor(callback, errors) {
81
88
  super(`All attempts failed. Last error: ${errors[errors.length - 1].message}`);
@@ -126,7 +133,6 @@ async function retry(cb, opts = {}, waiter = wait) {
126
133
  }
127
134
  return Promise.reject(new AllAttemptsFailed(cb, errors));
128
135
  }
129
- exports.retry = retry;
130
136
  /**
131
137
  * Spawns a child process with the provided command and arguments. The child
132
138
  * process is always spawned using `shell: true`, and the contents of
@@ -202,23 +208,16 @@ async function shell(cmd, args, { retry: retryOptions, ...options } = {}) {
202
208
  }
203
209
  return spawn1();
204
210
  }
205
- exports.shell = shell;
206
211
  /**
207
212
  * Strip filesystem unsafe characters from a string
208
213
  */
209
214
  function slugify(x) {
210
215
  return x.replace(/[^a-zA-Z0-9_-]/g, '_');
211
216
  }
212
- exports.slugify = slugify;
213
217
  /**
214
218
  * Class that makes a temporary directory and holds on to an operation object
215
219
  */
216
220
  class Scratch {
217
- constructor(directory, object, fake) {
218
- this.directory = directory;
219
- this.object = object;
220
- this.fake = fake;
221
- }
222
221
  static async make(factory) {
223
222
  const tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), 'npm-pack'));
224
223
  return new Scratch(tmpdir, await factory(tmpdir), false);
@@ -229,6 +228,11 @@ class Scratch {
229
228
  static async cleanupAll(tempDirs) {
230
229
  await Promise.all(tempDirs.map((t) => t.cleanup()));
231
230
  }
231
+ constructor(directory, object, fake) {
232
+ this.directory = directory;
233
+ this.object = object;
234
+ this.fake = fake;
235
+ }
232
236
  async cleanup() {
233
237
  if (!this.fake) {
234
238
  try {
@@ -260,18 +264,14 @@ function setExtend(xs, els) {
260
264
  xs.add(el);
261
265
  }
262
266
  }
263
- exports.setExtend = setExtend;
264
267
  async function filterAsync(xs, pred) {
265
268
  const mapped = await Promise.all(xs.map(async (x) => ({ x, pred: await pred(x) })));
266
269
  return mapped.filter(({ pred }) => pred).map(({ x }) => x);
267
270
  }
268
- exports.filterAsync = filterAsync;
269
271
  async function wait(ms) {
270
272
  return new Promise((ok) => setTimeout(ok, ms));
271
273
  }
272
- exports.wait = wait;
273
274
  function flatten(xs) {
274
275
  return Array.prototype.concat.call([], ...xs);
275
276
  }
276
- exports.flatten = flatten;
277
277
  //# sourceMappingURL=util.js.map
package/lib/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
2
2
  export declare const VERSION: string;
3
3
  /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION_DESC = "1.112.0 (build de1bc80)";
4
+ export declare const VERSION_DESC = "1.114.1 (build 8a29f60)";
5
5
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- // Generated at 2025-05-07T14:36:30Z by generate.sh
2
+ // Generated at 2025-09-04T13:07:54Z by generate.sh
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.VERSION_DESC = exports.VERSION = void 0;
5
5
  /** The short version number for this jsii-pacmak release (e.g: `X.Y.Z`) */
6
6
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
7
- exports.VERSION = '1.112.0';
7
+ exports.VERSION = '1.114.1';
8
8
  /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION_DESC = '1.112.0 (build de1bc80)';
9
+ exports.VERSION_DESC = '1.114.1 (build 8a29f60)';
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-pacmak",
3
- "version": "1.112.0",
3
+ "version": "1.114.1",
4
4
  "description": "A code generation framework for jsii backend languages",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -26,49 +26,50 @@
26
26
  },
27
27
  "scripts": {
28
28
  "gen": "bash generate.sh",
29
- "build": "npm run gen && tsc --build && chmod +x bin/jsii-pacmak && npm run lint",
29
+ "build": "yarn gen && tsc --build && chmod +x bin/jsii-pacmak && yarn lint",
30
30
  "watch": "tsc --build -w",
31
31
  "lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --ext .js,.ts --ignore-path=.gitignore",
32
32
  "lint:fix": "yarn lint --fix",
33
- "test": "npm run test:unit && npm run test:build",
33
+ "test": "yarn test:unit && yarn test:build",
34
34
  "test:unit": "jest",
35
35
  "test:build": "bash test/build-test.sh",
36
- "test:update": "jest -u && npm run test:build",
36
+ "test:update": "jest -u && yarn test:build",
37
37
  "package": "package-js"
38
38
  },
39
39
  "dependencies": {
40
- "@jsii/check-node": "1.112.0",
41
- "@jsii/spec": "^1.112.0",
40
+ "@jsii/check-node": "1.114.1",
41
+ "@jsii/spec": "1.114.1",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.112.0",
43
+ "codemaker": "^1.114.1",
44
44
  "commonmark": "^0.31.2",
45
45
  "escape-string-regexp": "^4.0.0",
46
46
  "fs-extra": "^10.1.0",
47
- "jsii-reflect": "^1.112.0",
48
- "semver": "^7.7.1",
47
+ "jsii-reflect": "^1.114.1",
48
+ "semver": "^7.7.2",
49
49
  "spdx-license-list": "^6.10.0",
50
50
  "xmlbuilder": "^15.1.1",
51
- "yargs": "^16.2.0"
51
+ "yargs": "^17.7.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@jsii/dotnet-runtime": "^1.112.0",
55
- "@jsii/go-runtime": "^1.112.0",
56
- "@jsii/java-runtime": "^1.112.0",
57
- "@scope/jsii-calc-lib": "^1.112.0",
54
+ "@jsii/dotnet-runtime": "^1.114.1",
55
+ "@jsii/go-runtime": "^1.114.1",
56
+ "@jsii/java-runtime": "^1.114.1",
57
+ "@scope/jsii-calc-lib": "^1.114.1",
58
58
  "@types/clone": "^2.1.4",
59
- "@types/commonmark": "^0.27.9",
59
+ "@types/commonmark": "^0.27.10",
60
60
  "@types/diff": "^5.2.3",
61
61
  "@types/fs-extra": "^9.0.13",
62
62
  "@types/semver": "^7.7.0",
63
+ "@types/yargs": "^17.0.33",
63
64
  "diff": "^5.2.0",
64
- "jsii": "^5.8.0",
65
- "jsii-build-tools": "^1.112.0",
65
+ "jsii": "^5.9.1",
66
+ "jsii-build-tools": "^1.114.1",
66
67
  "jsii-calc": "^3.20.120",
67
- "jsii-rosetta": "~5.8.0",
68
- "pyright": "^1.1.400"
68
+ "jsii-rosetta": "~5.9.1",
69
+ "pyright": "^1.1.403"
69
70
  },
70
71
  "peerDependencies": {
71
- "jsii-rosetta": ">=5.5.0"
72
+ "jsii-rosetta": ">=5.7.0"
72
73
  },
73
74
  "keywords": [
74
75
  "jsii",