jsii-pacmak 1.113.0 → 1.115.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 (39) hide show
  1. package/bin/jsii-pacmak.js +1 -1
  2. package/lib/index.js +2 -0
  3. package/lib/npm-modules.d.ts +1 -1
  4. package/lib/npm-modules.js +1 -3
  5. package/lib/packaging.d.ts +1 -5
  6. package/lib/packaging.js +12 -6
  7. package/lib/rosetta-assembly.d.ts +20 -0
  8. package/lib/rosetta-assembly.js +29 -0
  9. package/lib/targets/dotnet/dotnetdocgenerator.d.ts +4 -1
  10. package/lib/targets/dotnet/dotnetdocgenerator.js +69 -13
  11. package/lib/targets/dotnet/dotnetgenerator.d.ts +0 -4
  12. package/lib/targets/dotnet/dotnetgenerator.js +24 -14
  13. package/lib/targets/dotnet/dotnetruntimegenerator.js +11 -2
  14. package/lib/targets/dotnet/dotnettyperesolver.d.ts +13 -0
  15. package/lib/targets/dotnet/dotnettyperesolver.js +42 -4
  16. package/lib/targets/dotnet.d.ts +1 -1
  17. package/lib/targets/dotnet.js +6 -4
  18. package/lib/targets/go/runtime/runtime-type-checking.js +1 -0
  19. package/lib/targets/go/types/go-type-reference.d.ts +3 -0
  20. package/lib/targets/go/types/go-type-reference.js +20 -0
  21. package/lib/targets/go.js +1 -1
  22. package/lib/targets/java.d.ts +28 -4
  23. package/lib/targets/java.js +411 -219
  24. package/lib/targets/python/requirements-dev.txt +2 -2
  25. package/lib/targets/python/type-name.d.ts +18 -0
  26. package/lib/targets/python/type-name.js +59 -1
  27. package/lib/targets/python.d.ts +2 -1
  28. package/lib/targets/python.js +53 -18
  29. package/lib/targets/type-literals.d.ts +22 -0
  30. package/lib/targets/type-literals.js +39 -0
  31. package/lib/type-utils.d.ts +3 -0
  32. package/lib/type-utils.js +10 -0
  33. package/lib/type-visitor.d.ts +19 -0
  34. package/lib/type-visitor.js +47 -0
  35. package/lib/util.d.ts +18 -5
  36. package/lib/util.js +80 -13
  37. package/lib/version.d.ts +1 -1
  38. package/lib/version.js +3 -3
  39. package/package.json +15 -14
package/lib/util.js CHANGED
@@ -7,11 +7,13 @@ exports.findPackageJsonUp = findPackageJsonUp;
7
7
  exports.findUp = findUp;
8
8
  exports.retry = retry;
9
9
  exports.shell = shell;
10
+ exports.subprocess = subprocess;
10
11
  exports.slugify = slugify;
11
12
  exports.setExtend = setExtend;
12
13
  exports.filterAsync = filterAsync;
13
14
  exports.wait = wait;
14
15
  exports.flatten = flatten;
16
+ exports.zip = zip;
15
17
  const child_process_1 = require("child_process");
16
18
  const fs = require("fs-extra");
17
19
  const os = require("os");
@@ -134,25 +136,65 @@ async function retry(cb, opts = {}, waiter = wait) {
134
136
  return Promise.reject(new AllAttemptsFailed(cb, errors));
135
137
  }
136
138
  /**
137
- * Spawns a child process with the provided command and arguments. The child
138
- * process is always spawned using `shell: true`, and the contents of
139
+ * Spawns a shell with the provided commandline.
140
+ *
141
+ * The child process is always spawned using `shell: true`, and the contents of
139
142
  * `process.env` is used as the initial value of the `env` spawn option (values
140
143
  * provided in `options.env` can override those).
144
+ */
145
+ async function shell(commandLine, options) {
146
+ return handleSubprocess(options, () => {
147
+ logging.debug(commandLine, JSON.stringify(options));
148
+ return {
149
+ command: commandLine,
150
+ child: (0, child_process_1.spawn)(commandLine, {
151
+ ...options,
152
+ shell: true,
153
+ env: { ...process.env, ...(options?.env ?? {}) },
154
+ stdio: ['ignore', 'pipe', 'pipe'],
155
+ }),
156
+ };
157
+ });
158
+ }
159
+ /**
160
+ * Spawns a subprocess with the provided command and arguments.
141
161
  *
142
- * @param cmd the command to shell out to.
162
+ * The child process is always spawned using `shell: false`, and the contents of
163
+ * `process.env` is used as the initial value of the `env` spawn option (values
164
+ * provided in `options.env` can override those).
165
+ *
166
+ * To make this work on Windows, if the binary happens to resolve to a batch file
167
+ * we run it through cmd.exe.
168
+ *
169
+ * @param binary the command to shell out to.
143
170
  * @param args the arguments to provide to `cmd`
144
171
  * @param options any options to pass to `spawn`
145
172
  */
