jsii-pacmak 1.110.0 → 1.112.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.
package/lib/packaging.js CHANGED
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsiiModule = exports.DEFAULT_PACK_COMMAND = void 0;
4
4
  const fs = require("fs-extra");
5
- const os = require("os");
6
5
  const path = require("path");
7
6
  const util_1 = require("./util");
8
7
  const logging = require("../lib/logging");
@@ -39,10 +38,13 @@ class JsiiModule {
39
38
  // Take only the last line of npm pack which should contain the
40
39
  // tarball name. otherwise, there can be a lot of extra noise there
41
40
  // from scripts that emit to STDOUT.
42
- const lines = out.trim().split(os.EOL);
41
+ // Since we are interested in the text *after* the last newline, splitting on '\n' is correct
42
+ // both on Linux/Mac (EOL = '\n') and Windows (EOL = '\r\n'), and also for UNIX tools running
43
+ // on Windows (expected EOL = '\r\n', actual EOL = '\n').
44
+ const lines = out.trim().split('\n');
43
45
  const lastLine = lines[lines.length - 1].trim();
44
46
  if (!lastLine.endsWith('.tgz') && !lastLine.endsWith('.tar.gz')) {
45
- throw new Error(`${packCommand} did not produce tarball from ${this.moduleDirectory} into ${tmpdir} (output was ${JSON.stringify(lines)})`);
47
+ throw new Error(`${packCommand} did not produce tarball from ${this.moduleDirectory} into ${tmpdir} (output was ${JSON.stringify(lines.map((l) => l.trimEnd()))})`);
46
48
  }
47
49
  return path.resolve(tmpdir, lastLine);
48
50
  });
@@ -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);
@@ -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() {
@@ -86,9 +86,7 @@ class GoTypeRef {
86
86
  return this.reference.void;
87
87
  }
88
88
  get typeMap() {
89
- if (!this._typeMap) {
90
- this._typeMap = this.buildTypeMap(this);
91
- }
89
+ this._typeMap ?? (this._typeMap = this.buildTypeMap(this));
92
90
  return this._typeMap;
93
91
  }
94
92
  /**
@@ -1705,9 +1705,7 @@ class PythonGenerator extends generator_1.Generator {
1705
1705
  if ((!docs || Object.keys(docs).length === 0) && !options.arguments) {
1706
1706
  return;
1707
1707
  }
1708
- if (!docs) {
1709
- docs = {};
1710
- }
1708
+ docs ?? (docs = {});
1711
1709
  const lines = new Array();
1712
1710
  if (docs.summary) {
1713
1711
  lines.push((0, markdown_1.md2rst)((0, _utils_1.renderSummary)(docs)));
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.110.0 (build 336b265)";
4
+ export declare const VERSION_DESC = "1.112.0 (build de1bc80)";
5
5
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- // Generated at 2025-03-19T11:46:46Z by generate.sh
2
+ // Generated at 2025-05-07T14:36:30Z 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.110.0';
7
+ exports.VERSION = '1.112.0';
8
8
  /** The qualified version number for this jsii-pacmak release (e.g: `X.Y.Z (build #######)`) */
9
- exports.VERSION_DESC = '1.110.0 (build 336b265)';
9
+ exports.VERSION_DESC = '1.112.0 (build de1bc80)';
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-pacmak",
3
- "version": "1.110.0",
3
+ "version": "1.112.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.110.0",
41
- "@jsii/spec": "^1.110.0",
40
+ "@jsii/check-node": "1.112.0",
41
+ "@jsii/spec": "^1.112.0",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.110.0",
43
+ "codemaker": "^1.112.0",
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.110.0",
47
+ "jsii-reflect": "^1.112.0",
48
48
  "semver": "^7.7.1",
49
- "spdx-license-list": "^6.9.0",
49
+ "spdx-license-list": "^6.10.0",
50
50
  "xmlbuilder": "^15.1.1",
51
51
  "yargs": "^16.2.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@jsii/dotnet-runtime": "^1.110.0",
55
- "@jsii/go-runtime": "^1.110.0",
56
- "@jsii/java-runtime": "^1.110.0",
57
- "@scope/jsii-calc-lib": "^1.110.0",
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",
58
58
  "@types/clone": "^2.1.4",
59
59
  "@types/commonmark": "^0.27.9",
60
60
  "@types/diff": "^5.2.3",
61
61
  "@types/fs-extra": "^9.0.13",
62
- "@types/semver": "^7.5.8",
62
+ "@types/semver": "^7.7.0",
63
63
  "diff": "^5.2.0",
64
64
  "jsii": "^5.8.0",
65
- "jsii-build-tools": "^1.110.0",
65
+ "jsii-build-tools": "^1.112.0",
66
66
  "jsii-calc": "^3.20.120",
67
67
  "jsii-rosetta": "~5.8.0",
68
- "pyright": "^1.1.395"
68
+ "pyright": "^1.1.400"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "jsii-rosetta": ">=5.5.0"