jsii-pacmak 1.113.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.
@@ -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,
package/lib/index.js CHANGED
@@ -8,6 +8,7 @@ const path_1 = require("path");
8
8
  const process_1 = require("process");
9
9
  const logging = require("./logging");
10
10
  const npm_modules_1 = require("./npm-modules");
11
+ const rosetta_assembly_1 = require("./rosetta-assembly");
11
12
  const targets_1 = require("./targets");
12
13
  Object.defineProperty(exports, "TargetName", { enumerable: true, get: function () { return targets_1.TargetName; } });
13
14
  const timer_1 = require("./timer");
@@ -55,6 +56,7 @@ async function pacmak({ argv = {}, clean = true, codeOnly = false, fingerprint =
55
56
  const system = new jsii_reflect_1.TypeSystem();
56
57
  return Promise.all(modulesToPackageFlat.map(async (m) => {
57
58
  await m.load(system, validateAssemblies);
59
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(m.assembly.spec);
58
60
  return rosetta.addAssembly(m.assembly.spec, m.moduleDirectory);
59
61
  }));
60
62
  });
@@ -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
@@ -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 = {} } = {}) {
@@ -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)}`);
@@ -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');
@@ -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
  /**
@@ -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
- build~=1.2.2.post1 # build-system
7
+ build~=1.3.0 # build-system
8
8
 
9
9
  twine~=6.1.0
10
10
 
@@ -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');
@@ -1801,10 +1802,12 @@ class PythonGenerator extends generator_1.Generator {
1801
1802
  }
1802
1803
  }
1803
1804
  convertExample(example, apiLoc) {
1805
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
1804
1806
  const translated = this.rosetta.translateExample(apiLoc, example, jsii_rosetta_1.TargetLanguage.PYTHON, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
1805
1807
  return translated.source;
1806
1808
  }
1807
1809
  convertMarkdown(markdown, apiLoc) {
1810
+ (0, rosetta_assembly_1.assertSpecIsRosettaCompatible)(this.assembly);
1808
1811
  return this.rosetta.translateSnippetsInMarkdown(apiLoc, markdown, jsii_rosetta_1.TargetLanguage.PYTHON, (0, jsii_rosetta_1.enforcesStrictMode)(this.assembly));
1809
1812
  }
1810
1813
  getPythonType(fqn) {
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.113.0 (build fc68b25)";
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-07-31T12:47:09Z 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.113.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.113.0 (build fc68b25)';
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.113.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": {
@@ -37,38 +37,39 @@
37
37
  "package": "package-js"
38
38
  },
39
39
  "dependencies": {
40
- "@jsii/check-node": "1.113.0",
41
- "@jsii/spec": "^1.113.0",
40
+ "@jsii/check-node": "1.114.1",
41
+ "@jsii/spec": "1.114.1",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.113.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.113.0",
47
+ "jsii-reflect": "^1.114.1",
48
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.113.0",
55
- "@jsii/go-runtime": "^1.113.0",
56
- "@jsii/java-runtime": "^1.113.0",
57
- "@scope/jsii-calc-lib": "^1.113.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
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.113.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
+ "jsii-rosetta": "~5.9.1",
68
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",