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,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const lib_1 = require("../../lib");
|
|
5
|
-
const extract_1 = require("../../lib/commands/extract");
|
|
6
|
-
const trim_cache_1 = require("../../lib/commands/trim-cache");
|
|
7
|
-
const testutil_1 = require("../testutil");
|
|
8
|
-
const DUMMY_README = `
|
|
9
|
-
Here is an example of how to use ClassA:
|
|
10
|
-
|
|
11
|
-
\`\`\`ts
|
|
12
|
-
import * as ass from 'my_assembly';
|
|
13
|
-
const aClass = new ass.ClassA();
|
|
14
|
-
aClass.someMethod();
|
|
15
|
-
\`\`\`
|
|
16
|
-
`;
|
|
17
|
-
let assembly;
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
// Create an assembly in a temp directory
|
|
20
|
-
assembly = testutil_1.TestJsiiModule.fromSource({
|
|
21
|
-
'index.ts': `
|
|
22
|
-
export class ClassA {
|
|
23
|
-
public someMethod() {
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export class ClassB {
|
|
27
|
-
public anotherMethod() {
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`,
|
|
31
|
-
'README.md': DUMMY_README,
|
|
32
|
-
}, {
|
|
33
|
-
name: 'my_assembly',
|
|
34
|
-
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
afterEach(() => assembly.cleanup());
|
|
38
|
-
test('trim-cache removes unused snippets', async () => {
|
|
39
|
-
const cacheFile = path.join(assembly.moduleDirectory, 'dummy.tabl.json');
|
|
40
|
-
// GIVEN
|
|
41
|
-
const tbl = new lib_1.LanguageTablet();
|
|
42
|
-
tbl.addSnippet(bogusTranslatedSnippet());
|
|
43
|
-
await tbl.save(cacheFile);
|
|
44
|
-
// WHEN
|
|
45
|
-
await (0, trim_cache_1.trimCache)({
|
|
46
|
-
assemblyLocations: [assembly.moduleDirectory],
|
|
47
|
-
cacheFile,
|
|
48
|
-
});
|
|
49
|
-
// THEN
|
|
50
|
-
const updated = await lib_1.LanguageTablet.fromFile(cacheFile);
|
|
51
|
-
expect(updated.count).toEqual(0);
|
|
52
|
-
});
|
|
53
|
-
test('trim-cache leaves used snippets', async () => {
|
|
54
|
-
const defaultTablet = path.join(assembly.moduleDirectory, lib_1.DEFAULT_TABLET_NAME);
|
|
55
|
-
// GIVEN
|
|
56
|
-
await (0, extract_1.extractSnippets)([assembly.moduleDirectory]);
|
|
57
|
-
// WHEN
|
|
58
|
-
await (0, trim_cache_1.trimCache)({
|
|
59
|
-
assemblyLocations: [assembly.moduleDirectory],
|
|
60
|
-
cacheFile: defaultTablet,
|
|
61
|
-
});
|
|
62
|
-
// THEN
|
|
63
|
-
const updated = await lib_1.LanguageTablet.fromFile(defaultTablet);
|
|
64
|
-
expect(updated.count).toEqual(1);
|
|
65
|
-
});
|
|
66
|
-
test('trim-cache preserves tablet compression', async () => {
|
|
67
|
-
const compDefaultTablet = path.join(assembly.moduleDirectory, lib_1.DEFAULT_TABLET_NAME_COMPRESSED);
|
|
68
|
-
// GIVEN
|
|
69
|
-
const tbl = new lib_1.LanguageTablet();
|
|
70
|
-
tbl.addSnippets(bogusTranslatedSnippet());
|
|
71
|
-
// explicitly compress the tablet file
|
|
72
|
-
await tbl.save(compDefaultTablet, true);
|
|
73
|
-
// WHEN
|
|
74
|
-
await (0, trim_cache_1.trimCache)({
|
|
75
|
-
assemblyLocations: [assembly.moduleDirectory],
|
|
76
|
-
cacheFile: compDefaultTablet,
|
|
77
|
-
});
|
|
78
|
-
// THEN
|
|
79
|
-
const updated = await lib_1.LanguageTablet.fromFile(compDefaultTablet);
|
|
80
|
-
expect(updated.compressedSource).toBeTruthy();
|
|
81
|
-
});
|
|
82
|
-
function bogusTranslatedSnippet() {
|
|
83
|
-
return lib_1.TranslatedSnippet.fromTypeScript((0, lib_1.typeScriptSnippetFromVisibleSource)('console.log("hello");', (0, testutil_1.testSnippetLocation)('x.ts'), true), true);
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=trim-cache.test.js.map
|
package/test/fixtures.test.d.ts
DELETED
package/test/fixtures.test.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const fixtures_1 = require("../lib/fixtures");
|
|
4
|
-
const snippet_1 = require("../lib/snippet");
|
|
5
|
-
const testutil_1 = require("./testutil");
|
|
6
|
-
const location = (0, testutil_1.testSnippetLocation)('where');
|
|
7
|
-
describe('fixturize', () => {
|
|
8
|
-
test('snippet retains properties', () => {
|
|
9
|
-
const snippet = {
|
|
10
|
-
visibleSource: 'visibleSource',
|
|
11
|
-
location,
|
|
12
|
-
parameters: {
|
|
13
|
-
[snippet_1.SnippetParameters.$PROJECT_DIRECTORY]: 'directory',
|
|
14
|
-
[snippet_1.SnippetParameters.NO_FIXTURE]: '',
|
|
15
|
-
key: 'value',
|
|
16
|
-
},
|
|
17
|
-
strict: true,
|
|
18
|
-
};
|
|
19
|
-
expect((0, fixtures_1.fixturize)(snippet)).toEqual(expect.objectContaining(snippet));
|
|
20
|
-
});
|
|
21
|
-
test('separates imports and declarations', () => {
|
|
22
|
-
const source = `import * as ns from 'mod';
|
|
23
|
-
declare const mock: Tpe;
|
|
24
|
-
const val = new Cls();`;
|
|
25
|
-
const snippet = {
|
|
26
|
-
visibleSource: source,
|
|
27
|
-
location,
|
|
28
|
-
parameters: {
|
|
29
|
-
[snippet_1.SnippetParameters.$PROJECT_DIRECTORY]: 'test',
|
|
30
|
-
},
|
|
31
|
-
strict: true,
|
|
32
|
-
};
|
|
33
|
-
const fixturizedSnippet = (0, fixtures_1.fixturize)(snippet);
|
|
34
|
-
expect(fixturizedSnippet.completeSource).toBe(`// Hoisted imports begin after !show marker below
|
|
35
|
-
/// !show
|
|
36
|
-
import * as ns from 'mod';
|
|
37
|
-
declare const mock: Tpe;
|
|
38
|
-
/// !hide
|
|
39
|
-
// Hoisted imports ended before !hide marker above
|
|
40
|
-
// Code snippet begins after !show marker below
|
|
41
|
-
/// !show
|
|
42
|
-
|
|
43
|
-
const val = new Cls();
|
|
44
|
-
/// !hide
|
|
45
|
-
// Code snippet ended before !hide marker above
|
|
46
|
-
`);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=fixtures.test.js.map
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const spec = require("@jsii/spec");
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const mockfs = require("mock-fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const assemblies_1 = require("../../lib/jsii/assemblies");
|
|
8
|
-
const snippet_1 = require("../../lib/snippet");
|
|
9
|
-
const testutil_1 = require("../testutil");
|
|
10
|
-
const fake_assembly_1 = require("./fake-assembly");
|
|
11
|
-
test('Extract snippet from README', async () => {
|
|
12
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
13
|
-
{
|
|
14
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
15
|
-
readme: {
|
|
16
|
-
markdown: ['Before the example.', '```ts', 'someExample();', '```', 'After the example.'].join('\n'),
|
|
17
|
-
},
|
|
18
|
-
}),
|
|
19
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
20
|
-
},
|
|
21
|
-
]));
|
|
22
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
23
|
-
});
|
|
24
|
-
test('Extract snippet from submodule READMEs', async () => {
|
|
25
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
26
|
-
{
|
|
27
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
28
|
-
submodules: {
|
|
29
|
-
'my.submodule': {
|
|
30
|
-
readme: {
|
|
31
|
-
markdown: ['Before the example.', '```ts', 'someExample();', '```', 'After the example.'].join('\n'),
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
37
|
-
},
|
|
38
|
-
]));
|
|
39
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
40
|
-
});
|
|
41
|
-
test('Extract snippet from type docstring', async () => {
|
|
42
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
43
|
-
{
|
|
44
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
45
|
-
types: {
|
|
46
|
-
'asm.MyType': {
|
|
47
|
-
kind: spec.TypeKind.Class,
|
|
48
|
-
assembly: 'asm',
|
|
49
|
-
fqn: 'asm.MyType',
|
|
50
|
-
name: 'MyType',
|
|
51
|
-
docs: {
|
|
52
|
-
summary: 'My Type',
|
|
53
|
-
remarks: ['Before the example.', '```ts', 'someExample();', '```', 'After the example.'].join('\n'),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
59
|
-
},
|
|
60
|
-
]));
|
|
61
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
62
|
-
});
|
|
63
|
-
test('Snippet can include fixture', async () => {
|
|
64
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
65
|
-
{
|
|
66
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
67
|
-
readme: {
|
|
68
|
-
markdown: [
|
|
69
|
-
'Before the example.',
|
|
70
|
-
'```ts fixture=explicit',
|
|
71
|
-
'someExample();',
|
|
72
|
-
'```',
|
|
73
|
-
'After the example.',
|
|
74
|
-
].join('\n'),
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
77
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
78
|
-
},
|
|
79
|
-
]));
|
|
80
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
81
|
-
expect(snippets[0].completeSource).toMatchInlineSnapshot(`
|
|
82
|
-
"// This is a fixture
|
|
83
|
-
|
|
84
|
-
// This is a wrapper so that \`import\` statements are invalid if included in
|
|
85
|
-
// the code example that'll be inlined at the \`here\` marker.
|
|
86
|
-
(function () {
|
|
87
|
-
// Code snippet begins after !show marker below
|
|
88
|
-
/// !show
|
|
89
|
-
someExample();
|
|
90
|
-
/// !hide
|
|
91
|
-
// Code snippet ended before !hide marker above
|
|
92
|
-
})()
|
|
93
|
-
"
|
|
94
|
-
`);
|
|
95
|
-
});
|
|
96
|
-
test('Use fixture from example', async () => {
|
|
97
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
98
|
-
{
|
|
99
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
100
|
-
types: {
|
|
101
|
-
'asm.MyType': {
|
|
102
|
-
kind: spec.TypeKind.Class,
|
|
103
|
-
assembly: 'asm',
|
|
104
|
-
fqn: 'asm.MyType',
|
|
105
|
-
name: 'MyType',
|
|
106
|
-
docs: {
|
|
107
|
-
example: ['/// fixture=explicit', 'someExample();'].join('\n'),
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
}),
|
|
112
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
113
|
-
},
|
|
114
|
-
]));
|
|
115
|
-
expect(snippets[0].completeSource).toMatchInlineSnapshot(`
|
|
116
|
-
"// This is a fixture
|
|
117
|
-
|
|
118
|
-
// This is a wrapper so that \`import\` statements are invalid if included in
|
|
119
|
-
// the code example that'll be inlined at the \`here\` marker.
|
|
120
|
-
(function () {
|
|
121
|
-
// Code snippet begins after !show marker below
|
|
122
|
-
/// !show
|
|
123
|
-
someExample();
|
|
124
|
-
/// !hide
|
|
125
|
-
// Code snippet ended before !hide marker above
|
|
126
|
-
})()
|
|
127
|
-
"
|
|
128
|
-
`);
|
|
129
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
130
|
-
});
|
|
131
|
-
test('Fixture allows use of import statements', async () => {
|
|
132
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
133
|
-
{
|
|
134
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
135
|
-
types: {
|
|
136
|
-
'asm.MyType': {
|
|
137
|
-
kind: spec.TypeKind.Class,
|
|
138
|
-
assembly: 'asm',
|
|
139
|
-
fqn: 'asm.MyType',
|
|
140
|
-
name: 'MyType',
|
|
141
|
-
docs: {
|
|
142
|
-
example: ['/// fixture=explicit', 'import { exit } from "process";', 'someExample();', 'exit(0);'].join('\n'),
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
}),
|
|
147
|
-
directory: path.join(__dirname, 'fixtures'),
|
|
148
|
-
},
|
|
149
|
-
]));
|
|
150
|
-
expect(snippets[0].completeSource).toMatchInlineSnapshot(`
|
|
151
|
-
"// Hoisted imports begin after !show marker below
|
|
152
|
-
/// !show
|
|
153
|
-
import { exit } from "process";
|
|
154
|
-
/// !hide
|
|
155
|
-
// Hoisted imports ended before !hide marker above
|
|
156
|
-
// This is a fixture
|
|
157
|
-
|
|
158
|
-
// This is a wrapper so that \`import\` statements are invalid if included in
|
|
159
|
-
// the code example that'll be inlined at the \`here\` marker.
|
|
160
|
-
(function () {
|
|
161
|
-
// Code snippet begins after !show marker below
|
|
162
|
-
/// !show
|
|
163
|
-
|
|
164
|
-
someExample();
|
|
165
|
-
exit(0);
|
|
166
|
-
/// !hide
|
|
167
|
-
// Code snippet ended before !hide marker above
|
|
168
|
-
})()
|
|
169
|
-
"
|
|
170
|
-
`);
|
|
171
|
-
expect(snippets[0].visibleSource).toEqual(['import { exit } from "process";', 'someExample();', 'exit(0);'].join('\n'));
|
|
172
|
-
});
|
|
173
|
-
test('Backwards compatibility with literate integ tests', async () => {
|
|
174
|
-
mockfs({
|
|
175
|
-
'/package/test/integ.example.lit.ts': '# Some literate source file',
|
|
176
|
-
});
|
|
177
|
-
try {
|
|
178
|
-
const snippets = Array.from(await (0, assemblies_1.allTypeScriptSnippets)([
|
|
179
|
-
{
|
|
180
|
-
assembly: (0, fake_assembly_1.fakeAssembly)({
|
|
181
|
-
readme: {
|
|
182
|
-
markdown: [
|
|
183
|
-
'Before the example.',
|
|
184
|
-
'```ts lit=test/integ.example.lit.ts',
|
|
185
|
-
'someExample();',
|
|
186
|
-
'```',
|
|
187
|
-
'After the example.',
|
|
188
|
-
].join('\n'),
|
|
189
|
-
},
|
|
190
|
-
}),
|
|
191
|
-
directory: '/package',
|
|
192
|
-
},
|
|
193
|
-
]));
|
|
194
|
-
expect(snippets[0].visibleSource).toEqual('someExample();');
|
|
195
|
-
expect(snippets[0].completeSource).toEqual('# Some literate source file');
|
|
196
|
-
expect(snippets[0]?.parameters?.[snippet_1.SnippetParameters.$COMPILATION_DIRECTORY]).toEqual(path.normalize('/package/test'));
|
|
197
|
-
}
|
|
198
|
-
finally {
|
|
199
|
-
mockfs.restore();
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
test('rosetta fixture from submodule is preferred if it exists', async () => {
|
|
203
|
-
const jsiiModule = testutil_1.TestJsiiModule.fromSource({
|
|
204
|
-
'index.ts': 'export * as submodule from "./submodule"',
|
|
205
|
-
'submodule.ts': `
|
|
206
|
-
/**
|
|
207
|
-
* @example new ClassA();
|
|
208
|
-
*/
|
|
209
|
-
export class ClassA {
|
|
210
|
-
public someMethod() {
|
|
211
|
-
}
|
|
212
|
-
}`,
|
|
213
|
-
}, {
|
|
214
|
-
name: 'my_assembly',
|
|
215
|
-
jsii: testutil_1.DUMMY_JSII_CONFIG,
|
|
216
|
-
});
|
|
217
|
-
try {
|
|
218
|
-
await fs_1.promises.mkdir(path.join(jsiiModule.moduleDirectory, 'rosetta', 'submodule'), { recursive: true });
|
|
219
|
-
await fs_1.promises.writeFile(path.join(jsiiModule.moduleDirectory, 'rosetta', 'submodule', 'default.ts-fixture'), 'pick me\n/// here');
|
|
220
|
-
await fs_1.promises.writeFile(path.join(jsiiModule.moduleDirectory, 'rosetta', 'default.ts-fixture'), 'dont pick me\n/// here');
|
|
221
|
-
const snippets = await (0, assemblies_1.allTypeScriptSnippets)([
|
|
222
|
-
{ assembly: jsiiModule.assembly, directory: jsiiModule.moduleDirectory },
|
|
223
|
-
]);
|
|
224
|
-
expect(snippets[0].completeSource).toMatch(/^pick me/);
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
jsiiModule.cleanup();
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
//# sourceMappingURL=assemblies.test.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fakeAssembly = void 0;
|
|
4
|
-
const spec_1 = require("@jsii/spec");
|
|
5
|
-
function fakeAssembly(parts) {
|
|
6
|
-
return {
|
|
7
|
-
schema: spec_1.SchemaVersion.LATEST,
|
|
8
|
-
name: 'test-assembly',
|
|
9
|
-
description: 'A fake assembly used for tests',
|
|
10
|
-
homepage: '',
|
|
11
|
-
repository: { directory: '', type: '', url: '' },
|
|
12
|
-
author: { email: '', name: '', organization: false, roles: [], url: '' },
|
|
13
|
-
fingerprint: '<NONE>',
|
|
14
|
-
version: '0.0.0-use.local',
|
|
15
|
-
jsiiVersion: '0.0.0-use.local',
|
|
16
|
-
license: 'UNLICENSED',
|
|
17
|
-
...parts,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
exports.fakeAssembly = fakeAssembly;
|
|
21
|
-
//# sourceMappingURL=fake-assembly.js.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const visible_spans_1 = require("../../lib/typescript/visible-spans");
|
|
4
|
-
test('full text visible by default', () => {
|
|
5
|
-
const vis = visible_spans_1.Spans.visibleSpansFromSource('asdf');
|
|
6
|
-
expect(vis.spans).toEqual([{ start: 0, end: 4, visible: true }]);
|
|
7
|
-
});
|
|
8
|
-
test('initial span visible if directive is hiding', () => {
|
|
9
|
-
const vis = visible_spans_1.Spans.visibleSpansFromSource('asdf\n/// !hide\nxyz');
|
|
10
|
-
expect(vis.spans).toEqual([{ start: 0, end: 5, visible: true }]);
|
|
11
|
-
});
|
|
12
|
-
test('initial span invisible if directive is showing', () => {
|
|
13
|
-
const s = 'asdf\n/// !show\nxyz';
|
|
14
|
-
const vis = visible_spans_1.Spans.visibleSpansFromSource('asdf\n/// !show\nxyz');
|
|
15
|
-
expect(s.substring(vis.spans[0].start, vis.spans[0].end)).toEqual('xyz');
|
|
16
|
-
expect(vis.spans).toEqual([{ start: 15, end: 18, visible: true }]);
|
|
17
|
-
});
|
|
18
|
-
test('merge adjacent spans', () => {
|
|
19
|
-
const spans = new visible_spans_1.Spans([
|
|
20
|
-
{ start: 10, end: 18 },
|
|
21
|
-
{ start: 18, end: 20 },
|
|
22
|
-
]);
|
|
23
|
-
expect(spans.spans).toEqual([{ start: 10, end: 20 }]);
|
|
24
|
-
});
|
|
25
|
-
test('trim source to spans', () => {
|
|
26
|
-
const source = ['a', '/// !show', 'b', 'c', '/// !hide', 'd'].join('\n');
|
|
27
|
-
const trimmed = (0, visible_spans_1.trimCompleteSourceToVisible)(source);
|
|
28
|
-
expect(trimmed).toEqual('b\nc');
|
|
29
|
-
});
|
|
30
|
-
test('trim source to spans with leading whitespace ', () => {
|
|
31
|
-
const source = ['a', ' /// !show', 'b', 'c', ' /// !hide', 'd'].join('\n');
|
|
32
|
-
const trimmed = (0, visible_spans_1.trimCompleteSourceToVisible)(source);
|
|
33
|
-
expect(trimmed).toEqual('b\nc');
|
|
34
|
-
});
|
|
35
|
-
test('trim source to spans with trailing whitespace ', () => {
|
|
36
|
-
const source = ['a', '/// !show ', 'b', 'c', ' /// !hide ', 'd'].join('\n');
|
|
37
|
-
const trimmed = (0, visible_spans_1.trimCompleteSourceToVisible)(source);
|
|
38
|
-
expect(trimmed).toEqual('b\nc');
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=visible-spans.test.js.map
|