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
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Test translation of imports with actual jsii assemblies
|
|
3
|
-
//
|
|
4
|
-
// - For Python, there is a lot of variation in what imports get translated to (mirroring
|
|
5
|
-
// the style in TypeScript, occasionally adding extra imports as required).
|
|
6
|
-
// - For other languages, we'll mostly translate the same thing.
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const lib_1 = require("../lib");
|
|
9
|
-
const testutil_1 = require("./testutil");
|
|
10
|
-
describe('no submodule', () => {
|
|
11
|
-
describe('top-level struct', () => {
|
|
12
|
-
let module;
|
|
13
|
-
beforeAll(() => {
|
|
14
|
-
module = makeJsiiModule({ withModule: false, nestedStruct: false });
|
|
15
|
-
});
|
|
16
|
-
afterAll(() => module.cleanup());
|
|
17
|
-
describe('package import', () => {
|
|
18
|
-
let trans;
|
|
19
|
-
beforeAll(() => {
|
|
20
|
-
trans = module.translateHere(`
|
|
21
|
-
import * as masm from 'my_assembly';
|
|
22
|
-
const obj = new masm.MyClass('value', {
|
|
23
|
-
myStruct: {
|
|
24
|
-
value: 'v',
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
`);
|
|
28
|
-
});
|
|
29
|
-
test('to Python', () => {
|
|
30
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
31
|
-
'import example_test_demo as masm',
|
|
32
|
-
'obj = masm.MyClass("value",',
|
|
33
|
-
' my_struct=masm.MyStruct(',
|
|
34
|
-
' value="v"',
|
|
35
|
-
' )',
|
|
36
|
-
')',
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
test('to Java', () => {
|
|
40
|
-
// eslint-disable-next-line prettier/prettier
|
|
41
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
42
|
-
'import example.test.demo.*;',
|
|
43
|
-
...DEFAULT_JAVA_CODE,
|
|
44
|
-
]);
|
|
45
|
-
});
|
|
46
|
-
test('to C#', () => {
|
|
47
|
-
// eslint-disable-next-line prettier/prettier
|
|
48
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
49
|
-
'using Example.Test.Demo;',
|
|
50
|
-
...DEFAULT_CSHARP_CODE,
|
|
51
|
-
]);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('class import', () => {
|
|
55
|
-
let trans;
|
|
56
|
-
beforeAll(() => {
|
|
57
|
-
trans = module.translateHere(`import { MyClass } from 'my_assembly';
|
|
58
|
-
const obj = new MyClass('value', {
|
|
59
|
-
myStruct: {
|
|
60
|
-
value: 'v',
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
`);
|
|
64
|
-
});
|
|
65
|
-
test('to Python', () => {
|
|
66
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
67
|
-
'from example_test_demo import MyStruct',
|
|
68
|
-
'from example_test_demo import MyClass',
|
|
69
|
-
'obj = MyClass("value",',
|
|
70
|
-
' my_struct=MyStruct(',
|
|
71
|
-
' value="v"',
|
|
72
|
-
' )',
|
|
73
|
-
')',
|
|
74
|
-
]);
|
|
75
|
-
});
|
|
76
|
-
test('to Java', () => {
|
|
77
|
-
// eslint-disable-next-line prettier/prettier
|
|
78
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
79
|
-
'import example.test.demo.MyClass;',
|
|
80
|
-
...DEFAULT_JAVA_CODE,
|
|
81
|
-
]);
|
|
82
|
-
});
|
|
83
|
-
test('to C#', () => {
|
|
84
|
-
// eslint-disable-next-line prettier/prettier
|
|
85
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
86
|
-
'using Example.Test.Demo;',
|
|
87
|
-
...DEFAULT_CSHARP_CODE,
|
|
88
|
-
]);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
describe('nested struct', () => {
|
|
93
|
-
let module;
|
|
94
|
-
beforeAll(() => {
|
|
95
|
-
module = makeJsiiModule({ withModule: false, nestedStruct: true });
|
|
96
|
-
});
|
|
97
|
-
afterAll(() => module.cleanup());
|
|
98
|
-
describe('package import', () => {
|
|
99
|
-
let trans;
|
|
100
|
-
beforeAll(() => {
|
|
101
|
-
trans = module.translateHere(`
|
|
102
|
-
import * as masm from 'my_assembly';
|
|
103
|
-
const obj = new masm.MyClass('value', {
|
|
104
|
-
myStruct: {
|
|
105
|
-
value: 'v',
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
`);
|
|
109
|
-
});
|
|
110
|
-
test('to Python', () => {
|
|
111
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
112
|
-
'import example_test_demo as masm',
|
|
113
|
-
'obj = masm.MyClass("value",',
|
|
114
|
-
' my_struct=masm.MyClass.MyStruct(',
|
|
115
|
-
' value="v"',
|
|
116
|
-
' )',
|
|
117
|
-
')',
|
|
118
|
-
]);
|
|
119
|
-
});
|
|
120
|
-
test('to Java', () => {
|
|
121
|
-
// eslint-disable-next-line prettier/prettier
|
|
122
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
123
|
-
'import example.test.demo.*;',
|
|
124
|
-
...DEFAULT_JAVA_CODE,
|
|
125
|
-
]);
|
|
126
|
-
});
|
|
127
|
-
test('to C#', () => {
|
|
128
|
-
// eslint-disable-next-line prettier/prettier
|
|
129
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
130
|
-
'using Example.Test.Demo;',
|
|
131
|
-
...DEFAULT_CSHARP_CODE,
|
|
132
|
-
]);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
describe('class import', () => {
|
|
136
|
-
let trans;
|
|
137
|
-
beforeAll(() => {
|
|
138
|
-
trans = module.translateHere(`
|
|
139
|
-
import { MyClass } from 'my_assembly';
|
|
140
|
-
const obj = new MyClass('value', {
|
|
141
|
-
myStruct: {
|
|
142
|
-
value: 'v',
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
`);
|
|
146
|
-
});
|
|
147
|
-
test('to Python', () => {
|
|
148
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
149
|
-
'from example_test_demo import MyClass',
|
|
150
|
-
'obj = MyClass("value",',
|
|
151
|
-
' my_struct=MyClass.MyStruct(',
|
|
152
|
-
' value="v"',
|
|
153
|
-
' )',
|
|
154
|
-
')',
|
|
155
|
-
]);
|
|
156
|
-
});
|
|
157
|
-
test('to Java', () => {
|
|
158
|
-
// eslint-disable-next-line prettier/prettier
|
|
159
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
160
|
-
'import example.test.demo.MyClass;',
|
|
161
|
-
...DEFAULT_JAVA_CODE,
|
|
162
|
-
]);
|
|
163
|
-
});
|
|
164
|
-
test('to C#', () => {
|
|
165
|
-
// eslint-disable-next-line prettier/prettier
|
|
166
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
167
|
-
'using Example.Test.Demo;',
|
|
168
|
-
...DEFAULT_CSHARP_CODE,
|
|
169
|
-
]);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
describe('enum', () => {
|
|
174
|
-
let module;
|
|
175
|
-
beforeAll(() => {
|
|
176
|
-
module = testutil_1.TestJsiiModule.fromSource({
|
|
177
|
-
'index.ts': `export enum MyEnum { OPTION_A = 'a', OPTION_B = 'b' }
|
|
178
|
-
|
|
179
|
-
export interface MyProps { readonly prop: MyEnum }
|
|
180
|
-
|
|
181
|
-
export function myFun(props: MyProps) {
|
|
182
|
-
Array.isArray(props);
|
|
183
|
-
}
|
|
184
|
-
`,
|
|
185
|
-
}, {
|
|
186
|
-
name: 'my_assembly',
|
|
187
|
-
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
afterAll(() => module.cleanup());
|
|
191
|
-
describe('package import', () => {
|
|
192
|
-
let trans;
|
|
193
|
-
beforeAll(() => {
|
|
194
|
-
trans = module.translateHere(`
|
|
195
|
-
import * as masm from 'my_assembly';
|
|
196
|
-
const x = masm.MyEnum.OPTION_A;
|
|
197
|
-
`);
|
|
198
|
-
});
|
|
199
|
-
test('to Python', () => {
|
|
200
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
201
|
-
'import example_test_demo as masm',
|
|
202
|
-
'x = masm.MyEnum.OPTION_A',
|
|
203
|
-
]);
|
|
204
|
-
});
|
|
205
|
-
test('to Java', () => {
|
|
206
|
-
// eslint-disable-next-line prettier/prettier
|
|
207
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
208
|
-
'import example.test.demo.*;',
|
|
209
|
-
'MyEnum x = MyEnum.OPTION_A;',
|
|
210
|
-
]);
|
|
211
|
-
});
|
|
212
|
-
test('to C#', () => {
|
|
213
|
-
// eslint-disable-next-line prettier/prettier
|
|
214
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
215
|
-
'using Example.Test.Demo;',
|
|
216
|
-
'var x = MyEnum.OPTION_A;',
|
|
217
|
-
]);
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
describe('direct import', () => {
|
|
221
|
-
let trans;
|
|
222
|
-
beforeAll(() => {
|
|
223
|
-
trans = module.translateHere(`import { MyEnum } from 'my_assembly';
|
|
224
|
-
const x = MyEnum.OPTION_A;
|
|
225
|
-
`);
|
|
226
|
-
});
|
|
227
|
-
test('to Python', () => {
|
|
228
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
229
|
-
'from example_test_demo import MyEnum',
|
|
230
|
-
'x = MyEnum.OPTION_A',
|
|
231
|
-
]);
|
|
232
|
-
});
|
|
233
|
-
test('to Java', () => {
|
|
234
|
-
// eslint-disable-next-line prettier/prettier
|
|
235
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
236
|
-
'import example.test.demo.MyEnum;',
|
|
237
|
-
'MyEnum x = MyEnum.OPTION_A;',
|
|
238
|
-
]);
|
|
239
|
-
});
|
|
240
|
-
test('to C#', () => {
|
|
241
|
-
// eslint-disable-next-line prettier/prettier
|
|
242
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
243
|
-
'using Example.Test.Demo;',
|
|
244
|
-
'var x = MyEnum.OPTION_A;',
|
|
245
|
-
]);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
describe('implicit import', () => {
|
|
249
|
-
let trans;
|
|
250
|
-
beforeAll(() => {
|
|
251
|
-
trans = module.translateHere(`import * as masm from 'my_assembly';
|
|
252
|
-
masm.myFun({ prop: masm.MyEnum.OPTION_A });
|
|
253
|
-
`);
|
|
254
|
-
});
|
|
255
|
-
test('to Python', () => {
|
|
256
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
257
|
-
'import example_test_demo as masm',
|
|
258
|
-
'masm.my_fun(prop=masm.MyEnum.OPTION_A)',
|
|
259
|
-
]);
|
|
260
|
-
});
|
|
261
|
-
test('to Java', () => {
|
|
262
|
-
// eslint-disable-next-line prettier/prettier
|
|
263
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
264
|
-
'import example.test.demo.*;',
|
|
265
|
-
'myFun(MyProps.builder().prop(MyEnum.OPTION_A).build());',
|
|
266
|
-
]);
|
|
267
|
-
});
|
|
268
|
-
test('to C#', () => {
|
|
269
|
-
// eslint-disable-next-line prettier/prettier
|
|
270
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
271
|
-
'using Example.Test.Demo;',
|
|
272
|
-
'MyFun(new MyProps { Prop = MyEnum.OPTION_A });',
|
|
273
|
-
]);
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
describe('with submodule', () => {
|
|
279
|
-
describe('top-level struct', () => {
|
|
280
|
-
let module;
|
|
281
|
-
beforeAll(() => {
|
|
282
|
-
module = makeJsiiModule({ withModule: true, nestedStruct: false });
|
|
283
|
-
});
|
|
284
|
-
afterAll(() => module.cleanup());
|
|
285
|
-
describe('namespace import', () => {
|
|
286
|
-
let trans;
|
|
287
|
-
beforeAll(() => {
|
|
288
|
-
trans = module.translateHere(`
|
|
289
|
-
import { submod as mod } from 'my_assembly';
|
|
290
|
-
const obj = new mod.MyClass('value', {
|
|
291
|
-
myStruct: {
|
|
292
|
-
value: 'v',
|
|
293
|
-
},
|
|
294
|
-
});
|
|
295
|
-
`);
|
|
296
|
-
});
|
|
297
|
-
test('to Python', () => {
|
|
298
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
299
|
-
'from example_test_demo import boop as mod',
|
|
300
|
-
'obj = mod.MyClass("value",',
|
|
301
|
-
' my_struct=mod.MyStruct(',
|
|
302
|
-
' value="v"',
|
|
303
|
-
' )',
|
|
304
|
-
')',
|
|
305
|
-
]);
|
|
306
|
-
});
|
|
307
|
-
test('to Java', () => {
|
|
308
|
-
// eslint-disable-next-line prettier/prettier
|
|
309
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
310
|
-
'import example.test.demo.boop.*;',
|
|
311
|
-
...DEFAULT_JAVA_CODE,
|
|
312
|
-
]);
|
|
313
|
-
});
|
|
314
|
-
test('to C#', () => {
|
|
315
|
-
// eslint-disable-next-line prettier/prettier
|
|
316
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
317
|
-
'using Example.Test.Demo.Boop;',
|
|
318
|
-
...DEFAULT_CSHARP_CODE,
|
|
319
|
-
]);
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
describe('nested struct', () => {
|
|
324
|
-
let module;
|
|
325
|
-
beforeAll(() => {
|
|
326
|
-
module = makeJsiiModule({ withModule: true, nestedStruct: true });
|
|
327
|
-
});
|
|
328
|
-
afterAll(() => module.cleanup());
|
|
329
|
-
describe('namespace import', () => {
|
|
330
|
-
let trans;
|
|
331
|
-
beforeAll(() => {
|
|
332
|
-
trans = module.translateHere(`
|
|
333
|
-
import { submod as mod } from 'my_assembly';
|
|
334
|
-
const obj = new mod.MyClass('value', {
|
|
335
|
-
myStruct: {
|
|
336
|
-
value: 'v',
|
|
337
|
-
},
|
|
338
|
-
});
|
|
339
|
-
`);
|
|
340
|
-
});
|
|
341
|
-
test('to Python', () => {
|
|
342
|
-
expectTranslation(trans, lib_1.TargetLanguage.PYTHON, [
|
|
343
|
-
'from example_test_demo import boop as mod',
|
|
344
|
-
'obj = mod.MyClass("value",',
|
|
345
|
-
' my_struct=mod.MyClass.MyStruct(',
|
|
346
|
-
' value="v"',
|
|
347
|
-
' )',
|
|
348
|
-
')',
|
|
349
|
-
]);
|
|
350
|
-
});
|
|
351
|
-
test('to Java', () => {
|
|
352
|
-
// eslint-disable-next-line prettier/prettier
|
|
353
|
-
expectTranslation(trans, lib_1.TargetLanguage.JAVA, [
|
|
354
|
-
'import example.test.demo.boop.*;',
|
|
355
|
-
...DEFAULT_JAVA_CODE,
|
|
356
|
-
]);
|
|
357
|
-
});
|
|
358
|
-
test('to C#', () => {
|
|
359
|
-
// eslint-disable-next-line prettier/prettier
|
|
360
|
-
expectTranslation(trans, lib_1.TargetLanguage.CSHARP, [
|
|
361
|
-
'using Example.Test.Demo.Boop;',
|
|
362
|
-
...DEFAULT_CSHARP_CODE,
|
|
363
|
-
]);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
function makeJsiiModule(options) {
|
|
369
|
-
const nsRef = options.nestedStruct ? 'MyClass.' : '';
|
|
370
|
-
const nsDeclBegin = options.nestedStruct ? 'export namespace MyClass {\n' : '';
|
|
371
|
-
const nsDeclEnd = options.nestedStruct ? '}' : '';
|
|
372
|
-
const payload = `
|
|
373
|
-
export class MyClass {
|
|
374
|
-
constructor(value: string, props: ${nsRef}MyClassProps) {
|
|
375
|
-
Array.isArray(value);
|
|
376
|
-
Array.isArray(props);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
${nsDeclBegin}
|
|
381
|
-
export interface MyClassProps {
|
|
382
|
-
readonly myStruct: MyStruct;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
export interface MyStruct {
|
|
386
|
-
readonly value: string;
|
|
387
|
-
}
|
|
388
|
-
${nsDeclEnd}
|
|
389
|
-
`;
|
|
390
|
-
const source = options.withModule
|
|
391
|
-
? {
|
|
392
|
-
'index.ts': 'export * as submod from "./submodule/module";',
|
|
393
|
-
'submodule/module.ts': payload,
|
|
394
|
-
'submodule/.jsiirc.json': JSON.stringify({
|
|
395
|
-
targets: {
|
|
396
|
-
python: {
|
|
397
|
-
module: 'example_test_demo.boop',
|
|
398
|
-
},
|
|
399
|
-
java: {
|
|
400
|
-
package: 'example.test.demo.boop',
|
|
401
|
-
},
|
|
402
|
-
dotnet: {
|
|
403
|
-
namespace: 'Example.Test.Demo.Boop',
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
}),
|
|
407
|
-
}
|
|
408
|
-
: {
|
|
409
|
-
'index.ts': payload,
|
|
410
|
-
};
|
|
411
|
-
return testutil_1.TestJsiiModule.fromSource(source, {
|
|
412
|
-
name: 'my_assembly',
|
|
413
|
-
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
// The implementation part of the Java code is always the same
|
|
417
|
-
const DEFAULT_JAVA_CODE = [
|
|
418
|
-
'MyClass obj = MyClass.Builder.create("value")',
|
|
419
|
-
' .myStruct(MyStruct.builder()',
|
|
420
|
-
' .value("v")',
|
|
421
|
-
' .build())',
|
|
422
|
-
' .build();',
|
|
423
|
-
];
|
|
424
|
-
// The implementation part of the CSharp code is always the same
|
|
425
|
-
const DEFAULT_CSHARP_CODE = [
|
|
426
|
-
'var obj = new MyClass("value", new MyClassProps {',
|
|
427
|
-
' MyStruct = new MyStruct {',
|
|
428
|
-
' Value = "v"',
|
|
429
|
-
' }',
|
|
430
|
-
'});',
|
|
431
|
-
];
|
|
432
|
-
/**
|
|
433
|
-
* Verify the output in the given language. All expected outputs look the same.
|
|
434
|
-
*/
|
|
435
|
-
function expectTranslation(trans, lang, expected) {
|
|
436
|
-
expect(trans.get(lang)?.source.split('\n')).toEqual(expected);
|
|
437
|
-
}
|
|
438
|
-
//# sourceMappingURL=jsii-imports.test.js.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const lib_1 = require("../../lib");
|
|
4
|
-
const DEBUG = false;
|
|
5
|
-
test('inserts paragraph breaks between text but not code samples', () => {
|
|
6
|
-
expectOutput(`
|
|
7
|
-
# Hello
|
|
8
|
-
|
|
9
|
-
Here's a paragraph.
|
|
10
|
-
|
|
11
|
-
Here's one more.
|
|
12
|
-
|
|
13
|
-
` +
|
|
14
|
-
'```' +
|
|
15
|
-
`
|
|
16
|
-
some_code();
|
|
17
|
-
|
|
18
|
-
with_newlines();
|
|
19
|
-
` +
|
|
20
|
-
'```' +
|
|
21
|
-
`
|
|
22
|
-
Some more text here.
|
|
23
|
-
`, `
|
|
24
|
-
<h1>Hello</h1>
|
|
25
|
-
<p>
|
|
26
|
-
Here's a paragraph.
|
|
27
|
-
<p>
|
|
28
|
-
Here's one more.
|
|
29
|
-
<p>
|
|
30
|
-
<blockquote><pre>
|
|
31
|
-
some_code();
|
|
32
|
-
|
|
33
|
-
with_newlines();
|
|
34
|
-
</pre></blockquote>
|
|
35
|
-
<p>
|
|
36
|
-
Some more text here.
|
|
37
|
-
`);
|
|
38
|
-
});
|
|
39
|
-
test('common formatting tags', () => {
|
|
40
|
-
expectOutput(`
|
|
41
|
-
# Hello
|
|
42
|
-
## Bye
|
|
43
|
-
|
|
44
|
-
This is *very* **cool**.
|
|
45
|
-
|
|
46
|
-
* Yes
|
|
47
|
-
* Really
|
|
48
|
-
`, `
|
|
49
|
-
<h1>Hello</h1>
|
|
50
|
-
<p>
|
|
51
|
-
<h2>Bye</h2>
|
|
52
|
-
<p>
|
|
53
|
-
This is <em>very</em> <strong>cool</strong>.
|
|
54
|
-
<p>
|
|
55
|
-
<ul>
|
|
56
|
-
<li>Yes</li>
|
|
57
|
-
<li>Really</li>
|
|
58
|
-
</ul>
|
|
59
|
-
`);
|
|
60
|
-
});
|
|
61
|
-
test('special characters are escaped', () => {
|
|
62
|
-
expectOutput(`
|
|
63
|
-
Escape this & and this < and this > and also @
|
|
64
|
-
|
|
65
|
-
` +
|
|
66
|
-
'```' +
|
|
67
|
-
`
|
|
68
|
-
if (x < 3) {
|
|
69
|
-
System.Console.WriteLn("bloep");
|
|
70
|
-
}
|
|
71
|
-
` +
|
|
72
|
-
'```', `
|
|
73
|
-
Escape this & and this < and this > and also @
|
|
74
|
-
<p>
|
|
75
|
-
<blockquote><pre>
|
|
76
|
-
if (x < 3) {
|
|
77
|
-
System.Console.WriteLn("bloep");
|
|
78
|
-
}
|
|
79
|
-
</pre></blockquote>
|
|
80
|
-
`);
|
|
81
|
-
});
|
|
82
|
-
test('doc comment closing chars are escaped', () => {
|
|
83
|
-
expectOutput(['Escape this */', '```', 'And this */', '```'].join('\n'), `
|
|
84
|
-
Escape this */
|
|
85
|
-
<p>
|
|
86
|
-
<blockquote><pre>
|
|
87
|
-
And this */
|
|
88
|
-
</pre></blockquote>
|
|
89
|
-
`);
|
|
90
|
-
});
|
|
91
|
-
test('quotes are escaped inside attributes', () => {
|
|
92
|
-
expectOutput(`
|
|
93
|
-
['tis but a "scratch"](http://bla.ck/"kni"gh&t)
|
|
94
|
-
|
|
95
|
-

|
|
96
|
-
`, `
|
|
97
|
-
<a href="http://bla.ck/%22kni%22gh&t">'tis but a "scratch"</a>
|
|
98
|
-
<p>
|
|
99
|
-
<img alt="nay merely a "flesh wound" &cet" src="http://bla.ck/%22kni%22gh&t.jpg">
|
|
100
|
-
`);
|
|
101
|
-
});
|
|
102
|
-
function expectOutput(source, expected) {
|
|
103
|
-
if (DEBUG) {
|
|
104
|
-
// tslint:disable-next-line:no-console
|
|
105
|
-
console.log((0, lib_1.markDownToStructure)(source));
|
|
106
|
-
}
|
|
107
|
-
const output = (0, lib_1.markDownToJavaDoc)(source);
|
|
108
|
-
expect(output.trim()).toEqual(expected.trim());
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=javadoc.test.js.map
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const markdown_1 = require("../../lib/markdown/markdown");
|
|
4
|
-
const markdown_renderer_1 = require("../../lib/markdown/markdown-renderer");
|
|
5
|
-
const structure_renderer_1 = require("../../lib/markdown/structure-renderer");
|
|
6
|
-
const DEBUG = false;
|
|
7
|
-
test('can roundtrip markdown', () => {
|
|
8
|
-
expectOutput(`
|
|
9
|
-
# Hello
|
|
10
|
-
|
|
11
|
-
Yes please.
|
|
12
|
-
|
|
13
|
-
> this
|
|
14
|
-
>
|
|
15
|
-
> works
|
|
16
|
-
`, `
|
|
17
|
-
# Hello
|
|
18
|
-
|
|
19
|
-
Yes please.
|
|
20
|
-
|
|
21
|
-
> this
|
|
22
|
-
>
|
|
23
|
-
> works
|
|
24
|
-
`);
|
|
25
|
-
});
|
|
26
|
-
test('can roundtrip lists', () => {
|
|
27
|
-
expectOutput(`
|
|
28
|
-
* A list.
|
|
29
|
-
* Another list.
|
|
30
|
-
* A nested list.
|
|
31
|
-
|
|
32
|
-
1. We might have numbers.
|
|
33
|
-
2. Yes it's a numbered list.
|
|
34
|
-
`, `
|
|
35
|
-
* A list.
|
|
36
|
-
* Another list.
|
|
37
|
-
|
|
38
|
-
* A nested list.
|
|
39
|
-
|
|
40
|
-
1. We might have numbers.
|
|
41
|
-
2. Yes it's a numbered list.
|
|
42
|
-
`);
|
|
43
|
-
});
|
|
44
|
-
test('list with paragraphs', () => {
|
|
45
|
-
expectOutput(`
|
|
46
|
-
* A list.
|
|
47
|
-
* Another list.
|
|
48
|
-
|
|
49
|
-
Para2.
|
|
50
|
-
`, `
|
|
51
|
-
* A list.
|
|
52
|
-
* Another list.
|
|
53
|
-
|
|
54
|
-
Para2.
|
|
55
|
-
`);
|
|
56
|
-
});
|
|
57
|
-
test('can roundtrip complex hyperlink texts', () => {
|
|
58
|
-
expectOutput(`
|
|
59
|
-
This is a [hyperlink](https://amazonaws.com).
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
This is a [` +
|
|
64
|
-
'`' +
|
|
65
|
-
'monospace hyperlink' +
|
|
66
|
-
'`' +
|
|
67
|
-
`](https://amazonaws.com).
|
|
68
|
-
`, `
|
|
69
|
-
This is a [hyperlink](https://amazonaws.com).
|
|
70
|
-
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
This is a [` +
|
|
74
|
-
'`' +
|
|
75
|
-
'monospace hyperlink' +
|
|
76
|
-
'`' +
|
|
77
|
-
`](https://amazonaws.com).
|
|
78
|
-
`);
|
|
79
|
-
});
|
|
80
|
-
test('fenced code block', () => {
|
|
81
|
-
expectOutput(['before', '```ts', 'banana', ' second', '```', 'after'].join('\n'), ['before', '', '```ts', 'banana', ' second', '```', '', 'after'].join('\n'));
|
|
82
|
-
});
|
|
83
|
-
test('indented code block', () => {
|
|
84
|
-
expectOutput(['before', '', ' banana', ' second', '', 'after'].join('\n'), ['before', '', '```', 'banana', ' second', '```', '', 'after'].join('\n'));
|
|
85
|
-
});
|
|
86
|
-
test('code block followed by heading leaves paragraph marker', () => {
|
|
87
|
-
expectOutput(['```', 'code_here', '```', '', '# Heading'].join('\n'), ['```', 'code_here', '```', '', '# Heading'].join('\n'));
|
|
88
|
-
});
|
|
89
|
-
test('emphases', () => {
|
|
90
|
-
expectOutput(`
|
|
91
|
-
Text with *emphasis* and **strongness**.
|
|
92
|
-
|
|
93
|
-
Other style _emphasis_ and __strongness__.
|
|
94
|
-
`, `
|
|
95
|
-
Text with *emphasis* and **strongness**.
|
|
96
|
-
|
|
97
|
-
Other style *emphasis* and **strongness**.
|
|
98
|
-
`);
|
|
99
|
-
});
|
|
100
|
-
test('headings', () => {
|
|
101
|
-
expectOutput(`
|
|
102
|
-
## Heading 2
|
|
103
|
-
### Heading 3
|
|
104
|
-
`, `
|
|
105
|
-
## Heading 2
|
|
106
|
-
|
|
107
|
-
### Heading 3
|
|
108
|
-
`);
|
|
109
|
-
});
|
|
110
|
-
test('HTML comments', () => {
|
|
111
|
-
expectOutput(`
|
|
112
|
-
<!--HERE IS A COMMENT-->
|
|
113
|
-
`, `
|
|
114
|
-
<!--HERE IS A COMMENT-->
|
|
115
|
-
`);
|
|
116
|
-
});
|
|
117
|
-
function expectOutput(source, expected) {
|
|
118
|
-
if (DEBUG) {
|
|
119
|
-
const struct = new structure_renderer_1.StructureRenderer();
|
|
120
|
-
// tslint:disable-next-line:no-console
|
|
121
|
-
console.log((0, markdown_1.transformMarkdown)(source, struct));
|
|
122
|
-
}
|
|
123
|
-
const output = (0, markdown_1.transformMarkdown)(source, new markdown_renderer_1.MarkdownRenderer());
|
|
124
|
-
expect(output.trim()).toEqual(expected.trim());
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=roundtrip.test.js.map
|