jsii-rosetta 1.80.0 → 1.82.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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './upgrade-prompt';
1
2
  export * from './translate';
2
3
  export { renderTree } from './o-tree';
3
4
  export { TargetLanguage } from './languages/target-language';
package/lib/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.GoVisitor = exports.PythonVisitor = exports.JavaVisitor = exports.CSharpVisitor = exports.TargetLanguage = exports.renderTree = void 0;
18
+ require("./upgrade-prompt");
18
19
  __exportStar(require("./translate"), exports);
19
20
  var o_tree_1 = require("./o-tree");
20
21
  Object.defineProperty(exports, "renderTree", { enumerable: true, get: function () { return o_tree_1.renderTree; } });
package/lib/json.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { Readable, Writable } from 'node:stream';
2
+ /// <reference types="node" />
3
+ import { Readable } from 'stream';
3
4
  /**
4
5
  * Asynchronously parses a single JSON value from the provided reader. The JSON
5
6
  * text might be longer than what could fit in a single string value, since the
@@ -22,7 +23,7 @@ export declare function parse(reader: Readable): Promise<any>;
22
23
  * better performance.
23
24
  *
24
25
  * @param value the value to be serialized.
25
- * @param writer the write in which to write the JSON text.
26
+ * @param writers the sequence of write streams to use to output the JSON text.
26
27
  */
27
- export declare function stringify(value: any, writer: Writable): Promise<void>;
28
+ export declare function stringify(value: any, ...writers: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream>): Promise<void>;
28
29
  //# sourceMappingURL=json.d.ts.map
package/lib/json.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringify = exports.parse = void 0;
4
- const node_stream_1 = require("node:stream");
5
- const node_util_1 = require("node:util");
4
+ const stream_1 = require("stream");
6
5
  const stream_json_1 = require("stream-json");
7
6
  const Assembler = require("stream-json/Assembler");
8
7
  const Disassembler_1 = require("stream-json/Disassembler");
9
8
  const Stringer_1 = require("stream-json/Stringer");
9
+ const util_1 = require("util");
10
10
  // NB: In node 15+, there is a node:stream.promises object that has this built-in.
11
- const asyncPipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
11
+ const asyncPipeline = (0, util_1.promisify)(stream_1.pipeline);
12
12
  /**
13
13
  * Asynchronously parses a single JSON value from the provided reader. The JSON
14
14
  * text might be longer than what could fit in a single string value, since the
@@ -37,13 +37,13 @@ exports.parse = parse;
37
37
  * better performance.
38
38
  *
39
39
  * @param value the value to be serialized.
40
- * @param writer the write in which to write the JSON text.
40
+ * @param writers the sequence of write streams to use to output the JSON text.
41
41
  */
42
- async function stringify(value, writer) {
43
- const reader = new node_stream_1.Readable({ objectMode: true });
42
+ async function stringify(value, ...writers) {
43
+ const reader = new stream_1.Readable({ objectMode: true });
44
44
  reader.push(value);
45
45
  reader.push(null);
46
- return asyncPipeline(reader, (0, Disassembler_1.disassembler)(), (0, Stringer_1.stringer)(), writer);
46
+ return asyncPipeline(reader, (0, Disassembler_1.disassembler)(), (0, Stringer_1.stringer)(), ...writers);
47
47
  }
48
48
  exports.stringify = stringify;
49
49
  //# sourceMappingURL=json.js.map
@@ -160,8 +160,7 @@ class LanguageTablet {
160
160
  await fs_1.promises.mkdir(path.dirname(filename), { recursive: true });
161
161
  const writeStream = (0, fs_1.createWriteStream)(filename, { flags: 'w' });
162
162
  const gzip = compress ? zlib.createGzip() : undefined;
163
- gzip?.pipe(writeStream, { end: true });
164
- return (0, json_1.stringify)(this.toSchema(), gzip ?? writeStream);
163
+ return (0, json_1.stringify)(this.toSchema(), ...(gzip ? [gzip] : []), writeStream);
165
164
  }
166
165
  toSchema() {
167
166
  return {
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=upgrade-prompt.d.ts.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Note: intentionally using the same environment variable as the compiler here instead of customizing...
3
+ if (process.env.JSII_SUPPRESS_UPGRADE_PROMPT == null) {
4
+ console.error([
5
+ '#######################################################################################################',
6
+ '### You are currently using jsii-rosetta@1.x. We recommend upgrading to jsii-rosetta@5.0.x or ###',
7
+ '### later. This will allow you to use modern TypeScript syntax, and improves compatibility with ###',
8
+ '### many common dependencies. For example, recent versions of @types/node. ###',
9
+ '### ###',
10
+ '### 5.0.x and subsequent releases of jsii-rosetta use the same major.minor version as the ###',
11
+ '### TypeScript compiler they are built on. We recommend declaring a minor-pinned (also known as ###',
12
+ '### "tilde") dependency on jsii-rosetta (e.g: `"jsii-rosetta": "5.0.x"` or ###',
13
+ '### `"jsii-rosetta": "~5.0.7"`). ###',
14
+ '### ###',
15
+ '### For more information, see: https://aws.github.io/jsii/compiler-and-rosetta-maintenance/ ###',
16
+ '### ###',
17
+ '### This warning can be suppressed by setting the JSII_SUPPRESS_UPGRADE_PROMPT environment variable ###',
18
+ '#######################################################################################################',
19
+ ].join('\n'));
20
+ // Suppress any further upgrade prompts (e.g: the one from jsii, which is a dependency of jsii-rosetta)...
21
+ process.env.JSII_SUPPRESS_UPGRADE_PROMPT = '1';
22
+ }
23
+ //# sourceMappingURL=upgrade-prompt.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-rosetta",
3
- "version": "1.80.0",
3
+ "version": "1.82.0",
4
4
  "description": "Translate TypeScript code snippets to other languages",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -20,25 +20,25 @@
20
20
  "@types/mock-fs": "^4.13.1",
21
21
  "@types/stream-json": "^1.7.3",
22
22
  "@types/workerpool": "^6.4.0",
23
- "@types/semver": "^7.3.13",
24
- "jsii-build-tools": "1.80.0",
23
+ "@types/semver": "^7.5.0",
24
+ "jsii-build-tools": "1.82.0",
25
25
  "jsii-calc": "3.20.120",
26
26
  "memory-streams": "^0.1.3",
27
27
  "mock-fs": "^5.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@jsii/check-node": "1.80.0",
31
- "@jsii/spec": "1.80.0",
30
+ "@jsii/check-node": "1.82.0",
31
+ "@jsii/spec": "1.82.0",
32
32
  "commonmark": "^0.30.0",
33
33
  "typescript": "~3.9.10",
34
- "@xmldom/xmldom": "^0.8.6",
34
+ "@xmldom/xmldom": "^0.8.7",
35
35
  "workerpool": "^6.4.0",
36
36
  "yargs": "^16.2.0",
37
37
  "stream-json": "^1.7.5",
38
- "semver": "^7.3.8",
38
+ "semver": "^7.5.1",
39
39
  "semver-intersect": "^1.4.0",
40
40
  "fast-glob": "^3.2.12",
41
- "jsii": "1.80.0"
41
+ "jsii": "1.82.0"
42
42
  },
43
43
  "license": "Apache-2.0",
44
44
  "author": {