jsii-pacmak 1.67.0 → 1.69.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.
@@ -98,6 +98,24 @@ class Validation {
98
98
  code.openBlock(`switch (${expression})`);
99
99
  for (const type of types) {
100
100
  validTypes.push(resolver.toDotNetTypeName(type.spec));
101
+ /**
102
+ * Filter to remove classes and interfaces from a set of type references that
103
+ * are implied by another entry in the set. Practically this is meant to remove
104
+ * types from a set if a parent type of it is also present in the set, keeping
105
+ * only the most generic declaration.
106
+ *
107
+ * This is useful because the TypeScript compiler and jsii do not guarantee that
108
+ * all entries in a type union are unrelated, but the C# compiler treats dead
109
+ * code as an error, and will refuse to compile (error CS8120) a pattern-matching
110
+ * switch case if it cannot be matched (for example, if it matches on a child of
111
+ * a type that was previously matched on already).
112
+ */
113
+ if ((type.type?.isClassType() || type.type?.isInterfaceType()) &&
114
+ types.some((other) => other !== type &&
115
+ other.type != null &&
116
+ type.type.extends(other.type))) {
117
+ continue;
118
+ }
101
119
  const typeNames = [resolver.toDotNetType(type.spec)];
102
120
  if (typeNames[0] === 'double') {
103
121
  // For doubles, we accept any numeric value, really...
@@ -55,6 +55,7 @@ export declare class RootPackage extends Package {
55
55
  readonly assembly: Assembly;
56
56
  readonly version: string;
57
57
  private readonly versionFile;
58
+ private readonly typeCache;
58
59
  private readonly rootPackageCache;
59
60
  constructor(assembly: Assembly, rootPackageCache?: Map<string, RootPackage>);
60
61
  emit(context: EmitContext): void;
@@ -263,6 +263,7 @@ class RootPackage extends Package {
263
263
  const moduleName = goConfig.moduleName ?? '';
264
264
  const version = `${assembly.version}${goConfig.versionSuffix ?? ''}`;
265
265
  super(assembly, packageName, filePath, moduleName, version);
266
+ this.typeCache = new Map();
266
267
  this.rootPackageCache = rootPackageCache;
267
268
  this.rootPackageCache.set(assembly.name, this);
268
269
  this.assembly = assembly;
@@ -315,12 +316,15 @@ class RootPackage extends Package {
315
316
  * This allows resolving type references from other JSII modules
316
317
  */
317
318
  findType(fqn) {
318
- return this.packageDependencies.reduce((accum, current) => {
319
- if (accum) {
320
- return accum;
321
- }
322
- return current.findType(fqn);
323
- }, super.findType(fqn));
319
+ if (!this.typeCache.has(fqn)) {
320
+ this.typeCache.set(fqn, this.packageDependencies.reduce((accum, current) => {
321
+ if (accum) {
322
+ return accum;
323
+ }
324
+ return current.findType(fqn);
325
+ }, super.findType(fqn)));
326
+ }
327
+ return this.typeCache.get(fqn);
324
328
  }
325
329
  /*
326
330
  * Get all JSII module dependencies of the package being generated
@@ -1218,11 +1218,12 @@ class PythonModule {
1218
1218
  `${JSON.stringify(this.assemblyFilename)}`,
1219
1219
  ], ')');
1220
1220
  code.line();
1221
- emitList(code, '__jsii_assembly__.invokeBinScript(', [
1221
+ emitList(code, 'exit_code = __jsii_assembly__.invokeBinScript(', [
1222
1222
  JSON.stringify(this.assembly.name),
1223
1223
  JSON.stringify(name),
1224
1224
  'sys.argv[1:]',
1225
1225
  ], ')');
1226
+ code.line('exit(exit_code)');
1226
1227
  code.closeFile(script_file);
1227
1228
  scripts.push(script_file.replace(/\\/g, '/'));
1228
1229
  }
package/lib/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The short version number for this JSII compiler (e.g: `X.Y.Z`) */
2
2
  export declare const VERSION: string;
3
3
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
4
- export declare const VERSION_DESC = "1.67.0 (build 2c027f5)";
4
+ export declare const VERSION_DESC = "1.69.0 (build f656c31)";
5
5
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- // Generated at 2022-09-02T16:06:26Z by generate.sh
2
+ // Generated at 2022-09-27T10:46:56Z 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 compiler (e.g: `X.Y.Z`) */
6
6
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
7
- exports.VERSION = '1.67.0';
7
+ exports.VERSION = '1.69.0';
8
8
  /** The qualified version number for this JSII compiler (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION_DESC = '1.67.0 (build 2c027f5)';
9
+ exports.VERSION_DESC = '1.69.0 (build f656c31)';
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-pacmak",
3
- "version": "1.67.0",
3
+ "version": "1.69.0",
4
4
  "description": "A code generation framework for jsii backend languages",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,35 +37,35 @@
37
37
  "package": "package-js"
38
38
  },
39
39
  "dependencies": {
40
- "@jsii/check-node": "1.67.0",
41
- "@jsii/spec": "^1.67.0",
40
+ "@jsii/check-node": "1.69.0",
41
+ "@jsii/spec": "^1.69.0",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.67.0",
43
+ "codemaker": "^1.69.0",
44
44
  "commonmark": "^0.30.0",
45
45
  "escape-string-regexp": "^4.0.0",
46
46
  "fs-extra": "^10.1.0",
47
- "jsii-reflect": "^1.67.0",
48
- "jsii-rosetta": "^1.67.0",
47
+ "jsii-reflect": "^1.69.0",
48
+ "jsii-rosetta": "^1.69.0",
49
49
  "semver": "^7.3.7",
50
50
  "spdx-license-list": "^6.6.0",
51
51
  "xmlbuilder": "^15.1.1",
52
52
  "yargs": "^16.2.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@jsii/dotnet-runtime": "^1.67.0",
56
- "@jsii/java-runtime": "^1.67.0",
57
- "@jsii/go-runtime": "^1.67.0",
58
- "@scope/jsii-calc-lib": "^1.67.0",
55
+ "@jsii/dotnet-runtime": "^1.69.0",
56
+ "@jsii/java-runtime": "^1.69.0",
57
+ "@jsii/go-runtime": "^1.69.0",
58
+ "@scope/jsii-calc-lib": "^1.69.0",
59
59
  "@types/clone": "^2.1.1",
60
60
  "@types/diff": "^5.0.2",
61
61
  "@types/commonmark": "^0.27.5",
62
62
  "@types/fs-extra": "^9.0.13",
63
63
  "@types/semver": "^7.3.12",
64
64
  "diff": "^5.1.0",
65
- "jsii": "^1.67.0",
66
- "jsii-build-tools": "^1.67.0",
65
+ "jsii": "^1.69.0",
66
+ "jsii-build-tools": "^1.69.0",
67
67
  "jsii-calc": "^3.20.120",
68
- "pyright": "^1.1.268"
68
+ "pyright": "^1.1.272"
69
69
  },
70
70
  "keywords": [
71
71
  "jsii",