jsii-rosetta 1.104.0 → 1.105.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.
|
@@ -74,7 +74,7 @@ export declare class PythonVisitor extends DefaultVisitor<PythonLanguageContext>
|
|
|
74
74
|
* Bump this when you change something in the implementation to invalidate
|
|
75
75
|
* existing cached translations.
|
|
76
76
|
*/
|
|
77
|
-
static readonly VERSION = "
|
|
77
|
+
static readonly VERSION = "3";
|
|
78
78
|
readonly language = TargetLanguage.VISUALIZE;
|
|
79
79
|
readonly defaultContext: {};
|
|
80
80
|
/**
|
package/lib/languages/python.js
CHANGED
|
@@ -536,14 +536,14 @@ exports.PythonVisitor = PythonVisitor;
|
|
|
536
536
|
* Bump this when you change something in the implementation to invalidate
|
|
537
537
|
* existing cached translations.
|
|
538
538
|
*/
|
|
539
|
-
PythonVisitor.VERSION = '
|
|
539
|
+
PythonVisitor.VERSION = '3';
|
|
540
540
|
function mangleIdentifier(originalIdentifier) {
|
|
541
541
|
if ((0, util_1.startsWithUppercase)(originalIdentifier)) {
|
|
542
542
|
// Probably a class, leave as-is
|
|
543
543
|
return originalIdentifier;
|
|
544
544
|
}
|
|
545
545
|
// Turn into snake-case
|
|
546
|
-
const cased = originalIdentifier.replace(/[
|
|
546
|
+
const cased = originalIdentifier.replace(/[A-Z]/g, (m) => `_${m.toLowerCase()}`);
|
|
547
547
|
return IDENTIFIER_KEYWORDS.includes(cased) ? `${cased}_` : cased;
|
|
548
548
|
}
|
|
549
549
|
const BUILTIN_FUNCTIONS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsii-rosetta",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.105.0",
|
|
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.7",
|
|
22
22
|
"@types/workerpool": "^6.4.7",
|
|
23
23
|
"@types/semver": "^7.5.8",
|
|
24
|
-
"jsii-build-tools": "1.
|
|
24
|
+
"jsii-build-tools": "1.105.0",
|
|
25
25
|
"memory-streams": "^0.1.3",
|
|
26
|
-
"mock-fs": "^5.
|
|
26
|
+
"mock-fs": "^5.4.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jsii/check-node": "1.
|
|
30
|
-
"@jsii/spec": "1.
|
|
31
|
-
"commonmark": "^0.31.
|
|
29
|
+
"@jsii/check-node": "1.105.0",
|
|
30
|
+
"@jsii/spec": "1.105.0",
|
|
31
|
+
"commonmark": "^0.31.2",
|
|
32
32
|
"typescript": "~3.9.10",
|
|
33
|
-
"@xmldom/xmldom": "
|
|
33
|
+
"@xmldom/xmldom": "0.8.10",
|
|
34
34
|
"workerpool": "^6.5.1",
|
|
35
35
|
"yargs": "^16.2.0",
|
|
36
|
-
"stream-json": "^1.
|
|
36
|
+
"stream-json": "^1.9.1",
|
|
37
37
|
"semver": "^7.6.3",
|
|
38
38
|
"semver-intersect": "^1.5.0",
|
|
39
39
|
"fast-glob": "^3.3.2",
|
|
40
|
-
"jsii": "1.
|
|
40
|
+
"jsii": "1.105.0"
|
|
41
41
|
},
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"author": {
|
package/test/translate.test.js
CHANGED
|
@@ -172,4 +172,26 @@ test('declarations are translated correctly in all jsii languages', () => {
|
|
|
172
172
|
assembly.cleanup();
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
+
test('handling capital letters in identifiers', () => {
|
|
176
|
+
// Create an assembly in a temp directory
|
|
177
|
+
const assembly = testutil_1.TestJsiiModule.fromSource({
|
|
178
|
+
'index.ts': `
|
|
179
|
+
export interface InterfaceA {
|
|
180
|
+
readonly sizeInMBs: Number;
|
|
181
|
+
}
|
|
182
|
+
`,
|
|
183
|
+
}, {
|
|
184
|
+
name: 'my_assembly',
|
|
185
|
+
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
186
|
+
});
|
|
187
|
+
try {
|
|
188
|
+
const ts = assembly.translateHere(["import * as masm from 'my_assembly';", 'declare let intA: masm.InterfaceA;', 'intA = { sizeInMBs: 3 };'].join('\n'));
|
|
189
|
+
expect(ts.get(lib_1.TargetLanguage.PYTHON)?.source).toEqual(['import example_test_demo as masm', '# int_a: masm.InterfaceA', 'int_a = masm.InterfaceA(size_in_m_bs=3)'].join('\n'));
|
|
190
|
+
expect(ts.get(lib_1.TargetLanguage.JAVA)?.source).toEqual(['import example.test.demo.*;', 'InterfaceA intA;', 'intA = InterfaceA.builder().sizeInMBs(3).build();'].join('\n'));
|
|
191
|
+
expect(ts.get(lib_1.TargetLanguage.CSHARP)?.source).toEqual(['using Example.Test.Demo;', 'InterfaceA intA;', 'intA = new InterfaceA { SizeInMBs = 3 };'].join('\n'));
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
assembly.cleanup();
|
|
195
|
+
}
|
|
196
|
+
});
|
|
175
197
|
//# sourceMappingURL=translate.test.js.map
|