146
- async function shell(cmd, args, { retry: retryOptions, ...options } = {}) {
147
- async function spawn1() {
148
- logging.debug(cmd, args.join(' '), JSON.stringify(options));
149
- return new Promise((ok, ko) => {
150
- const child = (0, child_process_1.spawn)(cmd, args, {
173
+ async function subprocess(binary, args, options) {
174
+ if (os.platform() === 'win32') {
175
+ const resolved = resolveBinaryWindows(binary);
176
+ // Anything that's not an executable, run it through cmd.exe
177
+ if (!resolved.toLocaleLowerCase().endsWith('.exe')) {
178
+ binary = process.env.COMSPEC ?? 'cmd.exe';
179
+ args = ['/d', '/c', resolved, ...args];
180
+ }
181
+ }
182
+ return handleSubprocess(options, () => {
183
+ logging.debug(binary, args.join(' '), JSON.stringify(options ?? {}));
184
+ return {
185
+ command: `${binary} ${args.join(' ')}`.trim(),
186
+ child: (0, child_process_1.spawn)(binary, args, {
151
187
  ...options,
152
- shell: true,
153
- env: { ...process.env, ...(options.env ?? {}) },
188
+ env: { ...process.env, ...(options?.env ?? {}) },
154
189
  stdio: ['ignore', 'pipe', 'pipe'],
155
- });
190
+ }),
191
+ };
192
+ });
193
+ }
194
+ async function handleSubprocess({ retry: retryOptions } = {}, doSpawn) {
195
+ async function spawn1() {
196
+ return new Promise((ok, ko) => {
197
+ const { command, child } = doSpawn();
156
198
  const stdout = new Array();
157
199
  const stderr = new Array();
158
200
  child.stdout.on('data', (chunk) => {
@@ -177,7 +219,6 @@ async function shell(cmd, args, { retry: retryOptions, ...options } = {}) {
177
219
  }
178
220
  const err = Buffer.concat(stderr).toString('utf-8');
179
221
  const reason = signal != null ? `signal ${signal}` : `status ${code}`;
180
- const command = `${cmd} ${args.join(' ')}`;
181
222
  return ko(new Error([
182
223
  `Command (${command}) failed with ${reason}:`,
183
224
  // STDERR first, the erro message could be truncated in logs.
@@ -202,12 +243,31 @@ async function shell(cmd, args, { retry: retryOptions, ...options } = {}) {
202
243
  const retryInfo = attemptsLeft > 0
203
244
  ? `Waiting ${backoffMs} ms before retrying (${attemptsLeft} attempts left)`
204
245
  : 'No attempts left';
205
- logging.info(`Command "${cmd} ${args.join(' ')}" failed with ${message}. ${retryInfo}.`);
246
+ logging.info(`${message}. ${retryInfo}.`);
206
247
  }),
207
248
  });
208
249
  }
209
250
  return spawn1();
210
251
  }
252
+ /**
253
+ * Resolve a command to an executable on Windows
254
+ */
255
+ function resolveBinaryWindows(command) {
256
+ const extensions = (process.env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH').split(';');
257
+ const dirs = [
258
+ process.cwd(),
259
+ ...(process.env.PATH?.split(path.delimiter) ?? []),
260
+ ];
261
+ for (const dir of dirs) {
262
+ for (const ext of ['', ...extensions]) {
263
+ const candidate = path.resolve(dir, `${command}${ext}`);
264
+ if (fs.pathExistsSync(candidate)) {
265
+ return candidate;
266
+ }
267
+ }
268
+ }
269
+ throw new Error(`Unable to resolve command: ${command} in ${process.env.PATH}`);
270
+ }
211
271
  /**
212
272
  * Strip filesystem unsafe characters from a string
213
273
  */
@@ -274,4 +334,11 @@ async function wait(ms) {
274
334
  function flatten(xs) {
275
335
  return Array.prototype.concat.call([], ...xs);
276
336
  }
337
+ function zip(xs, ys) {
338
+ const ret = new Array();
339
+ for (let i = 0; i < xs.length; i++) {
340
+ ret.push([xs[i], ys[i]]);
341
+ }
342
+ return ret;
343
+ }
277
344
  //# 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.113.0 (build fc68b25)";
4
+ export declare const VERSION_DESC = "1.115.0 (build 9c5134e)";
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-29T13:25:03Z 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.115.0';
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.115.0 (build 9c5134e)';
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.115.0",
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.115.0",
41
+ "@jsii/spec": "1.115.0",
42
42
  "clone": "^2.1.2",
43
- "codemaker": "^1.113.0",
43
+ "codemaker": "^1.115.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.113.0",
47
+ "jsii-reflect": "^1.115.0",
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.115.0",
55
+ "@jsii/go-runtime": "^1.115.0",
56
+ "@jsii/java-runtime": "^1.115.0",
57
+ "@scope/jsii-calc-lib": "^1.115.0",
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.6",
66
+ "jsii-build-tools": "^1.115.0",
66
67
  "jsii-calc": "^3.20.120",
67
- "jsii-rosetta": "~5.8.0",
68
+ "jsii-rosetta": "~5.9.6",
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",