jsii-rosetta 1.76.0 → 4.9.0-dev.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.
- package/LICENSE +202 -0
- package/NOTICE +1 -0
- package/README.md +287 -388
- package/bin/jsii-rosetta +1 -1
- package/lib/ambient/semver-intersect.d.ts +13 -0
- package/lib/ambient/semver-intersect.js +2 -0
- package/lib/ambient/semver-intersect.js.map +1 -0
- package/lib/commands/convert.js.map +1 -0
- package/lib/commands/coverage.js.map +1 -0
- package/lib/commands/extract.js +2 -2
- package/lib/commands/extract.js.map +1 -0
- package/lib/commands/infuse.js +2 -2
- package/lib/commands/infuse.js.map +1 -0
- package/lib/commands/read.js +6 -6
- package/lib/commands/read.js.map +1 -0
- package/lib/commands/transliterate.js +4 -4
- package/lib/commands/transliterate.js.map +1 -0
- package/lib/commands/trim-cache.js.map +1 -0
- package/lib/find-utils.js +4 -4
- package/lib/find-utils.js.map +1 -0
- package/lib/fixtures.js +2 -2
- package/lib/fixtures.js.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/jsii/assemblies.d.ts +1 -1
- package/lib/jsii/assemblies.js +14 -11
- package/lib/jsii/assemblies.js.map +1 -0
- package/lib/jsii/fingerprinting.js +9 -9
- package/lib/jsii/fingerprinting.js.map +1 -0
- package/lib/jsii/jsii-types.d.ts +4 -4
- package/lib/jsii/jsii-types.js +9 -4
- package/lib/jsii/jsii-types.js.map +1 -0
- package/lib/jsii/jsii-utils.d.ts +1 -1
- package/lib/jsii/jsii-utils.js +2 -2
- package/lib/jsii/jsii-utils.js.map +1 -0
- package/lib/jsii/packages.js.map +1 -0
- package/lib/languages/csharp.d.ts +3 -3
- package/lib/languages/csharp.js +2 -2
- package/lib/languages/csharp.js.map +1 -0
- package/lib/languages/default.d.ts +2 -2
- package/lib/languages/default.js.map +1 -0
- package/lib/languages/go.d.ts +3 -3
- package/lib/languages/go.js +33 -23
- package/lib/languages/go.js.map +1 -0
- package/lib/languages/index.d.ts +1 -1
- package/lib/languages/index.js +4 -4
- package/lib/languages/index.js.map +1 -0
- package/lib/languages/java.d.ts +2 -2
- package/lib/languages/java.js +2 -2
- package/lib/languages/java.js.map +1 -0
- package/lib/languages/python.d.ts +3 -3
- package/lib/languages/python.js +1 -1
- package/lib/languages/python.js.map +1 -0
- package/lib/languages/record-references-version.d.ts +2 -0
- package/lib/languages/record-references-version.js +6 -0
- package/lib/languages/record-references-version.js.map +1 -0
- package/lib/languages/record-references.d.ts +2 -2
- package/lib/languages/record-references.js +3 -2
- package/lib/languages/record-references.js.map +1 -0
- package/lib/languages/target-language.d.ts +0 -2
- package/lib/languages/target-language.js +2 -1
- package/lib/languages/target-language.js.map +1 -0
- package/lib/languages/visualize.d.ts +1 -1
- package/lib/languages/visualize.js +1 -1
- package/lib/languages/visualize.js.map +1 -0
- package/lib/logging.js +1 -1
- package/lib/logging.js.map +1 -0
- package/lib/main.d.ts +2 -0
- package/{bin/jsii-rosetta.js → lib/main.js} +21 -21
- package/lib/main.js.map +1 -0
- package/lib/markdown/escapes.js.map +1 -0
- package/lib/markdown/extract-snippets.d.ts +2 -2
- package/lib/markdown/extract-snippets.js +1 -1
- package/lib/markdown/extract-snippets.js.map +1 -0
- package/lib/markdown/index.js.map +1 -0
- package/lib/markdown/javadoc-renderer.js.map +1 -0
- package/lib/markdown/markdown-renderer.js.map +1 -0
- package/lib/markdown/markdown.js.map +1 -0
- package/lib/markdown/replace-code-renderer.d.ts +1 -1
- package/lib/markdown/replace-code-renderer.js.map +1 -0
- package/lib/markdown/replace-typescript-transform.d.ts +2 -2
- package/lib/markdown/replace-typescript-transform.js +1 -1
- package/lib/markdown/replace-typescript-transform.js.map +1 -0
- package/lib/markdown/structure-renderer.js.map +1 -0
- package/lib/markdown/types.js.map +1 -0
- package/lib/markdown/xml-comment-renderer.js.map +1 -0
- package/lib/o-tree.js +3 -3
- package/lib/o-tree.js.map +1 -0
- package/lib/renderer.js.map +1 -0
- package/lib/rosetta-reader.js.map +1 -0
- package/lib/rosetta-translator.d.ts +1 -1
- package/lib/rosetta-translator.js +2 -2
- package/lib/rosetta-translator.js.map +1 -0
- package/lib/snippet-dependencies.js +12 -12
- package/lib/snippet-dependencies.js.map +1 -0
- package/lib/snippet-selectors.d.ts +1 -1
- package/lib/snippet-selectors.js +2 -2
- package/lib/snippet-selectors.js.map +1 -0
- package/lib/snippet.d.ts +3 -3
- package/lib/snippet.js +5 -5
- package/lib/snippet.js.map +1 -0
- package/lib/strict.js.map +1 -0
- package/lib/submodule-reference.d.ts +1 -1
- package/lib/submodule-reference.js +11 -11
- package/lib/submodule-reference.js.map +1 -0
- package/lib/tablets/key.js +3 -3
- package/lib/tablets/key.js.map +1 -0
- package/lib/tablets/schema.js.map +1 -0
- package/lib/tablets/tablets.d.ts +1 -1
- package/lib/tablets/tablets.js +13 -13
- package/lib/tablets/tablets.js.map +1 -0
- package/lib/translate.d.ts +1 -1
- package/lib/translate.js +9 -7
- package/lib/translate.js.map +1 -0
- package/lib/translate_all.js +2 -2
- package/lib/translate_all.js.map +1 -0
- package/lib/translate_all_worker.js.map +1 -0
- package/lib/typescript/ast-utils.d.ts +2 -2
- package/lib/typescript/ast-utils.js +2 -4
- package/lib/typescript/ast-utils.js.map +1 -0
- package/lib/typescript/imports.d.ts +2 -2
- package/lib/typescript/imports.js +3 -3
- package/lib/typescript/imports.js.map +1 -0
- package/lib/typescript/syntax-kind-counter.d.ts +1 -1
- package/lib/typescript/syntax-kind-counter.js +1 -2
- package/lib/typescript/syntax-kind-counter.js.map +1 -0
- package/lib/typescript/ts-compiler.js.map +1 -0
- package/lib/typescript/types.d.ts +2 -2
- package/lib/typescript/types.js +1 -1
- package/lib/typescript/types.js.map +1 -0
- package/lib/typescript/visible-spans.js +6 -6
- package/lib/typescript/visible-spans.js.map +1 -0
- package/lib/util.d.ts +1 -1
- package/lib/util.js +2 -2
- package/lib/util.js.map +1 -0
- package/package.json +68 -37
- package/temp.tabl.json +48 -0
- package/bin/jsii-rosetta.d.ts +0 -2
- package/jest.config.mjs +0 -8
- package/jestsetup.js +0 -4
- package/test/commands/extract.test.d.ts +0 -2
- package/test/commands/extract.test.js +0 -698
- package/test/commands/infuse.test.d.ts +0 -2
- package/test/commands/infuse.test.js +0 -165
- package/test/commands/transliterate.test.d.ts +0 -2
- package/test/commands/transliterate.test.js +0 -1636
- package/test/commands/trim-cache.test.d.ts +0 -2
- package/test/commands/trim-cache.test.js +0 -85
- package/test/fixtures.test.d.ts +0 -2
- package/test/fixtures.test.js +0 -49
- package/test/jsii/assemblies.test.d.ts +0 -2
- package/test/jsii/assemblies.test.js +0 -230
- package/test/jsii/fake-assembly.d.ts +0 -3
- package/test/jsii/fake-assembly.js +0 -21
- package/test/jsii/fixtures/rosetta/explicit.ts-fixture +0 -7
- package/test/jsii/visible-spans.test.d.ts +0 -2
- package/test/jsii/visible-spans.test.js +0 -40
- package/test/jsii-imports.test.d.ts +0 -2
- package/test/jsii-imports.test.js +0 -438
- package/test/markdown/javadoc.test.d.ts +0 -2
- package/test/markdown/javadoc.test.js +0 -110
- package/test/markdown/roundtrip.test.d.ts +0 -2
- package/test/markdown/roundtrip.test.js +0 -126
- package/test/markdown/xmldoccomments.test.d.ts +0 -2
- package/test/markdown/xmldoccomments.test.js +0 -89
- package/test/otree.test.d.ts +0 -2
- package/test/otree.test.js +0 -36
- package/test/record-references.test.d.ts +0 -2
- package/test/record-references.test.js +0 -88
- package/test/rosetta/default.ts-fixture +0 -1
- package/test/rosetta-translator.test.d.ts +0 -2
- package/test/rosetta-translator.test.js +0 -33
- package/test/rosetta.test.d.ts +0 -2
- package/test/rosetta.test.js +0 -221
- package/test/snippet-selectors.test.d.ts +0 -2
- package/test/snippet-selectors.test.js +0 -57
- package/test/snippet.test.d.ts +0 -2
- package/test/snippet.test.js +0 -18
- package/test/syntax-counter.test.d.ts +0 -2
- package/test/syntax-counter.test.js +0 -60
- package/test/testutil.d.ts +0 -64
- package/test/testutil.js +0 -104
- package/test/translate.test.d.ts +0 -2
- package/test/translate.test.js +0 -175
- package/test/translations/calls/declaring_default_arguments.cs +0 -4
- package/test/translations/calls/declaring_default_arguments.go +0 -6
- package/test/translations/calls/declaring_default_arguments.java +0 -11
- package/test/translations/calls/declaring_default_arguments.py +0 -2
- package/test/translations/calls/default_struct_fields.cs +0 -9
- package/test/translations/calls/default_struct_fields.go +0 -7
- package/test/translations/calls/default_struct_fields.java +0 -21
- package/test/translations/calls/default_struct_fields.py +0 -2
- package/test/translations/calls/function_call.cs +0 -1
- package/test/translations/calls/function_call.go +0 -1
- package/test/translations/calls/function_call.java +0 -1
- package/test/translations/calls/function_call.py +0 -1
- package/test/translations/calls/list_of_anonymous_structs.cs +0 -9
- package/test/translations/calls/list_of_anonymous_structs.go +0 -12
- package/test/translations/calls/list_of_anonymous_structs.java +0 -6
- package/test/translations/calls/list_of_anonymous_structs.py +0 -9
- package/test/translations/calls/literal_map_argument.cs +0 -5
- package/test/translations/calls/literal_map_argument.go +0 -7
- package/test/translations/calls/literal_map_argument.java +0 -4
- package/test/translations/calls/literal_map_argument.py +0 -4
- package/test/translations/calls/method_call.cs +0 -1
- package/test/translations/calls/method_call.go +0 -1
- package/test/translations/calls/method_call.java +0 -1
- package/test/translations/calls/method_call.py +0 -1
- package/test/translations/calls/self_method_call.cs +0 -1
- package/test/translations/calls/self_method_call.go +0 -1
- package/test/translations/calls/self_method_call.java +0 -1
- package/test/translations/calls/self_method_call.py +0 -1
- package/test/translations/calls/shorthand_property.cs +0 -2
- package/test/translations/calls/shorthand_property.go +0 -4
- package/test/translations/calls/shorthand_property.java +0 -2
- package/test/translations/calls/shorthand_property.py +0 -2
- package/test/translations/calls/static_function_call.cs +0 -1
- package/test/translations/calls/static_function_call.go +0 -1
- package/test/translations/calls/static_function_call.java +0 -1
- package/test/translations/calls/static_function_call.py +0 -1
- package/test/translations/calls/this_argument.cs +0 -1
- package/test/translations/calls/this_argument.go +0 -1
- package/test/translations/calls/this_argument.java +0 -1
- package/test/translations/calls/this_argument.py +0 -1
- package/test/translations/calls/translate_object_literals_in_function_call.cs +0 -1
- package/test/translations/calls/translate_object_literals_in_function_call.go +0 -4
- package/test/translations/calls/translate_object_literals_in_function_call.java +0 -1
- package/test/translations/calls/translate_object_literals_in_function_call.py +0 -1
- package/test/translations/calls/translate_object_literals_only_one_level_deep.cs +0 -1
- package/test/translations/calls/translate_object_literals_only_one_level_deep.go +0 -7
- package/test/translations/calls/translate_object_literals_only_one_level_deep.java +0 -1
- package/test/translations/calls/translate_object_literals_only_one_level_deep.py +0 -1
- package/test/translations/calls/translate_object_literals_second_level_with_newlines.cs +0 -4
- package/test/translations/calls/translate_object_literals_second_level_with_newlines.go +0 -7
- package/test/translations/calls/translate_object_literals_second_level_with_newlines.java +0 -3
- package/test/translations/calls/translate_object_literals_second_level_with_newlines.py +0 -4
- package/test/translations/calls/translate_object_literals_with_multiple_newlines.cs +0 -5
- package/test/translations/calls/translate_object_literals_with_multiple_newlines.go +0 -5
- package/test/translations/calls/translate_object_literals_with_multiple_newlines.java +0 -4
- package/test/translations/calls/translate_object_literals_with_multiple_newlines.py +0 -5
- package/test/translations/calls/translate_object_literals_with_newlines.cs +0 -4
- package/test/translations/calls/translate_object_literals_with_newlines.go +0 -4
- package/test/translations/calls/translate_object_literals_with_newlines.java +0 -3
- package/test/translations/calls/translate_object_literals_with_newlines.py +0 -4
- package/test/translations/calls/will_type_deep_structs_directly_if_type_info_is_available.cs +0 -24
- package/test/translations/calls/will_type_deep_structs_directly_if_type_info_is_available.go +0 -24
- package/test/translations/calls/will_type_deep_structs_directly_if_type_info_is_available.java +0 -48
- package/test/translations/calls/will_type_deep_structs_directly_if_type_info_is_available.py +0 -7
- package/test/translations/classes/class_declaration_with_private_fields_and_constructor.cs +0 -9
- package/test/translations/classes/class_declaration_with_private_fields_and_constructor.go +0 -9
- package/test/translations/classes/class_declaration_with_private_fields_and_constructor.java +0 -7
- package/test/translations/classes/class_declaration_with_private_fields_and_constructor.py +0 -4
- package/test/translations/classes/class_declaration_with_public_fields_and_constructor.cs +0 -9
- package/test/translations/classes/class_declaration_with_public_fields_and_constructor.go +0 -9
- package/test/translations/classes/class_declaration_with_public_fields_and_constructor.java +0 -7
- package/test/translations/classes/class_declaration_with_public_fields_and_constructor.py +0 -4
- package/test/translations/classes/class_implementing_jsii_interface.cs +0 -7
- package/test/translations/classes/class_implementing_jsii_interface.go +0 -6
- package/test/translations/classes/class_implementing_jsii_interface.java +0 -5
- package/test/translations/classes/class_implementing_jsii_interface.py +0 -4
- package/test/translations/classes/class_with_different_name.cs +0 -6
- package/test/translations/classes/class_with_different_name.go +0 -7
- package/test/translations/classes/class_with_different_name.java +0 -4
- package/test/translations/classes/class_with_different_name.py +0 -3
- package/test/translations/classes/class_with_extends_and_implements.cs +0 -3
- package/test/translations/classes/class_with_extends_and_implements.go +0 -3
- package/test/translations/classes/class_with_extends_and_implements.java +0 -2
- package/test/translations/classes/class_with_inheritance.cs +0 -3
- package/test/translations/classes/class_with_inheritance.go +0 -3
- package/test/translations/classes/class_with_inheritance.java +0 -2
- package/test/translations/classes/class_with_inheritance.py +0 -2
- package/test/translations/classes/class_with_inheritance_and_super_class.cs +0 -6
- package/test/translations/classes/class_with_inheritance_and_super_class.go +0 -9
- package/test/translations/classes/class_with_inheritance_and_super_class.java +0 -5
- package/test/translations/classes/class_with_inheritance_and_super_class.py +0 -3
- package/test/translations/classes/class_with_method.cs +0 -7
- package/test/translations/classes/class_with_method.go +0 -7
- package/test/translations/classes/class_with_method.java +0 -5
- package/test/translations/classes/class_with_method.py +0 -3
- package/test/translations/classes/class_with_props_argument.cs +0 -14
- package/test/translations/classes/class_with_props_argument.go +0 -16
- package/test/translations/classes/class_with_props_argument.java +0 -26
- package/test/translations/classes/class_with_props_argument.py +0 -5
- package/test/translations/classes/constructor_with_optional_params.go +0 -10
- package/test/translations/classes/constructor_with_optional_params.java +0 -12
- package/test/translations/classes/empty_class.cs +0 -3
- package/test/translations/classes/empty_class.go +0 -2
- package/test/translations/classes/empty_class.java +0 -2
- package/test/translations/classes/empty_class.py +0 -2
- package/test/translations/classes/invisible_interfaces_do_not_affect_whitespace.cs +0 -11
- package/test/translations/classes/invisible_interfaces_do_not_affect_whitespace.go +0 -8
- package/test/translations/classes/invisible_interfaces_do_not_affect_whitespace.java +0 -8
- package/test/translations/classes/invisible_interfaces_do_not_affect_whitespace.py +0 -5
- package/test/translations/classes/whitespace_between_multiple_empty_members.cs +0 -15
- package/test/translations/classes/whitespace_between_multiple_empty_members.go +0 -12
- package/test/translations/classes/whitespace_between_multiple_empty_members.java +0 -11
- package/test/translations/classes/whitespace_between_multiple_empty_members.py +0 -9
- package/test/translations/classes/whitespace_between_multiple_members.cs +0 -17
- package/test/translations/classes/whitespace_between_multiple_members.go +0 -16
- package/test/translations/classes/whitespace_between_multiple_members.java +0 -13
- package/test/translations/classes/whitespace_between_multiple_members.py +0 -9
- package/test/translations/comments/empty_lines_in_comments.cs +0 -4
- package/test/translations/comments/empty_lines_in_comments.go +0 -4
- package/test/translations/comments/empty_lines_in_comments.java +0 -4
- package/test/translations/comments/empty_lines_in_comments.py +0 -4
- package/test/translations/comments/interleave_multiline_comments_with_function_call.cs +0 -7
- package/test/translations/comments/interleave_multiline_comments_with_function_call.go +0 -7
- package/test/translations/comments/interleave_multiline_comments_with_function_call.java +0 -6
- package/test/translations/comments/interleave_multiline_comments_with_function_call.py +0 -7
- package/test/translations/comments/interleave_single_line_comments_with_function_call.cs +0 -7
- package/test/translations/comments/interleave_single_line_comments_with_function_call.go +0 -7
- package/test/translations/comments/interleave_single_line_comments_with_function_call.java +0 -6
- package/test/translations/comments/interleave_single_line_comments_with_function_call.py +0 -7
- package/test/translations/comments/no_duplication_of_comments.cs +0 -2
- package/test/translations/comments/no_duplication_of_comments.go +0 -2
- package/test/translations/comments/no_duplication_of_comments.java +0 -2
- package/test/translations/comments/no_duplication_of_comments.py +0 -2
- package/test/translations/expressions/array_index.cs +0 -3
- package/test/translations/expressions/array_index.go +0 -3
- package/test/translations/expressions/array_index.java +0 -3
- package/test/translations/expressions/array_index.py +0 -3
- package/test/translations/expressions/as_expression.cs +0 -1
- package/test/translations/expressions/as_expression.go +0 -1
- package/test/translations/expressions/as_expression.java +0 -1
- package/test/translations/expressions/as_expression.py +0 -1
- package/test/translations/expressions/await.cs +0 -1
- package/test/translations/expressions/await.go +0 -1
- package/test/translations/expressions/await.java +0 -1
- package/test/translations/expressions/await.py +0 -1
- package/test/translations/expressions/backtick_string_w_o_substitutions.cs +0 -1
- package/test/translations/expressions/backtick_string_w_o_substitutions.go +0 -1
- package/test/translations/expressions/backtick_string_w_o_substitutions.java +0 -1
- package/test/translations/expressions/backtick_string_w_o_substitutions.py +0 -1
- package/test/translations/expressions/computed_key.cs +0 -4
- package/test/translations/expressions/computed_key.go +0 -8
- package/test/translations/expressions/computed_key.java +0 -4
- package/test/translations/expressions/computed_key.py +0 -4
- package/test/translations/expressions/double_quoted_dict_keys.cs +0 -1
- package/test/translations/expressions/double_quoted_dict_keys.go +0 -3
- package/test/translations/expressions/double_quoted_dict_keys.java +0 -1
- package/test/translations/expressions/double_quoted_dict_keys.py +0 -1
- package/test/translations/expressions/ellipsis_at_a_random_place.cs +0 -1
- package/test/translations/expressions/ellipsis_at_a_random_place.go +0 -1
- package/test/translations/expressions/ellipsis_at_a_random_place.java +0 -1
- package/test/translations/expressions/ellipsis_at_a_random_place.py +0 -1
- package/test/translations/expressions/enum_access.cs +0 -1
- package/test/translations/expressions/enum_access.go +0 -1
- package/test/translations/expressions/enum_access.java +0 -1
- package/test/translations/expressions/enum_access.py +0 -1
- package/test/translations/expressions/enum_like_access.cs +0 -1
- package/test/translations/expressions/enum_like_access.go +0 -1
- package/test/translations/expressions/enum_like_access.java +0 -1
- package/test/translations/expressions/enum_like_access.py +0 -1
- package/test/translations/expressions/map-literal.cs +0 -3
- package/test/translations/expressions/map-literal.go +0 -3
- package/test/translations/expressions/map-literal.java +0 -2
- package/test/translations/expressions/map-literal.py +0 -3
- package/test/translations/expressions/non_null_expression.cs +0 -1
- package/test/translations/expressions/non_null_expression.go +0 -1
- package/test/translations/expressions/non_null_expression.java +0 -1
- package/test/translations/expressions/non_null_expression.py +0 -1
- package/test/translations/expressions/string_interpolation.cs +0 -10
- package/test/translations/expressions/string_interpolation.go +0 -6
- package/test/translations/expressions/string_interpolation.java +0 -6
- package/test/translations/expressions/string_interpolation.py +0 -10
- package/test/translations/expressions/string_literal.cs +0 -9
- package/test/translations/expressions/string_literal.go +0 -9
- package/test/translations/expressions/string_literal.java +0 -1
- package/test/translations/expressions/string_literal.py +0 -9
- package/test/translations/expressions/struct_assignment.cs +0 -6
- package/test/translations/expressions/struct_assignment.go +0 -7
- package/test/translations/expressions/struct_assignment.java +0 -12
- package/test/translations/expressions/struct_assignment.py +0 -1
- package/test/translations/expressions/unary_and_binary_operators.cs +0 -3
- package/test/translations/expressions/unary_and_binary_operators.go +0 -3
- package/test/translations/expressions/unary_and_binary_operators.java +0 -3
- package/test/translations/expressions/unary_and_binary_operators.py +0 -3
- package/test/translations/hiding/hide_block_level_statements_using_void_directive.cs +0 -6
- package/test/translations/hiding/hide_block_level_statements_using_void_directive.go +0 -5
- package/test/translations/hiding/hide_block_level_statements_using_void_directive.java +0 -5
- package/test/translations/hiding/hide_block_level_statements_using_void_directive.py +0 -4
- package/test/translations/hiding/hide_expression_with_explicit_ellipsis.cs +0 -1
- package/test/translations/hiding/hide_expression_with_explicit_ellipsis.go +0 -1
- package/test/translations/hiding/hide_expression_with_explicit_ellipsis.java +0 -1
- package/test/translations/hiding/hide_expression_with_explicit_ellipsis.py +0 -1
- package/test/translations/hiding/hide_halfway_into_class_using_comments.cs +0 -3
- package/test/translations/hiding/hide_halfway_into_class_using_comments.go +0 -3
- package/test/translations/hiding/hide_halfway_into_class_using_comments.java +0 -3
- package/test/translations/hiding/hide_halfway_into_class_using_comments.py +0 -3
- package/test/translations/hiding/hide_parameter_sequence.cs +0 -1
- package/test/translations/hiding/hide_parameter_sequence.go +0 -1
- package/test/translations/hiding/hide_parameter_sequence.java +0 -1
- package/test/translations/hiding/hide_parameter_sequence.py +0 -1
- package/test/translations/hiding/hide_statements_with_explicit_ellipsis.cs +0 -3
- package/test/translations/hiding/hide_statements_with_explicit_ellipsis.go +0 -3
- package/test/translations/hiding/hide_statements_with_explicit_ellipsis.java +0 -3
- package/test/translations/hiding/hide_statements_with_explicit_ellipsis.py +0 -3
- package/test/translations/hiding/hide_top_level_statements_using_void_directive.cs +0 -1
- package/test/translations/hiding/hide_top_level_statements_using_void_directive.go +0 -1
- package/test/translations/hiding/hide_top_level_statements_using_void_directive.java +0 -1
- package/test/translations/hiding/hide_top_level_statements_using_void_directive.py +0 -1
- package/test/translations/identifiers/keyword.cs +0 -4
- package/test/translations/identifiers/keyword.go +0 -4
- package/test/translations/identifiers/keyword.java +0 -4
- package/test/translations/identifiers/keyword.py +0 -4
- package/test/translations/imports/import_require.cs +0 -2
- package/test/translations/imports/import_require.go +0 -2
- package/test/translations/imports/import_require.java +0 -2
- package/test/translations/imports/import_require.py +0 -2
- package/test/translations/imports/import_star_as.cs +0 -2
- package/test/translations/imports/import_star_as.go +0 -2
- package/test/translations/imports/import_star_as.java +0 -2
- package/test/translations/imports/import_star_as.py +0 -2
- package/test/translations/imports/multiple-imports.cs +0 -2
- package/test/translations/imports/multiple-imports.go +0 -2
- package/test/translations/imports/multiple-imports.java +0 -3
- package/test/translations/imports/multiple-imports.py +0 -2
- package/test/translations/imports/selective_import.cs +0 -4
- package/test/translations/imports/selective_import.go +0 -3
- package/test/translations/imports/selective_import.java +0 -6
- package/test/translations/imports/selective_import.py +0 -3
- package/test/translations/imports/submodule-import.cs +0 -15
- package/test/translations/imports/submodule-import.go +0 -23
- package/test/translations/imports/submodule-import.java +0 -17
- package/test/translations/imports/submodule-import.py +0 -15
- package/test/translations/interfaces/interface_with_method.cs +0 -4
- package/test/translations/interfaces/interface_with_method.go +0 -3
- package/test/translations/interfaces/interface_with_method.java +0 -3
- package/test/translations/interfaces/interface_with_props.cs +0 -4
- package/test/translations/interfaces/interface_with_props.go +0 -3
- package/test/translations/interfaces/interface_with_props.java +0 -3
- package/test/translations/misc/booleans_render_to_right_primitives.cs +0 -1
- package/test/translations/misc/booleans_render_to_right_primitives.go +0 -1
- package/test/translations/misc/booleans_render_to_right_primitives.java +0 -1
- package/test/translations/misc/booleans_render_to_right_primitives.py +0 -1
- package/test/translations/statements/block_without_braces.cs +0 -1
- package/test/translations/statements/block_without_braces.go +0 -3
- package/test/translations/statements/block_without_braces.java +0 -1
- package/test/translations/statements/block_without_braces.py +0 -1
- package/test/translations/statements/declare_var.cs +0 -1
- package/test/translations/statements/declare_var.go +0 -1
- package/test/translations/statements/declare_var.java +0 -1
- package/test/translations/statements/declare_var.py +0 -1
- package/test/translations/statements/empty_control_block.cs +0 -3
- package/test/translations/statements/empty_control_block.go +0 -1
- package/test/translations/statements/empty_control_block.java +0 -2
- package/test/translations/statements/empty_control_block.py +0 -2
- package/test/translations/statements/for_of_loop.cs +0 -4
- package/test/translations/statements/for_of_loop.go +0 -3
- package/test/translations/statements/for_of_loop.java +0 -3
- package/test/translations/statements/for_of_loop.py +0 -2
- package/test/translations/statements/if.cs +0 -4
- package/test/translations/statements/if.go +0 -3
- package/test/translations/statements/if.java +0 -3
- package/test/translations/statements/if.py +0 -2
- package/test/translations/statements/if_then_else.cs +0 -8
- package/test/translations/statements/if_then_else.go +0 -5
- package/test/translations/statements/if_then_else.java +0 -5
- package/test/translations/statements/if_then_else.py +0 -4
- package/test/translations/statements/initialize_object_literal.cs +0 -5
- package/test/translations/statements/initialize_object_literal.go +0 -8
- package/test/translations/statements/initialize_object_literal.java +0 -4
- package/test/translations/statements/initialize_object_literal.py +0 -5
- package/test/translations/statements/multiline_if_then_else.cs +0 -9
- package/test/translations/statements/multiline_if_then_else.go +0 -6
- package/test/translations/statements/multiline_if_then_else.java +0 -6
- package/test/translations/statements/multiline_if_then_else.py +0 -5
- package/test/translations/statements/statements_and_newlines.cs +0 -26
- package/test/translations/statements/statements_and_newlines.go +0 -21
- package/test/translations/statements/statements_and_newlines.java +0 -21
- package/test/translations/statements/statements_and_newlines.py +0 -16
- package/test/translations/statements/vararg_any_call.cs +0 -7
- package/test/translations/statements/vararg_any_call.go +0 -13
- package/test/translations/statements/vararg_any_call.java +0 -6
- package/test/translations/statements/vararg_any_call.py +0 -6
- package/test/translations/statements/whitespace_between_statements.cs +0 -3
- package/test/translations/statements/whitespace_between_statements.go +0 -3
- package/test/translations/statements/whitespace_between_statements.java +0 -3
- package/test/translations/statements/whitespace_between_statements.py +0 -3
- package/test/translations/statements/whitespace_between_statements_in_a_block.cs +0 -6
- package/test/translations/statements/whitespace_between_statements_in_a_block.go +0 -5
- package/test/translations/statements/whitespace_between_statements_in_a_block.java +0 -5
- package/test/translations/statements/whitespace_between_statements_in_a_block.py +0 -4
- package/test/translations/structs/any_type_never_a_struct.cs +0 -3
- package/test/translations/structs/any_type_never_a_struct.go +0 -3
- package/test/translations/structs/any_type_never_a_struct.java +0 -2
- package/test/translations/structs/any_type_never_a_struct.py +0 -3
- package/test/translations/structs/infer_struct_from_union.cs +0 -6
- package/test/translations/structs/infer_struct_from_union.go +0 -8
- package/test/translations/structs/infer_struct_from_union.java +0 -6
- package/test/translations/structs/infer_struct_from_union.py +0 -6
- package/test/translations/structs/optional_known_struct.cs +0 -3
- package/test/translations/structs/optional_known_struct.go +0 -3
- package/test/translations/structs/optional_known_struct.java +0 -3
- package/test/translations/structs/optional_known_struct.py +0 -3
- package/test/translations/structs/struct_starting_with_i.cs +0 -3
- package/test/translations/structs/struct_starting_with_i.go +0 -3
- package/test/translations/structs/struct_starting_with_i.java +0 -3
- package/test/translations/structs/struct_starting_with_i.py +0 -3
- package/test/translations/structs/var_new_class_known_struct.cs +0 -3
- package/test/translations/structs/var_new_class_known_struct.go +0 -3
- package/test/translations/structs/var_new_class_known_struct.java +0 -3
- package/test/translations/structs/var_new_class_known_struct.py +0 -3
- package/test/translations/structs/var_new_class_unknown_struct.cs +0 -3
- package/test/translations/structs/var_new_class_unknown_struct.go +0 -3
- package/test/translations/structs/var_new_class_unknown_struct.java +0 -3
- package/test/translations/structs/var_new_class_unknown_struct.py +0 -3
- package/test/translations.test.d.ts +0 -9
- package/test/translations.test.js +0 -112
- package/test/util.test.d.ts +0 -2
- package/test/util.test.js +0 -25
- package/vendor/semver-intersect.d.ts +0 -13
package/test/testutil.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Assembly } from '@jsii/spec';
|
|
2
|
-
import { PackageInfo, TestWorkspace } from 'jsii';
|
|
3
|
-
import { SnippetTranslator, SnippetLocation } from '../lib';
|
|
4
|
-
export declare type MultipleSources = {
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
'index.ts': string;
|
|
7
|
-
};
|
|
8
|
-
export interface TestJsiiModuleOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Whether or not to compress the assembly
|
|
11
|
-
*/
|
|
12
|
-
readonly compressAssembly?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Compile a jsii module from source, and produce an environment in which it is available as a module
|
|
16
|
-
*/
|
|
17
|
-
export declare class TestJsiiModule {
|
|
18
|
-
readonly assembly: Assembly;
|
|
19
|
-
readonly workspace: TestWorkspace;
|
|
20
|
-
private readonly compressAssembly;
|
|
21
|
-
static fromSource(source: string | MultipleSources, packageInfo: Partial<PackageInfo> & {
|
|
22
|
-
name: string;
|
|
23
|
-
main?: string;
|
|
24
|
-
types?: string;
|
|
25
|
-
}, options?: TestJsiiModuleOptions): TestJsiiModule;
|
|
26
|
-
readonly moduleDirectory: string;
|
|
27
|
-
readonly workspaceDirectory: string;
|
|
28
|
-
private constructor();
|
|
29
|
-
/**
|
|
30
|
-
* Make a snippet translator for the given source w.r.t this compiled assembly
|
|
31
|
-
*/
|
|
32
|
-
successfullyCompile(source: string): SnippetTranslator;
|
|
33
|
-
translateHere(source: string): import("../lib").TranslatedSnippet;
|
|
34
|
-
/**
|
|
35
|
-
* Update the file to reflect the latest changes to the assembly object.
|
|
36
|
-
*/
|
|
37
|
-
updateAssembly(): void;
|
|
38
|
-
cleanup(): void;
|
|
39
|
-
}
|
|
40
|
-
export declare function testSnippetLocation(fileName: string): SnippetLocation;
|
|
41
|
-
export declare const DUMMY_JSII_CONFIG: {
|
|
42
|
-
targets: {
|
|
43
|
-
dotnet: {
|
|
44
|
-
namespace: string;
|
|
45
|
-
packageId: string;
|
|
46
|
-
};
|
|
47
|
-
go: {
|
|
48
|
-
moduleName: string;
|
|
49
|
-
};
|
|
50
|
-
java: {
|
|
51
|
-
maven: {
|
|
52
|
-
groupId: string;
|
|
53
|
-
artifactId: string;
|
|
54
|
-
};
|
|
55
|
-
package: string;
|
|
56
|
-
};
|
|
57
|
-
python: {
|
|
58
|
-
distName: string;
|
|
59
|
-
module: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export declare function withTemporaryDirectory<T>(callback: (dir: string) => Promise<T>): Promise<T>;
|
|
64
|
-
//# sourceMappingURL=testutil.d.ts.map
|
package/test/testutil.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withTemporaryDirectory = exports.DUMMY_JSII_CONFIG = exports.testSnippetLocation = exports.TestJsiiModule = void 0;
|
|
4
|
-
const spec_1 = require("@jsii/spec");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const jsii_1 = require("jsii");
|
|
7
|
-
const os = require("os");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const lib_1 = require("../lib");
|
|
10
|
-
/**
|
|
11
|
-
* Compile a jsii module from source, and produce an environment in which it is available as a module
|
|
12
|
-
*/
|
|
13
|
-
class TestJsiiModule {
|
|
14
|
-
constructor(assembly, workspace, compressAssembly) {
|
|
15
|
-
this.assembly = assembly;
|
|
16
|
-
this.workspace = workspace;
|
|
17
|
-
this.compressAssembly = compressAssembly;
|
|
18
|
-
this.moduleDirectory = workspace.dependencyDir(assembly.name);
|
|
19
|
-
this.workspaceDirectory = workspace.rootDirectory;
|
|
20
|
-
}
|
|
21
|
-
static fromSource(source, packageInfo, options = {}) {
|
|
22
|
-
const asm = (0, jsii_1.compileJsiiForTest)(source, {
|
|
23
|
-
packageJson: packageInfo,
|
|
24
|
-
compressAssembly: options.compressAssembly,
|
|
25
|
-
});
|
|
26
|
-
const ws = jsii_1.TestWorkspace.create();
|
|
27
|
-
ws.addDependency(asm);
|
|
28
|
-
return new TestJsiiModule(asm.assembly, ws, asm.compressAssembly === true);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Make a snippet translator for the given source w.r.t this compiled assembly
|
|
32
|
-
*/
|
|
33
|
-
successfullyCompile(source) {
|
|
34
|
-
const location = testSnippetLocation('testutil');
|
|
35
|
-
const snippet = (0, lib_1.typeScriptSnippetFromCompleteSource)(source, location, false, {
|
|
36
|
-
[lib_1.SnippetParameters.$COMPILATION_DIRECTORY]: this.workspaceDirectory,
|
|
37
|
-
});
|
|
38
|
-
const ret = new lib_1.SnippetTranslator(snippet, {
|
|
39
|
-
includeCompilerDiagnostics: true,
|
|
40
|
-
});
|
|
41
|
-
if (ret.compileDiagnostics.length > 0) {
|
|
42
|
-
for (const diag of ret.compileDiagnostics.map(lib_1.rosettaDiagFromTypescript)) {
|
|
43
|
-
console.error(diag.formattedMessage);
|
|
44
|
-
}
|
|
45
|
-
throw new Error('Compilation failures');
|
|
46
|
-
}
|
|
47
|
-
return ret;
|
|
48
|
-
}
|
|
49
|
-
translateHere(source) {
|
|
50
|
-
const location = testSnippetLocation('testutil');
|
|
51
|
-
const snip = (0, lib_1.typeScriptSnippetFromCompleteSource)(source.trimLeft(), location, true, {
|
|
52
|
-
[lib_1.SnippetParameters.$COMPILATION_DIRECTORY]: this.workspaceDirectory,
|
|
53
|
-
});
|
|
54
|
-
const trans = new lib_1.Translator(true);
|
|
55
|
-
const ret = trans.translate(snip);
|
|
56
|
-
if (trans.diagnostics.length > 0) {
|
|
57
|
-
for (const diag of trans.diagnostics) {
|
|
58
|
-
console.error(diag.formattedMessage);
|
|
59
|
-
}
|
|
60
|
-
throw new Error('Compilation failures');
|
|
61
|
-
}
|
|
62
|
-
return ret;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Update the file to reflect the latest changes to the assembly object.
|
|
66
|
-
*/
|
|
67
|
-
updateAssembly() {
|
|
68
|
-
(0, spec_1.writeAssembly)(this.moduleDirectory, this.assembly, { compress: this.compressAssembly });
|
|
69
|
-
}
|
|
70
|
-
cleanup() {
|
|
71
|
-
this.workspace.cleanup();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.TestJsiiModule = TestJsiiModule;
|
|
75
|
-
function testSnippetLocation(fileName) {
|
|
76
|
-
return { api: { api: 'file', fileName }, field: { field: 'example' } };
|
|
77
|
-
}
|
|
78
|
-
exports.testSnippetLocation = testSnippetLocation;
|
|
79
|
-
exports.DUMMY_JSII_CONFIG = {
|
|
80
|
-
targets: {
|
|
81
|
-
dotnet: {
|
|
82
|
-
namespace: 'Example.Test.Demo',
|
|
83
|
-
packageId: 'Example.Test.Demo',
|
|
84
|
-
},
|
|
85
|
-
go: { moduleName: 'example.test/demo' },
|
|
86
|
-
java: {
|
|
87
|
-
maven: {
|
|
88
|
-
groupId: 'example.test',
|
|
89
|
-
artifactId: 'demo',
|
|
90
|
-
},
|
|
91
|
-
package: 'example.test.demo',
|
|
92
|
-
},
|
|
93
|
-
python: {
|
|
94
|
-
distName: 'example-test.demo',
|
|
95
|
-
module: 'example_test_demo',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
async function withTemporaryDirectory(callback) {
|
|
100
|
-
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), path.basename(__filename)));
|
|
101
|
-
return callback(tmpdir).finally(() => fs.rmSync(tmpdir, { recursive: true }));
|
|
102
|
-
}
|
|
103
|
-
exports.withTemporaryDirectory = withTemporaryDirectory;
|
|
104
|
-
//# sourceMappingURL=testutil.js.map
|
package/test/translate.test.d.ts
DELETED
package/test/translate.test.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../lib");
|
|
4
|
-
const visualize_1 = require("../lib/languages/visualize");
|
|
5
|
-
const key_1 = require("../lib/tablets/key");
|
|
6
|
-
const testutil_1 = require("./testutil");
|
|
7
|
-
const location = {
|
|
8
|
-
api: { api: 'moduleReadme', moduleFqn: '@aws-cdk/aws-apigateway' },
|
|
9
|
-
field: { field: 'example' },
|
|
10
|
-
};
|
|
11
|
-
test('does not fail on "Debug Failure"', () => {
|
|
12
|
-
// GIVEN
|
|
13
|
-
const snippet = {
|
|
14
|
-
completeSource: 'Missing literate source file test/integ.restapi-import.lit.ts',
|
|
15
|
-
location,
|
|
16
|
-
visibleSource: "import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from '@aws-cdk/core';\nimport { Construct } from 'constructs';\nimport { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from '../lib';\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then…;\n\n readonly methods?: Method[];\n}\n\nclass DeployStack extends NestedStack {\n constructor(scope: Construct, props: DeployStackProps) {\n super(scope, 'integ-restapi-import-DeployStack', props);\n\n const deployment = new Deployment(this, 'Deployment', {\n api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId),\n });\n (props.methods ?? []).forEach((method) => deployment.node.addDependency(method));\n new Stage(this, 'Stage', { deployment });\n }\n}\n\nnew RootStack(new App());",
|
|
17
|
-
parameters: { lit: 'test/integ.restapi-import.lit.ts' },
|
|
18
|
-
strict: false,
|
|
19
|
-
};
|
|
20
|
-
// WHEN
|
|
21
|
-
const subject = new lib_1.SnippetTranslator(snippet, {
|
|
22
|
-
includeCompilerDiagnostics: true,
|
|
23
|
-
});
|
|
24
|
-
// THEN
|
|
25
|
-
expect(subject.renderUsing(new visualize_1.VisualizeAstVisitor())).toMatchInlineSnapshot(`
|
|
26
|
-
"(ExpressionStatement Missing
|
|
27
|
-
(Identifier Missing))(ExpressionStatement literate
|
|
28
|
-
(Identifier literate))(ExpressionStatement source
|
|
29
|
-
(Identifier source))(ExpressionStatement file
|
|
30
|
-
(Identifier file))(ExpressionStatement test/integ.restapi-import.lit.ts
|
|
31
|
-
(BinaryExpression test/integ.restapi-import.lit.ts
|
|
32
|
-
(BinaryExpression test/integ.restapi
|
|
33
|
-
(Identifier test)
|
|
34
|
-
(SlashToken /)
|
|
35
|
-
(PropertyAccessExpression integ.restapi
|
|
36
|
-
(Identifier integ)
|
|
37
|
-
(Identifier restapi)))
|
|
38
|
-
(MinusToken -)
|
|
39
|
-
(PropertyAccessExpression import.lit.ts
|
|
40
|
-
import.lit
|
|
41
|
-
(Identifier ts))))"
|
|
42
|
-
`);
|
|
43
|
-
});
|
|
44
|
-
test('rejects ?? operator', () => {
|
|
45
|
-
const snippet = {
|
|
46
|
-
completeSource: 'const x = false ?? true;',
|
|
47
|
-
location,
|
|
48
|
-
visibleSource: 'const x = false ?? true;',
|
|
49
|
-
parameters: { lit: 'test/integ.restapi-import.lit.ts' },
|
|
50
|
-
strict: false,
|
|
51
|
-
};
|
|
52
|
-
// WHEN
|
|
53
|
-
const subject = new lib_1.SnippetTranslator(snippet, {
|
|
54
|
-
includeCompilerDiagnostics: true,
|
|
55
|
-
});
|
|
56
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
57
|
-
expect(subject.diagnostics[0].messageText).toContain('QuestionQuestionToken');
|
|
58
|
-
});
|
|
59
|
-
test('rejects function declarations in object literals', () => {
|
|
60
|
-
const snippet = {
|
|
61
|
-
completeSource: 'const x = { method() { return 1; } }',
|
|
62
|
-
location,
|
|
63
|
-
visibleSource: 'const x = { method() { return 1; } }',
|
|
64
|
-
parameters: { lit: 'test/integ.restapi-import.lit.ts' },
|
|
65
|
-
strict: false,
|
|
66
|
-
};
|
|
67
|
-
// WHEN
|
|
68
|
-
const subject = new lib_1.SnippetTranslator(snippet, {
|
|
69
|
-
includeCompilerDiagnostics: true,
|
|
70
|
-
});
|
|
71
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
72
|
-
expect(subject.diagnostics[0].messageText).toContain('Use of MethodDeclaration in an object literal is not supported');
|
|
73
|
-
});
|
|
74
|
-
test('completeSource does not impact the snippet key', () => {
|
|
75
|
-
const snippet1 = {
|
|
76
|
-
visibleSource: '// hello',
|
|
77
|
-
location: { api: { api: 'member', fqn: 'my.class', memberName: 'member1' } },
|
|
78
|
-
completeSource: '// i do not like to say\n// hello',
|
|
79
|
-
};
|
|
80
|
-
const snippet2 = {
|
|
81
|
-
...snippet1,
|
|
82
|
-
completeSource: undefined,
|
|
83
|
-
};
|
|
84
|
-
expect((0, key_1.snippetKey)(snippet1)).toEqual((0, key_1.snippetKey)(snippet2));
|
|
85
|
-
});
|
|
86
|
-
test('Snippets from different locations have different keys', () => {
|
|
87
|
-
const visibleSource = 'console.log("banana");';
|
|
88
|
-
const snippet1 = {
|
|
89
|
-
visibleSource,
|
|
90
|
-
location: { api: { api: 'member', fqn: 'my.class', memberName: 'member1' } },
|
|
91
|
-
};
|
|
92
|
-
const snippet2 = {
|
|
93
|
-
visibleSource,
|
|
94
|
-
location: { api: { api: 'type', fqn: 'my.class' } },
|
|
95
|
-
};
|
|
96
|
-
expect((0, key_1.snippetKey)(snippet1)).not.toEqual((0, key_1.snippetKey)(snippet2));
|
|
97
|
-
});
|
|
98
|
-
test('didSuccessfullyCompile is true when compilation is attempted', () => {
|
|
99
|
-
const visibleSource = 'console.log("banana");';
|
|
100
|
-
const snippet = {
|
|
101
|
-
visibleSource,
|
|
102
|
-
location: { api: { api: 'type', fqn: 'my.class' } },
|
|
103
|
-
};
|
|
104
|
-
// WHEN
|
|
105
|
-
const subject = new lib_1.SnippetTranslator(snippet, {
|
|
106
|
-
includeCompilerDiagnostics: true,
|
|
107
|
-
});
|
|
108
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
109
|
-
expect(subject.didSuccessfullyCompile).toBeTruthy();
|
|
110
|
-
});
|
|
111
|
-
test('didSuccessfullyCompile is undefined when compilation is not attempted', () => {
|
|
112
|
-
const visibleSource = 'console.log("banana");';
|
|
113
|
-
const snippet = {
|
|
114
|
-
visibleSource,
|
|
115
|
-
location: { api: { api: 'type', fqn: 'my.class' } },
|
|
116
|
-
};
|
|
117
|
-
// WHEN
|
|
118
|
-
const subject = new lib_1.SnippetTranslator(snippet);
|
|
119
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
120
|
-
expect(subject.didSuccessfullyCompile).toBeUndefined();
|
|
121
|
-
});
|
|
122
|
-
test('refuse to translate object literal with function member', () => {
|
|
123
|
-
const visibleSource = 'const x: any = { mem: () => 42 };';
|
|
124
|
-
const snippet = {
|
|
125
|
-
visibleSource,
|
|
126
|
-
location: { api: { api: 'type', fqn: 'my.class' } },
|
|
127
|
-
};
|
|
128
|
-
// WHEN
|
|
129
|
-
const subject = new lib_1.SnippetTranslator(snippet);
|
|
130
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
131
|
-
expect(subject.diagnostics).toContainEqual(expect.objectContaining({
|
|
132
|
-
messageText: expect.stringMatching(/You cannot use an object literal/),
|
|
133
|
-
}));
|
|
134
|
-
});
|
|
135
|
-
test('refuse to translate object literal with function member in shorthand property', () => {
|
|
136
|
-
const visibleSource = 'const mem = () => 42; const x: any = { mem };';
|
|
137
|
-
const snippet = {
|
|
138
|
-
visibleSource,
|
|
139
|
-
location: { api: { api: 'type', fqn: 'my.class' } },
|
|
140
|
-
};
|
|
141
|
-
// WHEN
|
|
142
|
-
const subject = new lib_1.SnippetTranslator(snippet);
|
|
143
|
-
subject.renderUsing(new lib_1.PythonVisitor());
|
|
144
|
-
expect(subject.diagnostics).toContainEqual(expect.objectContaining({
|
|
145
|
-
messageText: expect.stringMatching(/You cannot use an object literal/),
|
|
146
|
-
}));
|
|
147
|
-
});
|
|
148
|
-
test('declarations are translated correctly in all jsii languages', () => {
|
|
149
|
-
// Create an assembly in a temp directory
|
|
150
|
-
const assembly = testutil_1.TestJsiiModule.fromSource({
|
|
151
|
-
'index.ts': `
|
|
152
|
-
export class ClassA {
|
|
153
|
-
public someMethod() {
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
export class ClassB {
|
|
157
|
-
public anotherMethod() {
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
`,
|
|
161
|
-
}, {
|
|
162
|
-
name: 'my_assembly',
|
|
163
|
-
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
164
|
-
});
|
|
165
|
-
try {
|
|
166
|
-
const ts = assembly.translateHere(["import * as masm from 'my_assembly';", 'declare const classA: masm.ClassA;'].join('\n'));
|
|
167
|
-
expect(ts.get(lib_1.TargetLanguage.PYTHON)?.source).toEqual(['import example_test_demo as masm', '# class_a: masm.ClassA'].join('\n'));
|
|
168
|
-
expect(ts.get(lib_1.TargetLanguage.JAVA)?.source).toEqual(['import example.test.demo.*;', 'ClassA classA;'].join('\n'));
|
|
169
|
-
expect(ts.get(lib_1.TargetLanguage.CSHARP)?.source).toEqual(['using Example.Test.Demo;', 'ClassA classA;'].join('\n'));
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
assembly.cleanup();
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
//# sourceMappingURL=translate.test.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
public class Struct {
|
|
2
|
-
private String x;
|
|
3
|
-
public String getX() {
|
|
4
|
-
return this.x;
|
|
5
|
-
}
|
|
6
|
-
public Struct x(String x) {
|
|
7
|
-
this.x = x;
|
|
8
|
-
return this;
|
|
9
|
-
}
|
|
10
|
-
private String y;
|
|
11
|
-
public String getY() {
|
|
12
|
-
return this.y;
|
|
13
|
-
}
|
|
14
|
-
public Struct y(String y) {
|
|
15
|
-
this.y = y;
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
public void foo(Struct s) {
|
|
20
|
-
System.out.println(s.getX() + s.getY());
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CallSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
callSomeFunction(jsii.Number(1), jsii.Number(2), jsii.Number(3))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
callSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
call_some_function(1, 2, 3)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
someObject.CallSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
someObject.callSomeFunction(jsii.Number(1), jsii.Number(2), jsii.Number(3))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
someObject.callSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
some_object.call_some_function(1, 2, 3)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CallSomeFunction(25);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
this.callSomeFunction(jsii.Number(25))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
this.callSomeFunction(25);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.call_some_function(25)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
SomeObject.CallSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
someObject_CallSomeFunction(jsii.Number(1), jsii.Number(2), jsii.Number(3))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
SomeObject.callSomeFunction(1, 2, 3);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
SomeObject.call_some_function(1, 2, 3)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
CallSomeFunction(this, 25);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
callSomeFunction(this, jsii.Number(25))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
callSomeFunction(this, 25);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
call_some_function(self, 25)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Foo(25, new Struct { Foo = 3, Banana = "hello" });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
foo(25, Map.of("foo", 3, "banana", "hello"));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
foo(25, foo=3, banana="hello")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Foo(25, new Struct { Foo = 3, Deeper = new Struct { A = 1, B = 2 } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
foo(25, Map.of("foo", 3, "deeper", Map.of("a", 1, "b", 2)));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
foo(25, foo=3, deeper={"a": 1, "b": 2})
|