jsii-rosetta 5.1.13-dev.5 → 5.1.14-dev.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.
@@ -21,8 +21,9 @@ async function translateAll(snippets, includeCompilerDiagnostics) {
21
21
  // help that much, or we become I/O-bound at some point. On my machine, using
22
22
  // more than half the cores actually makes it slower.
23
23
  // Cap to a reasonable top-level limit to prevent thrash on machines with many, many cores.
24
- const maxWorkers = parseInt(process.env.JSII_ROSETTA_MAX_WORKER_COUNT ?? '16');
25
- const N = Math.min(maxWorkers, Math.max(1, Math.ceil(os.cpus().length / 2)));
24
+ const N = process.env.JSII_ROSETTA_MAX_WORKER_COUNT
25
+ ? parseInt(process.env.JSII_ROSETTA_MAX_WORKER_COUNT)
26
+ : Math.min(16, Math.max(1, Math.ceil(os.cpus().length / 2)));
26
27
  const snippetArr = Array.from(snippets);
27
28
  logging.info(`Translating ${snippetArr.length} snippets using ${N} workers`);
28
29
  const pool = workerpool.pool(path.join(__dirname, 'translate_all_worker.js'), {
@@ -1 +1 @@
1
- {"version":3,"file":"translate_all.js","sourceRoot":"","sources":["../src/translate_all.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,yCAAyC;AAEzC,qCAAqC;AAErC,+CAAsD;AAItD;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,QAA6B,EAC7B,0BAAmC;IAEnC,6EAA6E;IAC7E,6EAA6E;IAC7E,qDAAqD;IACrD,2FAA2F;IAC3F,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,IAAI,CAAC,CAAC;IAC/E,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,C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CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE;QACnD,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;YAC1C,0BAA0B;SAC3B,CAAC,CAAC;KACJ;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import * as os from 'node:os';\nimport * as path from 'node:path';\nimport * as workerpool from 'workerpool';\n\nimport * as logging from './logging';\nimport { TypeScriptSnippet } from './snippet';\nimport { TranslatedSnippet } from './tablets/tablets';\nimport { RosettaDiagnostic } from './translate';\nimport type { TranslateBatchRequest, TranslateBatchResponse } from './translate_all_worker';\n\n/**\n * Divide the work evenly over all processors by running 'translate_all_worker' in Worker Threads, then combine results\n *\n * The workers are fed small queues of work each. We used to divide the entire queue into N\n * but since the work is divided unevenly that led to some workers stopping early, idling while\n * waiting for more work.\n *\n * Never include 'translate_all_worker' directly, only do TypeScript type references (so that in\n * the script we may assume that 'worker_threads' successfully imports).\n */\nexport async function translateAll(\n snippets: TypeScriptSnippet[],\n includeCompilerDiagnostics: boolean,\n): Promise<TranslateAllResult> {\n // Use about half the advertised cores because hyperthreading doesn't seem to\n // help that much, or we become I/O-bound at some point. On my machine, using\n // more than half the cores actually makes it slower.\n // Cap to a reasonable top-level limit to prevent thrash on machines with many, many cores.\n const maxWorkers = parseInt(process.env.JSII_ROSETTA_MAX_WORKER_COUNT ?? '16');\n const N = Math.min(maxWorkers, Math.max(1, Math.ceil(os.cpus().length / 2)));\n const snippetArr = Array.from(snippets);\n logging.info(`Translating ${snippetArr.length} snippets using ${N} workers`);\n\n const pool = workerpool.pool(path.join(__dirname, 'translate_all_worker.js'), {\n maxWorkers: N,\n });\n\n try {\n const requests = batchSnippets(snippetArr, includeCompilerDiagnostics);\n\n const responses: TranslateBatchResponse[] = await Promise.all(\n requests.map((request) => pool.exec('translateBatch', [request])),\n );\n\n const diagnostics = new Array<RosettaDiagnostic>();\n const translatedSnippets = new Array<TranslatedSnippet>();\n\n // Combine results\n for (const response of responses) {\n diagnostics.push(...response.diagnostics);\n translatedSnippets.push(...response.translatedSchemas.map(TranslatedSnippet.fromSchema));\n }\n return { diagnostics, translatedSnippets };\n } finally {\n // Not waiting on purpose\n void pool.terminate();\n }\n}\n\nfunction batchSnippets(\n snippets: TypeScriptSnippet[],\n includeCompilerDiagnostics: boolean,\n batchSize = 10,\n): TranslateBatchRequest[] {\n const ret = [];\n\n for (let i = 0; i < snippets.length; i += batchSize) {\n ret.push({\n snippets: snippets.slice(i, i + batchSize),\n includeCompilerDiagnostics,\n });\n }\n\n return ret;\n}\n\nexport interface TranslateAllResult {\n translatedSnippets: TranslatedSnippet[];\n diagnostics: RosettaDiagnostic[];\n}\n"]}
1
+ {"version":3,"file":"translate_all.js","sourceRoot":"","sources":["../src/translate_all.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,yCAAyC;AAEzC,qCAAqC;AAErC,+CAAsD;AAItD;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,QAA6B,EAC7B,0BAAmC;IAEnC,6EAA6E;IAC7E,6EAA6E;IAC7E,qDAAqD;IACrD,2FAA2F;IAC3F,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B;QACjD,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,eAAe,UAAU,CAAC,MAAM,mBAAmB,CAAC,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EAAE,CAAC,GAAG,SAAS,CAAC;YAC1C,0BAA0B;SAC3B,CAAC,CAAC;KACJ;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import * as os from 'node:os';\nimport * as path from 'node:path';\nimport * as workerpool from 'workerpool';\n\nimport * as logging from './logging';\nimport { TypeScriptSnippet } from './snippet';\nimport { TranslatedSnippet } from './tablets/tablets';\nimport { RosettaDiagnostic } from './translate';\nimport type { TranslateBatchRequest, TranslateBatchResponse } from './translate_all_worker';\n\n/**\n * Divide the work evenly over all processors by running 'translate_all_worker' in Worker Threads, then combine results\n *\n * The workers are fed small queues of work each. We used to divide the entire queue into N\n * but since the work is divided unevenly that led to some workers stopping early, idling while\n * waiting for more work.\n *\n * Never include 'translate_all_worker' directly, only do TypeScript type references (so that in\n * the script we may assume that 'worker_threads' successfully imports).\n */\nexport async function translateAll(\n snippets: TypeScriptSnippet[],\n includeCompilerDiagnostics: boolean,\n): Promise<TranslateAllResult> {\n // Use about half the advertised cores because hyperthreading doesn't seem to\n // help that much, or we become I/O-bound at some point. On my machine, using\n // more than half the cores actually makes it slower.\n // Cap to a reasonable top-level limit to prevent thrash on machines with many, many cores.\n const N = process.env.JSII_ROSETTA_MAX_WORKER_COUNT\n ? parseInt(process.env.JSII_ROSETTA_MAX_WORKER_COUNT)\n : Math.min(16, Math.max(1, Math.ceil(os.cpus().length / 2)));\n const snippetArr = Array.from(snippets);\n logging.info(`Translating ${snippetArr.length} snippets using ${N} workers`);\n\n const pool = workerpool.pool(path.join(__dirname, 'translate_all_worker.js'), {\n maxWorkers: N,\n });\n\n try {\n const requests = batchSnippets(snippetArr, includeCompilerDiagnostics);\n\n const responses: TranslateBatchResponse[] = await Promise.all(\n requests.map((request) => pool.exec('translateBatch', [request])),\n );\n\n const diagnostics = new Array<RosettaDiagnostic>();\n const translatedSnippets = new Array<TranslatedSnippet>();\n\n // Combine results\n for (const response of responses) {\n diagnostics.push(...response.diagnostics);\n translatedSnippets.push(...response.translatedSchemas.map(TranslatedSnippet.fromSchema));\n }\n return { diagnostics, translatedSnippets };\n } finally {\n // Not waiting on purpose\n void pool.terminate();\n }\n}\n\nfunction batchSnippets(\n snippets: TypeScriptSnippet[],\n includeCompilerDiagnostics: boolean,\n batchSize = 10,\n): TranslateBatchRequest[] {\n const ret = [];\n\n for (let i = 0; i < snippets.length; i += batchSize) {\n ret.push({\n snippets: snippets.slice(i, i + batchSize),\n includeCompilerDiagnostics,\n });\n }\n\n return ret;\n}\n\nexport interface TranslateAllResult {\n translatedSnippets: TranslatedSnippet[];\n diagnostics: RosettaDiagnostic[];\n}\n"]}
package/package.json CHANGED
@@ -32,36 +32,36 @@
32
32
  "organization": false
33
33
  },
34
34
  "devDependencies": {
35
- "@actions/core": "^1.10.0",
35
+ "@actions/core": "^1.10.1",
36
36
  "@actions/github": "^5.1.1",
37
37
  "@types/commonmark": "^0.27.7",
38
- "@types/jest": "^29.5.4",
39
- "@types/mock-fs": "^4.13.1",
38
+ "@types/jest": "^29.5.5",
39
+ "@types/mock-fs": "^4.13.2",
40
40
  "@types/node": "^16",
41
- "@types/stream-json": "^1.7.3",
42
- "@types/tar": "^6.1.5",
43
- "@types/workerpool": "^6.4.1",
41
+ "@types/stream-json": "^1.7.4",
42
+ "@types/tar": "^6.1.6",
43
+ "@types/workerpool": "^6.4.4",
44
44
  "@typescript-eslint/eslint-plugin": "^6",
45
45
  "@typescript-eslint/parser": "^6",
46
46
  "eslint": "^8",
47
47
  "eslint-config-prettier": "^8.10.0",
48
48
  "eslint-import-resolver-node": "^0.3.9",
49
- "eslint-import-resolver-typescript": "^3.6.0",
49
+ "eslint-import-resolver-typescript": "^3.6.1",
50
50
  "eslint-plugin-import": "^2.28.1",
51
51
  "eslint-plugin-prettier": "^4.2.1",
52
52
  "eslint-plugin-unicorn": "^46.0.1",
53
- "jest": "^29.6.4",
53
+ "jest": "^29.7.0",
54
54
  "mock-fs": "^5.2.0",
55
55
  "npm-check-updates": "^16",
56
56
  "prettier": "^2.8.8",
57
- "projen": "^0.73.12",
57
+ "projen": "^0.74.9",
58
58
  "tar": "^6.2.0",
59
59
  "ts-jest": "^29.1.1",
60
60
  "ts-node": "^10.9.1"
61
61
  },
62
62
  "dependencies": {
63
- "@jsii/check-node": "1.88.0",
64
- "@jsii/spec": "^1.88.0",
63
+ "@jsii/check-node": "1.90.0",
64
+ "@jsii/spec": "^1.90.0",
65
65
  "@xmldom/xmldom": "^0.8.10",
66
66
  "chalk": "^4",
67
67
  "commonmark": "^0.30.0",
@@ -71,7 +71,7 @@
71
71
  "semver-intersect": "^1.4.0",
72
72
  "stream-json": "^1.8.0",
73
73
  "typescript": "~5.1.6",
74
- "workerpool": "^6.4.2",
74
+ "workerpool": "^6.5.1",
75
75
  "yargs": "^17.7.2"
76
76
  },
77
77
  "engines": {
@@ -80,7 +80,7 @@
80
80
  "main": "lib/index.js",
81
81
  "license": "Apache-2.0",
82
82
  "homepage": "https://aws.github.io/jsii",
83
- "version": "5.1.13-dev.5",
83
+ "version": "5.1.14-dev.0",
84
84
  "types": "lib/index.d.ts",
85
85
  "exports": {
86
86
  ".": "./lib/index.js",