jsii-rosetta 1.85.0 → 1.86.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.
@@ -368,7 +368,7 @@ function main() {
368
368
  */
369
369
  function wrapHandler(handler) {
370
370
  return (argv) => {
371
- logging.configure({ level: argv.verbose !== undefined ? argv.verbose : 0 });
371
+ logging.configure({ level: argv.verbose ?? 0 });
372
372
  handler(argv).catch((e) => {
373
373
  logging.error(e.message);
374
374
  logging.error(e.stack);
@@ -6,7 +6,7 @@ export declare enum TargetLanguage {
6
6
  JAVA = "java",
7
7
  GO = "go"
8
8
  }
9
- export declare function targetName(language: TargetLanguage.PYTHON | TargetLanguage.VISUALIZE): 'python';
9
+ export declare function targetName(language: TargetLanguage.PYTHON): 'python';
10
10
  export declare function targetName(language: TargetLanguage.CSHARP): 'dotnet';
11
11
  export declare function targetName(language: TargetLanguage.JAVA): 'java';
12
12
  export declare function targetName(language: TargetLanguage.GO): 'go';
@@ -6,6 +6,7 @@ var TargetLanguage;
6
6
  (function (TargetLanguage) {
7
7
  /** @internal an alias of PYTHON to make intent clear when language is irrelevant */
8
8
  TargetLanguage["VISUALIZE"] = "python";
9
+ // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
9
10
  TargetLanguage["PYTHON"] = "python";
10
11
  TargetLanguage["CSHARP"] = "csharp";
11
12
  TargetLanguage["JAVA"] = "java";
package/lib/snippet.d.ts CHANGED
@@ -88,7 +88,7 @@ export declare type ApiLocation = {
88
88
  } | {
89
89
  readonly api: 'parameter';
90
90
  readonly fqn: string;
91
- readonly methodName: string | typeof INITIALIZER_METHOD_NAME;
91
+ readonly methodName: string;
92
92
  readonly parameterName: string;
93
93
  };
94
94
  export declare type FieldLocation = {
@@ -36,7 +36,7 @@ function renderType(type) {
36
36
  return type.symbol.name;
37
37
  }
38
38
  if (type.isLiteral()) {
39
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
39
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-base-to-string
40
40
  return `${type.value}`;
41
41
  }
42
42
  return renderTypeFlags(type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsii-rosetta",
3
- "version": "1.85.0",
3
+ "version": "1.86.1",
4
4
  "description": "Translate TypeScript code snippets to other languages",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -21,23 +21,23 @@
21
21
  "@types/stream-json": "^1.7.3",
22
22
  "@types/workerpool": "^6.4.0",
23
23
  "@types/semver": "^7.5.0",
24
- "jsii-build-tools": "1.85.0",
24
+ "jsii-build-tools": "1.86.1",
25
25
  "memory-streams": "^0.1.3",
26
26
  "mock-fs": "^5.2.0"
27
27
  },
28
28
  "dependencies": {
29
- "@jsii/check-node": "1.85.0",
30
- "@jsii/spec": "1.85.0",
29
+ "@jsii/check-node": "1.86.1",
30
+ "@jsii/spec": "1.86.1",
31
31
  "commonmark": "^0.30.0",
32
32
  "typescript": "~3.9.10",
33
- "@xmldom/xmldom": "^0.8.8",
33
+ "@xmldom/xmldom": "^0.8.10",
34
34
  "workerpool": "^6.4.0",
35
35
  "yargs": "^16.2.0",
36
36
  "stream-json": "^1.8.0",
37
- "semver": "^7.5.1",
37
+ "semver": "^7.5.4",
38
38
  "semver-intersect": "^1.4.0",
39
- "fast-glob": "^3.2.12",
40
- "jsii": "1.85.0"
39
+ "fast-glob": "^3.3.1",
40
+ "jsii": "1.86.1"
41
41
  },
42
42
  "license": "Apache-2.0",
43
43
  "author": {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const spec = require("@jsii/spec");
4
4
  const fs_1 = require("fs");
5
- const mockfs = require("mock-fs");
5
+ const os = require("os");
6
6
  const path = require("path");
7
7
  const assemblies_1 = require("../../lib/jsii/assemblies");
8
8
  const snippet_1 = require("../../lib/snippet");
@@ -171,10 +171,10 @@ test('Fixture allows use of import statements', async () => {
171
171
  expect(snippets[0].visibleSource).toEqual(['import { exit } from "process";', 'someExample();', 'exit(0);'].join('\n'));
172
172
  });
173
173
  test('Backwards compatibility with literate integ tests', async () => {
174
- mockfs({
175
- '/package/test/integ.example.lit.ts': '# Some literate source file',
176
- });
174
+ const directory = await fs_1.promises.mkdtemp(path.join(os.tmpdir(), 'jsii-rosetta-tests-'));
177
175
  try {
176
+ await fs_1.promises.mkdir(path.join(directory, 'test'));
177
+ await fs_1.promises.writeFile(path.join(directory, 'test', 'integ.example.lit.ts'), '# Some literate source file');
178
178
  const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
179
179
  {
180
180
  assembly: (0, fake_assembly_1.fakeAssembly)({
@@ -188,15 +188,15 @@ test('Backwards compatibility with literate integ tests', async () => {
188
188
  ].join('\n'),
189
189
  },
190
190
  }),
191
- directory: '/package',
191
+ directory,
192
192
  },
193
193
  ]));
194
194
  expect(snippets[0].visibleSource).toEqual('someExample();');
195
195
  expect(snippets[0].completeSource).toEqual('# Some literate source file');
196
- expect(snippets[0]?.parameters?.[snippet_1.SnippetParameters.$COMPILATION_DIRECTORY]).toEqual(path.normalize('/package/test'));
196
+ expect(snippets[0]?.parameters?.[snippet_1.SnippetParameters.$COMPILATION_DIRECTORY]).toEqual(path.join(directory, 'test'));
197
197
  }
198
198
  finally {
199
- mockfs.restore();
199
+ await fs_1.promises.rm(directory, { force: true, recursive: true });
200
200
  }
201
201
  });
202
202
  test('rosetta fixture from submodule is preferred if it exists', async () => {