From 80e696d97e1a29cef6aa66aa7ea97c113f8a7365 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 19 Jun 2024 10:15:29 +0100 Subject: [PATCH 1/9] chore: use Biome instead of prettier+eslint --- package.json | 3 +++ pnpm-lock.yaml | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b8d5d0ae2..40b7b4f22 100644 --- a/package.json +++ b/package.json @@ -34,5 +34,8 @@ }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "dependencies": { + "@biomejs/biome": "^1.8.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 970a93d5b..9b256ea94 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,10 +3,11 @@ lockfileVersion: '6.0' importers: .: - devDependencies: + dependencies: '@biomejs/biome': - specifier: 1.8.1 + specifier: ^1.8.1 version: 1.8.1 + devDependencies: '@changesets/cli': specifier: ^2.25.0 version: 2.25.0 @@ -91,7 +92,7 @@ packages: '@biomejs/cli-linux-x64-musl': 1.8.1 '@biomejs/cli-win32-arm64': 1.8.1 '@biomejs/cli-win32-x64': 1.8.1 - dev: true + dev: false /@biomejs/cli-darwin-arm64@1.8.1: resolution: {integrity: sha512-XLiB7Uu6GALIOBWzQ2aMD0ru4Ly5/qSeQF7kk3AabzJ/kwsEWSe33iVySBP/SS2qv25cgqNiLksjGcw2bHT3mw==} @@ -99,7 +100,7 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-darwin-x64@1.8.1: @@ -108,7 +109,7 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-linux-arm64-musl@1.8.1: @@ -117,7 +118,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-linux-arm64@1.8.1: @@ -126,7 +127,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-linux-x64-musl@1.8.1: @@ -135,7 +136,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-linux-x64@1.8.1: @@ -144,7 +145,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-win32-arm64@1.8.1: @@ -153,7 +154,7 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true + dev: false optional: true /@biomejs/cli-win32-x64@1.8.1: @@ -162,7 +163,7 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true + dev: false optional: true /@changesets/apply-release-plan@6.1.1: From 0740ecbff4f25fa0cbbd214260c1edd1bdef600c Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 19 Jun 2024 10:34:46 +0100 Subject: [PATCH 2/9] move biome to dev deps --- package.json | 3 --- pnpm-lock.yaml | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 40b7b4f22..b8d5d0ae2 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,5 @@ }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "dependencies": { - "@biomejs/biome": "^1.8.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9b256ea94..970a93d5b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,11 +3,10 @@ lockfileVersion: '6.0' importers: .: - dependencies: + devDependencies: '@biomejs/biome': - specifier: ^1.8.1 + specifier: 1.8.1 version: 1.8.1 - devDependencies: '@changesets/cli': specifier: ^2.25.0 version: 2.25.0 @@ -92,7 +91,7 @@ packages: '@biomejs/cli-linux-x64-musl': 1.8.1 '@biomejs/cli-win32-arm64': 1.8.1 '@biomejs/cli-win32-x64': 1.8.1 - dev: false + dev: true /@biomejs/cli-darwin-arm64@1.8.1: resolution: {integrity: sha512-XLiB7Uu6GALIOBWzQ2aMD0ru4Ly5/qSeQF7kk3AabzJ/kwsEWSe33iVySBP/SS2qv25cgqNiLksjGcw2bHT3mw==} @@ -100,7 +99,7 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-darwin-x64@1.8.1: @@ -109,7 +108,7 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-linux-arm64-musl@1.8.1: @@ -118,7 +117,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-linux-arm64@1.8.1: @@ -127,7 +126,7 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-linux-x64-musl@1.8.1: @@ -136,7 +135,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-linux-x64@1.8.1: @@ -145,7 +144,7 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-win32-arm64@1.8.1: @@ -154,7 +153,7 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: false + dev: true optional: true /@biomejs/cli-win32-x64@1.8.1: @@ -163,7 +162,7 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: false + dev: true optional: true /@changesets/apply-release-plan@6.1.1: From c1bc133ed5bb72187be580ca5e6391c31f14305f Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 19 Jun 2024 16:45:43 +0100 Subject: [PATCH 3/9] chore: cover all tests --- internal/js_scanner/__js_scanner__/array.snap | 14 ++++ internal/js_scanner/__js_scanner__/basic.snap | 14 ++++ .../__js_scanner__/invalid_strings.snap | 14 ++++ .../js_scanner/__js_scanner__/literal.snap | 14 ++++ .../js_scanner/__js_scanner__/multiple.snap | 14 ++++ .../js_scanner/__js_scanner__/objects.snap | 14 ++++ .../js_scanner/__js_scanner__/regexp.snap | 14 ++++ .../js_scanner/__js_scanner__/shorhand.snap | 14 ++++ .../__js_scanner__/valid_strings.snap | 14 ++++ internal/js_scanner/js_scanner_test.go | 10 +++ .../scopedStyleStrategy___attribute_.snap | 26 +++++++ .../scopedStyleStrategy___class_.snap | 26 +++++++ .../styles__no_frontmatter_.snap | 26 +++++++ .../All_components.snap | 0 .../Component_is_raw.snap | 0 .../Component_names_A-Z.snap | 0 .../Component_siblings_are_siblings.snap | 0 .../Empty_attribute_expression.snap | 0 .../Empty_expression.snap | 0 .../Empty_expression_with_whitespace.snap | 0 .../Empty_script.snap | 0 .../Empty_style.snap | 0 ..._form_followed_by_other_sibling_forms.snap | 0 .../Fragment.snap | 0 .../Fragment_literal_only.snap | 0 .../Fragment_shorthand.snap | 0 .../Fragment_shorthand_only.snap | 0 .../Fragment_slotted.snap | 0 .../Fragment_slotted_with_name.snap | 0 ...ment_in_component_inside_expression_I.snap | 0 ...ent_in_component_inside_expression_II.snap | 0 .../Mixed_style_siblings.snap | 0 ...TML_in_expressions,_wrapped_in_parens.snap | 0 .../No_extra_script_tag.snap | 0 .../Parser_can_handle_files___4096_chars.snap | 0 .../Preserve_namespaces.snap | 0 .../Preserve_namespaces_for_components.snap | 0 .../Preserve_namespaces_in_expressions.snap | 0 .../Preserve_slot_whitespace.snap | 0 .../Preserve_slots_inside_custom-element.snap | 0 .../React_framework_example.snap | 0 .../SVG_styles.snap | 0 ..._components_in_head_can_have_siblings.snap | 0 ...sing_components_siblings_are_siblings.snap | 0 .../Self-closing_formatting_elements.snap | 0 .../Self-closing_formatting_elements_2.snap | 0 .../Self-closing_script_in_head_works.snap | 0 .../Self-closing_title.snap | 0 .../Self-closing_title_II.snap | 0 .../Use_of_interfaces_within_frontmatter.snap | 0 .../XElement.snap | 0 .../_955_ternary_slot_with_elements.snap | 0 .../_955_ternary_slot_with_text.snap | 0 .../advanced_svg_expression.snap | 0 .../anchor_content.snap | 0 .../anchor_expressions.snap | 0 .../anchor_inside_expression.snap | 0 .../attribute_with_template_literal.snap | 0 ...e_with_template_literal_interpolation.snap | 0 .../backtick_in_HTML_comment.snap | 0 .../basic__frontmatter_.snap | 0 .../basic__no_frontmatter_.snap | 0 .../basic_renderHead.snap | 0 .../caption_only.snap | 0 .../class_and_class_list_object.snap | 0 .../class_and_class_list_set.snap | 0 .../class_and_class_list_simple_array.snap | 0 .../class_list.snap | 0 .../class_list_with_spread.snap | 0 .../class_with_spread.snap | 0 .../client_only_component__default_.snap | 0 .../client_only_component__multiple_.snap | 0 .../client_only_component__named_.snap | 0 .../client_only_component__namespace_.snap | 0 ...t_only_component__namespaced_default_.snap | 0 ...ent_only_component__namespaced_named_.snap | 0 ...omment_only_expressions_are_removed_I.snap | 0 ...mment_only_expressions_are_removed_II.snap | 0 ...ment_only_expressions_are_removed_III.snap | 0 .../comments_removed_from_attribute_list.snap | 0 ...ex_nested_template_literal_expression.snap | 0 .../complex_recursive_component.snap | 0 .../complex_table.snap | 0 .../component.snap | 0 ...d_expression_before_its_child_element.snap | 0 .../component_with_only_a_script.snap | 0 .../component_with_quoted_attributes.snap | 0 ...ondition_expressions_at_the_top-level.snap | 0 ...ns_at_the_top-level_with_head_content.snap | 0 .../conditional_iframe.snap | 0 .../conditional_noscript.snap | 0 .../conditional_render.snap | 0 ...dering_of_title_containing_expression.snap | 0 .../conditional_slot.snap | 0 ...doesn\342\200\231t_produce_semicolon.snap" | 0 ...s_are_not_included_in_module_metadata.snap | 0 .../custom-element.snap | 0 .../custom_elements.snap | 0 ..._vars_on_a_module_script_with_imports.snap | 0 .../define_vars_on_non-root_elements.snap | 0 ...cript_with_StaticExpression_turned_on.snap | 0 .../define_vars_on_style.snap | 0 ...with_style_empty_attribute_on_element.snap | 0 ...style_expression_attribute_on_element.snap | 0 ...ith_style_quoted_attribute_on_element.snap | 0 ..._style_shorthand_attribute_on_element.snap | 0 ...template_literal_attribute_on_element.snap | 0 .../division_inside_expression.snap | 0 .../doctype.snap | 0 .../dot_component.snap | 0 .../dynamic_import.snap | 0 .../escaped_entity.snap | 0 .../export_comments_I.snap | 0 .../export_comments_II.snap | 0 .../export_member_does_not_panic.snap | 0 ...xpression_returning_multiple_elements.snap | 0 .../expression_slot.snap | 0 .../expression_with_leading_whitespace.snap | 0 .../expressions_with_JS_comments.snap | 0 ...xpressions_with_multiple_curly_braces.snap | 0 .../function_expression_slots_I.snap | 0 .../function_expression_slots_II___959_.snap | 0 .../getStaticPaths__basic_.snap | 0 .../getStaticPaths__hoisted_.snap | 0 .../getStaticPaths__hoisted_II_.snap | 0 ...ets_all_potential_hydrated_components.snap | 0 .../head_expression.snap | 0 ...and_conditional_rendering_of_fragment.snap | 0 .../head_inside_slot.snap | 0 .../head_slot.snap | 0 .../head_slot_II.snap | 0 .../head_slot_III.snap | 0 .../html5_boilerplate.snap | 0 .../iframe.snap | 0 .../import.meta.env.snap | 0 .../import.meta.snap | 0 .../import_assertions.snap | 0 .../import_order.snap | 0 .../import_to_identifier_named_assert.snap | 0 ...des_comments_for_expression_attribute.snap | 0 ...udes_comments_for_shorthand_attribute.snap | 0 .../is_raw.snap | 0 .../map_basic.snap | 0 .../map_nested.snap | 0 .../map_with_component.snap | 0 .../map_without_component.snap | 0 ...rHead_not_printed_for_hoisted_scripts.snap | 0 .../multibyte_character___script.snap} | 0 .../multibyte_character___style.snap} | 0 .../multibyte_characters.snap | 0 .../multiple_define_vars_on_style.snap | 0 .../nested_expressions.snap | 0 .../nested_expressions_II.snap | 0 .../nested_expressions_III.snap | 0 .../nested_expressions_IV.snap | 0 .../nested_expressions_V.snap | 0 .../nested_expressions_VI.snap | 0 .../nested_expressions_VII.snap | 0 .../nested_expressions_VIII.snap | 0 ...nested_head_content_stays_in_the_head.snap | 0 .../nested_template_literal_expression.snap | 0 .../no_expressions_in_math.snap | 0 .../noscript_component.snap | 0 .../noscript_deep_styles.snap | 0 .../noscript_only.snap | 0 .../noscript_styles.snap | 0 .../orphan_slot.snap | 0 ...omponent_if_it_contains_single_quotes.snap | 0 ...t_if_passed_into_the_compiler_options.snap | 0 .../preserve_is_inline_slot.snap | 0 .../preserve_is_inline_slot_II.snap | 0 .../script__renderScript__true_.snap | 0 .../script_before_elements.snap | 0 .../script_define_vars_I.snap | 0 .../script_define_vars_II.snap | 0 .../script_external__renderScript__true_.snap | 0 .../script_hoist_with_frontmatter.snap | 0 .../script_hoist_without_frontmatter.snap | 0 .../script_in__head_.snap | 0 .../script_inline.snap | 0 .../script_inline__renderScript__true_.snap | 0 ...ndled_and_inline__renderScript__true_.snap | 0 .../script_multiple__renderScript__true_.snap | 0 .../select_in_form.snap | 0 .../select_map_expression.snap | 0 .../select_nested_option.snap | 0 .../select_option_expression.snap | 0 .../self-closing_td.snap | 0 .../set_html.snap | 0 .../set_html_and_set_text.snap | 0 .../set_html_on_Component.snap | 0 ...ml_on_Component_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_Fragment.snap | 0 ...tml_on_Fragment_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_custom-element.snap | 0 ..._custom-element_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_empty_tag.snap | 0 ...ml_on_empty_tag_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_script.snap | 0 ..._html_on_script_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_self-closing_tag.snap | 0 ...elf-closing_tag_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_style.snap | 0 ...t_html_on_style_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_on_tag_with_children.snap | 0 ...ag_with_children_and_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 ...set_html_on_tag_with_empty_whitespace.snap | 0 ...empty_whitespace_and_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_html_with_other_attributes.snap | 0 .../set_html_with_quoted_attribute.snap | 0 ...quoted_attribute_and_other_attributes.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_with_variable_and_other_attributes.snap | 0 ...te_literal_attribute_without_variable.snap | 0 ...without_variable_and_other_attributes.snap | 0 .../set_text.snap | 0 .../set_text_on_Component.snap | 0 ...xt_on_Component_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_text_on_custom-element.snap | 0 ..._custom-element_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../set_text_with_quoted_attribute.snap | 0 ...plate_literal_attribute_with_variable.snap | 0 ...te_literal_attribute_without_variable.snap | 0 .../sibling_expressions.snap | 0 .../simple_ternary.snap | 0 .../slot_inside_of_Base.snap | 0 .../slot_with_fallback.snap | 0 .../slot_with_fallback_II.snap | 0 .../slot_with_fallback_III.snap | 0 .../slot_with_quoted_attributes.snap | 0 .../slots__basic_.snap | 0 .../slots__dynamic_name_.snap | 0 .../slots__expression_.snap | 0 .../slots__named_only_.snap | 0 .../slots__no_comments_.snap | 0 .../small_expression.snap | 0 ...olidus_in_template_literal_expression.snap | 0 .../spread_with_double_quotation_marks.snap | 0 ...read_with_style_but_no_explicit_class.snap | 0 .../spread_without_style_or_class.snap | 0 .../styles__no_frontmatter_.snap | 0 .../svg_expressions.snap | 0 .../table.snap | 0 .../table_II.snap | 0 .../table_III.snap | 0 .../table_IV.snap | 0 .../table_caption_expression.snap | 0 .../table_expression_with_trailing_div.snap | 0 ...table_expressions__no_implicit_tbody_.snap | 0 .../table_simple_case.snap | 0 .../table_slot_I.snap | 0 .../table_slot_II.snap | 0 .../table_slot_III.snap | 0 .../table_slot_IV.snap | 0 .../table_slot_V.snap | 0 .../table_with_expression_in__th_.snap} | 0 .../tbody_expressions.snap | 0 .../tbody_expressions_2.snap | 0 .../tbody_expressions_3.snap | 0 .../td_expressions.snap | 0 .../td_expressions_II.snap | 0 ...mplate_literal_attribute_on_component.snap | 0 ..._attribute_with_variable_on_component.snap | 0 .../ternary_component.snap | 0 .../ternary_layout.snap | 0 .../ternary_slot.snap | 0 .../text_after_title_expression.snap | 0 .../text_after_title_expressions.snap | 0 .../text_only.snap | 0 .../textarea.snap | 0 .../textarea_in_form.snap | 0 .../textarea_inside_expression.snap | 0 .../th_expressions.snap | 0 .../tr_only.snap | 0 .../trailing_expression.snap | 0 .../transition_animate_on_Component.snap | 0 ...transition_animate_with_an_expression.snap | 0 .../transition_name_with_an_expression.snap | 0 ...nsition_name_with_an_template_literal.snap | 0 ...t-props_converted_to_a_data_attribute.snap | 0 ...persist_converted_to_a_data_attribute.snap | 0 ...rsist_uses_transition_name_if_defined.snap | 0 .../type_import.snap | 0 .../unusual_line_terminator_I.snap | 0 .../unusual_line_terminator_II.snap | 0 .../user-defined__implicit__is_printed.snap} | 0 .../printer/__printer_json__/Comment.snap | 14 ++++ .../Comment_preserves_whitespace.snap | 14 ++++ .../printer/__printer_json__/Component.snap | 14 ++++ .../printer/__printer_json__/Doctype.snap | 14 ++++ .../__printer_json__/Fragment_Literal.snap | 14 ++++ .../__printer_json__/Fragment_Shorthand.snap | 14 ++++ .../printer/__printer_json__/Frontmatter.snap | 17 ++++ .../printer/__printer_json__/JSON_escape.snap | 19 +++++ .../__printer_json__/Preserve_namespaces.snap | 14 ++++ internal/printer/__printer_json__/basic.snap | 14 ++++ .../__printer_json__/custom-element.snap | 14 ++++ ...h_unterminated_double_quote_attribute.snap | 14 ++++ ...h_unterminated_single_quote_attribute.snap | 14 ++++ ...terminated_template_literal_attribute.snap | 14 ++++ .../printer/__printer_json__/expression.snap | 14 ++++ .../__printer_json__/style_after_html.snap | 14 ++++ .../__printer_json__/style_before_html.snap | 14 ++++ .../__printer_json__/style_in_body.snap | 14 ++++ .../__printer_json__/style_in_html.snap | 14 ++++ internal/printer/printer_css_test.go | 10 +++ internal/printer/printer_test.go | 36 +++++---- internal/test_utils/test_utils.go | 77 +++++++++++++++++++ .../component_className_expression.snap | 14 ++++ .../component_className_not_scoped.snap | 14 ++++ .../component_className_shorthand.snap | 14 ++++ .../__js_scanner__/component_class_list.snap | 14 ++++ .../__js_scanner__/element_class_list.snap | 14 ++++ .../element_class_list_string.snap | 14 ++++ internal/transform/__js_scanner__/empty.snap | 14 ++++ .../__js_scanner__/expression_dynamic.snap | 14 ++++ .../__js_scanner__/expression_function.snap | 14 ++++ .../__js_scanner__/expression_string.snap | 14 ++++ .../fault_input_currently_accepted.snap | 14 ++++ internal/transform/__js_scanner__/none.snap | 14 ++++ internal/transform/__js_scanner__/quoted.snap | 14 ++++ .../__js_scanner__/quoted_no_trim.snap | 14 ++++ .../__js_scanner__/template_literal.snap | 14 ++++ .../transform/__scope-css__/_container.snap | 18 +++++ internal/transform/__scope-css__/_layer.snap | 14 ++++ internal/transform/__scope-css__/_root.snap | 14 ++++ .../__scope-css__/_starting-style.snap | 14 ++++ .../__scope-css__/adjacent_sibling.snap | 14 ++++ .../transform/__scope-css__/and_selector.snap | 14 ++++ internal/transform/__scope-css__/attr.snap | 14 ++++ .../__scope-css__/attr_universal_implied.snap | 14 ++++ .../transform/__scope-css__/attributes.snap | 14 ++++ internal/transform/__scope-css__/body.snap | 14 ++++ .../transform/__scope-css__/body_class.snap | 14 ++++ internal/transform/__scope-css__/calc.snap | 14 ++++ .../__scope-css__/chained__not__.snap | 14 ++++ internal/transform/__scope-css__/charset.snap | 14 ++++ .../__scope-css__/children_universal.snap | 14 ++++ internal/transform/__scope-css__/class.snap | 14 ++++ .../__scope-css__/class_chained_global.snap | 14 ++++ internal/transform/__scope-css__/element.snap | 14 ++++ .../element___pseudo_element.snap | 14 ++++ .../__scope-css__/element___pseudo_state.snap | 14 ++++ ...ement___pseudo_state___pseudo_element.snap | 14 ++++ .../__scope-css__/escaped_characters.snap | 14 ++++ .../__scope-css__/global_chaining_global.snap | 14 ++++ .../__scope-css__/global_children.snap | 14 ++++ .../__scope-css__/global_nested_parens.snap | 14 ++++ .../global_nested_parens___chained_class.snap | 14 ++++ .../__scope-css__/global_universal.snap | 14 ++++ .../global_with_scoped_children.snap | 14 ++++ .../__scope-css__/grid-template-columns.snap | 14 ++++ .../__scope-css__/html_and_body.snap | 14 ++++ internal/transform/__scope-css__/id.snap | 14 ++++ .../immediate_child_universal.snap | 14 ++++ .../__scope-css__/import__plain_.snap | 14 ++++ .../transform/__scope-css__/import__url_.snap | 14 ++++ .../invalid_CSS___missing_semi__.snap | 17 ++++ .../transform/__scope-css__/keyframes.snap | 14 ++++ .../transform/__scope-css__/keyframes_2.snap | 14 ++++ .../__scope-css__/keyframes_end.snap | 14 ++++ .../__scope-css__/keyframes_middle.snap | 14 ++++ .../__scope-css__/keyframes_start.snap | 14 ++++ .../transform/__scope-css__/media_query.snap | 14 ++++ .../__scope-css__/more_weird_chaining.snap | 14 ++++ .../__scope-css__/nesting_combinator.snap | 14 ++++ .../__scope-css__/nesting_media.snap | 14 ++++ .../__scope-css__/nesting_modifier.snap | 14 ++++ .../subsequent_siblings___global.snap | 14 ++++ .../__scope-css__/universal_pseudo_state.snap | 14 ++++ .../valid_CSS,_madeup_syntax.snap | 14 ++++ .../transform/__scope-css__/variables.snap | 14 ++++ .../__scope-css__/weird_chaining.snap | 14 ++++ .../component_className_expression.snap | 14 ++++ .../component_className_not_scoped.snap | 14 ++++ .../component_className_shorthand.snap | 14 ++++ .../__scope_html__/component_class_list.snap | 14 ++++ .../__scope_html__/element_class_list.snap | 14 ++++ .../element_class_list_string.snap | 14 ++++ internal/transform/__scope_html__/empty.snap | 14 ++++ .../__scope_html__/expression_dynamic.snap | 14 ++++ .../__scope_html__/expression_function.snap | 14 ++++ .../__scope_html__/expression_string.snap | 14 ++++ .../fault_input_currently_accepted.snap | 14 ++++ internal/transform/__scope_html__/none.snap | 14 ++++ internal/transform/__scope_html__/quoted.snap | 14 ++++ .../__scope_html__/quoted_no_trim.snap | 14 ++++ .../__scope_html__/template_literal.snap | 14 ++++ internal/transform/__transform__/basic.snap | 14 ++++ .../transform/__transform__/injects_root.snap | 14 ++++ .../__transform__/no_components.snap | 14 ++++ internal/transform/scope-css_test.go | 8 ++ internal/transform/scope-html_test.go | 10 +++ internal/transform/transform_test.go | 11 +++ 416 files changed, 1792 insertions(+), 17 deletions(-) create mode 100755 internal/js_scanner/__js_scanner__/array.snap create mode 100755 internal/js_scanner/__js_scanner__/basic.snap create mode 100755 internal/js_scanner/__js_scanner__/invalid_strings.snap create mode 100755 internal/js_scanner/__js_scanner__/literal.snap create mode 100755 internal/js_scanner/__js_scanner__/multiple.snap create mode 100755 internal/js_scanner/__js_scanner__/objects.snap create mode 100755 internal/js_scanner/__js_scanner__/regexp.snap create mode 100755 internal/js_scanner/__js_scanner__/shorhand.snap create mode 100755 internal/js_scanner/__js_scanner__/valid_strings.snap create mode 100755 internal/printer/__printer_css__/scopedStyleStrategy___attribute_.snap create mode 100755 internal/printer/__printer_css__/scopedStyleStrategy___class_.snap create mode 100755 internal/printer/__printer_css__/styles__no_frontmatter_.snap rename internal/printer/{__snapshots__ => __printer_js__}/All_components.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Component_is_raw.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Component_names_A-Z.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Component_siblings_are_siblings.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Empty_attribute_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Empty_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Empty_expression_with_whitespace.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Empty_script.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Empty_style.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Expression_in_form_followed_by_other_sibling_forms.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment_literal_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment_shorthand.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment_shorthand_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment_slotted.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Fragment_slotted_with_name.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/HTML_comment_in_component_inside_expression_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/HTML_comment_in_component_inside_expression_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Mixed_style_siblings.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Nested_HTML_in_expressions,_wrapped_in_parens.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/No_extra_script_tag.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Parser_can_handle_files___4096_chars.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Preserve_namespaces.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Preserve_namespaces_for_components.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Preserve_namespaces_in_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Preserve_slot_whitespace.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Preserve_slots_inside_custom-element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/React_framework_example.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/SVG_styles.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_components_in_head_can_have_siblings.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_components_siblings_are_siblings.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_formatting_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_formatting_elements_2.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_script_in_head_works.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_title.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Self-closing_title_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/Use_of_interfaces_within_frontmatter.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/XElement.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/_955_ternary_slot_with_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/_955_ternary_slot_with_text.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/advanced_svg_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/anchor_content.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/anchor_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/anchor_inside_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/attribute_with_template_literal.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/attribute_with_template_literal_interpolation.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/backtick_in_HTML_comment.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/basic__frontmatter_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/basic__no_frontmatter_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/basic_renderHead.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/caption_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_and_class_list_object.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_and_class_list_set.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_and_class_list_simple_array.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_list.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_list_with_spread.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/class_with_spread.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__default_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__multiple_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__named_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__namespace_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__namespaced_default_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/client_only_component__namespaced_named_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/comment_only_expressions_are_removed_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/comment_only_expressions_are_removed_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/comment_only_expressions_are_removed_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/comments_removed_from_attribute_list.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/complex_nested_template_literal_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/complex_recursive_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/complex_table.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/component_in_expression_with_its_child_expression_before_its_child_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/component_with_only_a_script.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/component_with_quoted_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/condition_expressions_at_the_top-level.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/condition_expressions_at_the_top-level_with_head_content.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/conditional_iframe.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/conditional_noscript.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/conditional_render.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/conditional_rendering_of_title_containing_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/conditional_slot.snap (100%) rename "internal/printer/__snapshots__/css_comment_doesn\342\200\231t_produce_semicolon.snap" => "internal/printer/__printer_js__/css_comment_doesn\342\200\231t_produce_semicolon.snap" (100%) rename internal/printer/{__snapshots__ => __printer_js__}/css_imports_are_not_included_in_module_metadata.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/custom-element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/custom_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_a_module_script_with_imports.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_non-root_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_script_with_StaticExpression_turned_on.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style_tag_with_style_empty_attribute_on_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style_tag_with_style_expression_attribute_on_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style_tag_with_style_quoted_attribute_on_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style_tag_with_style_shorthand_attribute_on_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/define_vars_on_style_tag_with_style_template_literal_attribute_on_element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/division_inside_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/doctype.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/dot_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/dynamic_import.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/escaped_entity.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/export_comments_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/export_comments_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/export_member_does_not_panic.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/expression_returning_multiple_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/expression_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/expression_with_leading_whitespace.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/expressions_with_JS_comments.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/expressions_with_multiple_curly_braces.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/function_expression_slots_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/function_expression_slots_II___959_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/getStaticPaths__basic_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/getStaticPaths__hoisted_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/getStaticPaths__hoisted_II_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/gets_all_potential_hydrated_components.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_expression_and_conditional_rendering_of_fragment.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_inside_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_slot_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/head_slot_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/html5_boilerplate.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/iframe.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/import.meta.env.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/import.meta.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/import_assertions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/import_order.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/import_to_identifier_named_assert.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/includes_comments_for_expression_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/includes_comments_for_shorthand_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/is_raw.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/map_basic.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/map_nested.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/map_with_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/map_without_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/maybeRenderHead_not_printed_for_hoisted_scripts.snap (100%) rename internal/printer/{__snapshots__/multibyte_character_+_script.snap => __printer_js__/multibyte_character___script.snap} (100%) rename internal/printer/{__snapshots__/multibyte_character_+_style.snap => __printer_js__/multibyte_character___style.snap} (100%) rename internal/printer/{__snapshots__ => __printer_js__}/multibyte_characters.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/multiple_define_vars_on_style.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_IV.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_V.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_VI.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_VII.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_expressions_VIII.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_head_content_stays_in_the_head.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/nested_template_literal_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/no_expressions_in_math.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/noscript_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/noscript_deep_styles.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/noscript_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/noscript_styles.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/orphan_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/passes_escaped_filename_into_createComponent_if_it_contains_single_quotes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/passes_filename_into_createComponent_if_passed_into_the_compiler_options.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/preserve_is_inline_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/preserve_is_inline_slot_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script__renderScript__true_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_before_elements.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_define_vars_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_define_vars_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_external__renderScript__true_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_hoist_with_frontmatter.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_hoist_without_frontmatter.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_in__head_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_inline.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_inline__renderScript__true_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_mixed_handled_and_inline__renderScript__true_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/script_multiple__renderScript__true_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/select_in_form.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/select_map_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/select_nested_option.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/select_option_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/self-closing_td.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_and_set_text.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Component_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Component_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Component_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Fragment.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Fragment_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Fragment_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_Fragment_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_custom-element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_custom-element_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_custom-element_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_custom-element_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_empty_tag.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_empty_tag_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_empty_tag_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_empty_tag_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_script.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_script_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_script_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_script_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_self-closing_tag.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_self-closing_tag_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_self-closing_tag_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_self-closing_tag_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_style.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_style_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_style_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_style_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_children.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_children_and_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_children_and_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_children_and_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_empty_whitespace.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_empty_whitespace_and_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_other_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_quoted_attribute_and_other_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_template_literal_attribute_with_variable_and_other_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_html_with_template_literal_attribute_without_variable_and_other_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_Component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_Component_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_Component_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_Component_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_custom-element.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_custom-element_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_custom-element_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_on_custom-element_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_with_quoted_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_with_template_literal_attribute_with_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/set_text_with_template_literal_attribute_without_variable.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/sibling_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/simple_ternary.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slot_inside_of_Base.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slot_with_fallback.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slot_with_fallback_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slot_with_fallback_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slot_with_quoted_attributes.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slots__basic_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slots__dynamic_name_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slots__expression_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slots__named_only_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/slots__no_comments_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/small_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/solidus_in_template_literal_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/spread_with_double_quotation_marks.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/spread_with_style_but_no_explicit_class.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/spread_without_style_or_class.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/styles__no_frontmatter_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/svg_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_IV.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_caption_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_expression_with_trailing_div.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_expressions__no_implicit_tbody_.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_simple_case.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_slot_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_slot_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_slot_III.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_slot_IV.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/table_slot_V.snap (100%) rename internal/printer/{__snapshots__/table_with_expression_in_'th'.snap => __printer_js__/table_with_expression_in__th_.snap} (100%) rename internal/printer/{__snapshots__ => __printer_js__}/tbody_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/tbody_expressions_2.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/tbody_expressions_3.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/td_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/td_expressions_II.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/template_literal_attribute_on_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/template_literal_attribute_with_variable_on_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/ternary_component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/ternary_layout.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/ternary_slot.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/text_after_title_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/text_after_title_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/text_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/textarea.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/textarea_in_form.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/textarea_inside_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/th_expressions.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/tr_only.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/trailing_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_animate_on_Component.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_animate_with_an_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_name_with_an_expression.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_name_with_an_template_literal.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_persist-props_converted_to_a_data_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_persist_converted_to_a_data_attribute.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/transition_persist_uses_transition_name_if_defined.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/type_import.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/unusual_line_terminator_I.snap (100%) rename internal/printer/{__snapshots__ => __printer_js__}/unusual_line_terminator_II.snap (100%) rename internal/printer/{__snapshots__/user-defined_`implicit`_is_printed.snap => __printer_js__/user-defined__implicit__is_printed.snap} (100%) create mode 100755 internal/printer/__printer_json__/Comment.snap create mode 100755 internal/printer/__printer_json__/Comment_preserves_whitespace.snap create mode 100755 internal/printer/__printer_json__/Component.snap create mode 100755 internal/printer/__printer_json__/Doctype.snap create mode 100755 internal/printer/__printer_json__/Fragment_Literal.snap create mode 100755 internal/printer/__printer_json__/Fragment_Shorthand.snap create mode 100755 internal/printer/__printer_json__/Frontmatter.snap create mode 100755 internal/printer/__printer_json__/JSON_escape.snap create mode 100755 internal/printer/__printer_json__/Preserve_namespaces.snap create mode 100755 internal/printer/__printer_json__/basic.snap create mode 100755 internal/printer/__printer_json__/custom-element.snap create mode 100755 internal/printer/__printer_json__/element_with_unterminated_double_quote_attribute.snap create mode 100755 internal/printer/__printer_json__/element_with_unterminated_single_quote_attribute.snap create mode 100755 internal/printer/__printer_json__/element_with_unterminated_template_literal_attribute.snap create mode 100755 internal/printer/__printer_json__/expression.snap create mode 100755 internal/printer/__printer_json__/style_after_html.snap create mode 100755 internal/printer/__printer_json__/style_before_html.snap create mode 100755 internal/printer/__printer_json__/style_in_body.snap create mode 100755 internal/printer/__printer_json__/style_in_html.snap create mode 100755 internal/transform/__js_scanner__/component_className_expression.snap create mode 100755 internal/transform/__js_scanner__/component_className_not_scoped.snap create mode 100755 internal/transform/__js_scanner__/component_className_shorthand.snap create mode 100755 internal/transform/__js_scanner__/component_class_list.snap create mode 100755 internal/transform/__js_scanner__/element_class_list.snap create mode 100755 internal/transform/__js_scanner__/element_class_list_string.snap create mode 100755 internal/transform/__js_scanner__/empty.snap create mode 100755 internal/transform/__js_scanner__/expression_dynamic.snap create mode 100755 internal/transform/__js_scanner__/expression_function.snap create mode 100755 internal/transform/__js_scanner__/expression_string.snap create mode 100755 internal/transform/__js_scanner__/fault_input_currently_accepted.snap create mode 100755 internal/transform/__js_scanner__/none.snap create mode 100755 internal/transform/__js_scanner__/quoted.snap create mode 100755 internal/transform/__js_scanner__/quoted_no_trim.snap create mode 100755 internal/transform/__js_scanner__/template_literal.snap create mode 100755 internal/transform/__scope-css__/_container.snap create mode 100755 internal/transform/__scope-css__/_layer.snap create mode 100755 internal/transform/__scope-css__/_root.snap create mode 100755 internal/transform/__scope-css__/_starting-style.snap create mode 100755 internal/transform/__scope-css__/adjacent_sibling.snap create mode 100755 internal/transform/__scope-css__/and_selector.snap create mode 100755 internal/transform/__scope-css__/attr.snap create mode 100755 internal/transform/__scope-css__/attr_universal_implied.snap create mode 100755 internal/transform/__scope-css__/attributes.snap create mode 100755 internal/transform/__scope-css__/body.snap create mode 100755 internal/transform/__scope-css__/body_class.snap create mode 100755 internal/transform/__scope-css__/calc.snap create mode 100755 internal/transform/__scope-css__/chained__not__.snap create mode 100755 internal/transform/__scope-css__/charset.snap create mode 100755 internal/transform/__scope-css__/children_universal.snap create mode 100755 internal/transform/__scope-css__/class.snap create mode 100755 internal/transform/__scope-css__/class_chained_global.snap create mode 100755 internal/transform/__scope-css__/element.snap create mode 100755 internal/transform/__scope-css__/element___pseudo_element.snap create mode 100755 internal/transform/__scope-css__/element___pseudo_state.snap create mode 100755 internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap create mode 100755 internal/transform/__scope-css__/escaped_characters.snap create mode 100755 internal/transform/__scope-css__/global_chaining_global.snap create mode 100755 internal/transform/__scope-css__/global_children.snap create mode 100755 internal/transform/__scope-css__/global_nested_parens.snap create mode 100755 internal/transform/__scope-css__/global_nested_parens___chained_class.snap create mode 100755 internal/transform/__scope-css__/global_universal.snap create mode 100755 internal/transform/__scope-css__/global_with_scoped_children.snap create mode 100755 internal/transform/__scope-css__/grid-template-columns.snap create mode 100755 internal/transform/__scope-css__/html_and_body.snap create mode 100755 internal/transform/__scope-css__/id.snap create mode 100755 internal/transform/__scope-css__/immediate_child_universal.snap create mode 100755 internal/transform/__scope-css__/import__plain_.snap create mode 100755 internal/transform/__scope-css__/import__url_.snap create mode 100755 internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap create mode 100755 internal/transform/__scope-css__/keyframes.snap create mode 100755 internal/transform/__scope-css__/keyframes_2.snap create mode 100755 internal/transform/__scope-css__/keyframes_end.snap create mode 100755 internal/transform/__scope-css__/keyframes_middle.snap create mode 100755 internal/transform/__scope-css__/keyframes_start.snap create mode 100755 internal/transform/__scope-css__/media_query.snap create mode 100755 internal/transform/__scope-css__/more_weird_chaining.snap create mode 100755 internal/transform/__scope-css__/nesting_combinator.snap create mode 100755 internal/transform/__scope-css__/nesting_media.snap create mode 100755 internal/transform/__scope-css__/nesting_modifier.snap create mode 100755 internal/transform/__scope-css__/subsequent_siblings___global.snap create mode 100755 internal/transform/__scope-css__/universal_pseudo_state.snap create mode 100755 internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap create mode 100755 internal/transform/__scope-css__/variables.snap create mode 100755 internal/transform/__scope-css__/weird_chaining.snap create mode 100755 internal/transform/__scope_html__/component_className_expression.snap create mode 100755 internal/transform/__scope_html__/component_className_not_scoped.snap create mode 100755 internal/transform/__scope_html__/component_className_shorthand.snap create mode 100755 internal/transform/__scope_html__/component_class_list.snap create mode 100755 internal/transform/__scope_html__/element_class_list.snap create mode 100755 internal/transform/__scope_html__/element_class_list_string.snap create mode 100755 internal/transform/__scope_html__/empty.snap create mode 100755 internal/transform/__scope_html__/expression_dynamic.snap create mode 100755 internal/transform/__scope_html__/expression_function.snap create mode 100755 internal/transform/__scope_html__/expression_string.snap create mode 100755 internal/transform/__scope_html__/fault_input_currently_accepted.snap create mode 100755 internal/transform/__scope_html__/none.snap create mode 100755 internal/transform/__scope_html__/quoted.snap create mode 100755 internal/transform/__scope_html__/quoted_no_trim.snap create mode 100755 internal/transform/__scope_html__/template_literal.snap create mode 100755 internal/transform/__transform__/basic.snap create mode 100755 internal/transform/__transform__/injects_root.snap create mode 100755 internal/transform/__transform__/no_components.snap diff --git a/internal/js_scanner/__js_scanner__/array.snap b/internal/js_scanner/__js_scanner__/array.snap new file mode 100755 index 000000000..e52bca2e6 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/array.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/array - 1] +## Input + +``` +{ a: [0, 1, 2], b: ["one", "two", "three"], c: 0 } +``` + +## Output + +```js +["a","b","c"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/basic.snap b/internal/js_scanner/__js_scanner__/basic.snap new file mode 100755 index 000000000..08a4d76e6 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/basic.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/basic - 1] +## Input + +``` +{ value } +``` + +## Output + +```js +["value"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/invalid_strings.snap b/internal/js_scanner/__js_scanner__/invalid_strings.snap new file mode 100755 index 000000000..31e047481 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/invalid_strings.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/invalid_strings - 1] +## Input + +``` +{ "dash-case": true, "with.dot": true, "with space": true } +``` + +## Output + +```js +["\"dash-case\": dashCase","\"with.dot\": withDot","\"with space\": withSpace"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/literal.snap b/internal/js_scanner/__js_scanner__/literal.snap new file mode 100755 index 000000000..c8187ed93 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/literal.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/literal - 1] +## Input + +``` +{ value: 0 } +``` + +## Output + +```js +["value"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/multiple.snap b/internal/js_scanner/__js_scanner__/multiple.snap new file mode 100755 index 000000000..72da6e75c --- /dev/null +++ b/internal/js_scanner/__js_scanner__/multiple.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/multiple - 1] +## Input + +``` +{ a: 0, b: 1, c: 2 } +``` + +## Output + +```js +["a","b","c"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/objects.snap b/internal/js_scanner/__js_scanner__/objects.snap new file mode 100755 index 000000000..fe22e4266 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/objects.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/objects - 1] +## Input + +``` +{ a: { a1: 0 }, b: { b1: { b2: 0 }}, c: { c1: { c2: { c3: 0 }}} } +``` + +## Output + +```js +["a","b","c"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/regexp.snap b/internal/js_scanner/__js_scanner__/regexp.snap new file mode 100755 index 000000000..af053d82c --- /dev/null +++ b/internal/js_scanner/__js_scanner__/regexp.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/regexp - 1] +## Input + +``` +{ a: /hello/g, b: 0 } +``` + +## Output + +```js +["a","b"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/shorhand.snap b/internal/js_scanner/__js_scanner__/shorhand.snap new file mode 100755 index 000000000..11f28b696 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/shorhand.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/shorhand - 1] +## Input + +``` +{ value, foo, bar, baz, bing } +``` + +## Output + +```js +["value","foo","bar","baz","bing"] +``` +--- diff --git a/internal/js_scanner/__js_scanner__/valid_strings.snap b/internal/js_scanner/__js_scanner__/valid_strings.snap new file mode 100755 index 000000000..c13ed8fa7 --- /dev/null +++ b/internal/js_scanner/__js_scanner__/valid_strings.snap @@ -0,0 +1,14 @@ + +[TestGetObjectKeys/valid_strings - 1] +## Input + +``` +{ "lowercase": true, "camelCase": true, "PascalCase": true, "snake_case": true, "__private": true, ["computed"]: true, } +``` + +## Output + +```js +["lowercase","camelCase","PascalCase","snake_case","__private","computed"] +``` +--- diff --git a/internal/js_scanner/js_scanner_test.go b/internal/js_scanner/js_scanner_test.go index a2208caa1..e2abf1435 100644 --- a/internal/js_scanner/js_scanner_test.go +++ b/internal/js_scanner/js_scanner_test.go @@ -661,6 +661,16 @@ func TestGetObjectKeys(t *testing.T) { if diff := test_utils.ANSIDiff(string(want), string(got)); diff != "" { t.Errorf("mismatch (-want +got):\n%s", diff) } + + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: tt.source, + Output: string(got), + Kind: test_utils.JsOutput, + FolderName: "__js_scanner__", + }) }) } } diff --git a/internal/printer/__printer_css__/scopedStyleStrategy___attribute_.snap b/internal/printer/__printer_css__/scopedStyleStrategy___attribute_.snap new file mode 100755 index 000000000..c1f675633 --- /dev/null +++ b/internal/printer/__printer_css__/scopedStyleStrategy___attribute_.snap @@ -0,0 +1,26 @@ + +[TestPrinterCSS/scopedStyleStrategy:_'attribute' - 1] +## Input + +``` + + +

Page Title

+

I’m a page

+``` + +## Output + +```css +.title[data-astro-cid-dpohflym]{font-family:fantasy;font-size:28px}.body[data-astro-cid-dpohflym]{font-size:1em} +``` +--- diff --git a/internal/printer/__printer_css__/scopedStyleStrategy___class_.snap b/internal/printer/__printer_css__/scopedStyleStrategy___class_.snap new file mode 100755 index 000000000..bdd3d3b8a --- /dev/null +++ b/internal/printer/__printer_css__/scopedStyleStrategy___class_.snap @@ -0,0 +1,26 @@ + +[TestPrinterCSS/scopedStyleStrategy:_'class' - 1] +## Input + +``` + + +

Page Title

+

I’m a page

+``` + +## Output + +```css +.title.astro-dpohflym{font-family:fantasy;font-size:28px}.body.astro-dpohflym{font-size:1em} +``` +--- diff --git a/internal/printer/__printer_css__/styles__no_frontmatter_.snap b/internal/printer/__printer_css__/styles__no_frontmatter_.snap new file mode 100755 index 000000000..a22544b8a --- /dev/null +++ b/internal/printer/__printer_css__/styles__no_frontmatter_.snap @@ -0,0 +1,26 @@ + +[TestPrinterCSS/styles_(no_frontmatter) - 1] +## Input + +``` + + +

Page Title

+

I’m a page

+``` + +## Output + +```css +.title:where(.astro-dpohflym){font-family:fantasy;font-size:28px}.body:where(.astro-dpohflym){font-size:1em} +``` +--- diff --git a/internal/printer/__snapshots__/All_components.snap b/internal/printer/__printer_js__/All_components.snap similarity index 100% rename from internal/printer/__snapshots__/All_components.snap rename to internal/printer/__printer_js__/All_components.snap diff --git a/internal/printer/__snapshots__/Component_is_raw.snap b/internal/printer/__printer_js__/Component_is_raw.snap similarity index 100% rename from internal/printer/__snapshots__/Component_is_raw.snap rename to internal/printer/__printer_js__/Component_is_raw.snap diff --git a/internal/printer/__snapshots__/Component_names_A-Z.snap b/internal/printer/__printer_js__/Component_names_A-Z.snap similarity index 100% rename from internal/printer/__snapshots__/Component_names_A-Z.snap rename to internal/printer/__printer_js__/Component_names_A-Z.snap diff --git a/internal/printer/__snapshots__/Component_siblings_are_siblings.snap b/internal/printer/__printer_js__/Component_siblings_are_siblings.snap similarity index 100% rename from internal/printer/__snapshots__/Component_siblings_are_siblings.snap rename to internal/printer/__printer_js__/Component_siblings_are_siblings.snap diff --git a/internal/printer/__snapshots__/Empty_attribute_expression.snap b/internal/printer/__printer_js__/Empty_attribute_expression.snap similarity index 100% rename from internal/printer/__snapshots__/Empty_attribute_expression.snap rename to internal/printer/__printer_js__/Empty_attribute_expression.snap diff --git a/internal/printer/__snapshots__/Empty_expression.snap b/internal/printer/__printer_js__/Empty_expression.snap similarity index 100% rename from internal/printer/__snapshots__/Empty_expression.snap rename to internal/printer/__printer_js__/Empty_expression.snap diff --git a/internal/printer/__snapshots__/Empty_expression_with_whitespace.snap b/internal/printer/__printer_js__/Empty_expression_with_whitespace.snap similarity index 100% rename from internal/printer/__snapshots__/Empty_expression_with_whitespace.snap rename to internal/printer/__printer_js__/Empty_expression_with_whitespace.snap diff --git a/internal/printer/__snapshots__/Empty_script.snap b/internal/printer/__printer_js__/Empty_script.snap similarity index 100% rename from internal/printer/__snapshots__/Empty_script.snap rename to internal/printer/__printer_js__/Empty_script.snap diff --git a/internal/printer/__snapshots__/Empty_style.snap b/internal/printer/__printer_js__/Empty_style.snap similarity index 100% rename from internal/printer/__snapshots__/Empty_style.snap rename to internal/printer/__printer_js__/Empty_style.snap diff --git a/internal/printer/__snapshots__/Expression_in_form_followed_by_other_sibling_forms.snap b/internal/printer/__printer_js__/Expression_in_form_followed_by_other_sibling_forms.snap similarity index 100% rename from internal/printer/__snapshots__/Expression_in_form_followed_by_other_sibling_forms.snap rename to internal/printer/__printer_js__/Expression_in_form_followed_by_other_sibling_forms.snap diff --git a/internal/printer/__snapshots__/Fragment.snap b/internal/printer/__printer_js__/Fragment.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment.snap rename to internal/printer/__printer_js__/Fragment.snap diff --git a/internal/printer/__snapshots__/Fragment_literal_only.snap b/internal/printer/__printer_js__/Fragment_literal_only.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment_literal_only.snap rename to internal/printer/__printer_js__/Fragment_literal_only.snap diff --git a/internal/printer/__snapshots__/Fragment_shorthand.snap b/internal/printer/__printer_js__/Fragment_shorthand.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment_shorthand.snap rename to internal/printer/__printer_js__/Fragment_shorthand.snap diff --git a/internal/printer/__snapshots__/Fragment_shorthand_only.snap b/internal/printer/__printer_js__/Fragment_shorthand_only.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment_shorthand_only.snap rename to internal/printer/__printer_js__/Fragment_shorthand_only.snap diff --git a/internal/printer/__snapshots__/Fragment_slotted.snap b/internal/printer/__printer_js__/Fragment_slotted.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment_slotted.snap rename to internal/printer/__printer_js__/Fragment_slotted.snap diff --git a/internal/printer/__snapshots__/Fragment_slotted_with_name.snap b/internal/printer/__printer_js__/Fragment_slotted_with_name.snap similarity index 100% rename from internal/printer/__snapshots__/Fragment_slotted_with_name.snap rename to internal/printer/__printer_js__/Fragment_slotted_with_name.snap diff --git a/internal/printer/__snapshots__/HTML_comment_in_component_inside_expression_I.snap b/internal/printer/__printer_js__/HTML_comment_in_component_inside_expression_I.snap similarity index 100% rename from internal/printer/__snapshots__/HTML_comment_in_component_inside_expression_I.snap rename to internal/printer/__printer_js__/HTML_comment_in_component_inside_expression_I.snap diff --git a/internal/printer/__snapshots__/HTML_comment_in_component_inside_expression_II.snap b/internal/printer/__printer_js__/HTML_comment_in_component_inside_expression_II.snap similarity index 100% rename from internal/printer/__snapshots__/HTML_comment_in_component_inside_expression_II.snap rename to internal/printer/__printer_js__/HTML_comment_in_component_inside_expression_II.snap diff --git a/internal/printer/__snapshots__/Mixed_style_siblings.snap b/internal/printer/__printer_js__/Mixed_style_siblings.snap similarity index 100% rename from internal/printer/__snapshots__/Mixed_style_siblings.snap rename to internal/printer/__printer_js__/Mixed_style_siblings.snap diff --git a/internal/printer/__snapshots__/Nested_HTML_in_expressions,_wrapped_in_parens.snap b/internal/printer/__printer_js__/Nested_HTML_in_expressions,_wrapped_in_parens.snap similarity index 100% rename from internal/printer/__snapshots__/Nested_HTML_in_expressions,_wrapped_in_parens.snap rename to internal/printer/__printer_js__/Nested_HTML_in_expressions,_wrapped_in_parens.snap diff --git a/internal/printer/__snapshots__/No_extra_script_tag.snap b/internal/printer/__printer_js__/No_extra_script_tag.snap similarity index 100% rename from internal/printer/__snapshots__/No_extra_script_tag.snap rename to internal/printer/__printer_js__/No_extra_script_tag.snap diff --git a/internal/printer/__snapshots__/Parser_can_handle_files___4096_chars.snap b/internal/printer/__printer_js__/Parser_can_handle_files___4096_chars.snap similarity index 100% rename from internal/printer/__snapshots__/Parser_can_handle_files___4096_chars.snap rename to internal/printer/__printer_js__/Parser_can_handle_files___4096_chars.snap diff --git a/internal/printer/__snapshots__/Preserve_namespaces.snap b/internal/printer/__printer_js__/Preserve_namespaces.snap similarity index 100% rename from internal/printer/__snapshots__/Preserve_namespaces.snap rename to internal/printer/__printer_js__/Preserve_namespaces.snap diff --git a/internal/printer/__snapshots__/Preserve_namespaces_for_components.snap b/internal/printer/__printer_js__/Preserve_namespaces_for_components.snap similarity index 100% rename from internal/printer/__snapshots__/Preserve_namespaces_for_components.snap rename to internal/printer/__printer_js__/Preserve_namespaces_for_components.snap diff --git a/internal/printer/__snapshots__/Preserve_namespaces_in_expressions.snap b/internal/printer/__printer_js__/Preserve_namespaces_in_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/Preserve_namespaces_in_expressions.snap rename to internal/printer/__printer_js__/Preserve_namespaces_in_expressions.snap diff --git a/internal/printer/__snapshots__/Preserve_slot_whitespace.snap b/internal/printer/__printer_js__/Preserve_slot_whitespace.snap similarity index 100% rename from internal/printer/__snapshots__/Preserve_slot_whitespace.snap rename to internal/printer/__printer_js__/Preserve_slot_whitespace.snap diff --git a/internal/printer/__snapshots__/Preserve_slots_inside_custom-element.snap b/internal/printer/__printer_js__/Preserve_slots_inside_custom-element.snap similarity index 100% rename from internal/printer/__snapshots__/Preserve_slots_inside_custom-element.snap rename to internal/printer/__printer_js__/Preserve_slots_inside_custom-element.snap diff --git a/internal/printer/__snapshots__/React_framework_example.snap b/internal/printer/__printer_js__/React_framework_example.snap similarity index 100% rename from internal/printer/__snapshots__/React_framework_example.snap rename to internal/printer/__printer_js__/React_framework_example.snap diff --git a/internal/printer/__snapshots__/SVG_styles.snap b/internal/printer/__printer_js__/SVG_styles.snap similarity index 100% rename from internal/printer/__snapshots__/SVG_styles.snap rename to internal/printer/__printer_js__/SVG_styles.snap diff --git a/internal/printer/__snapshots__/Self-closing_components_in_head_can_have_siblings.snap b/internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_components_in_head_can_have_siblings.snap rename to internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap diff --git a/internal/printer/__snapshots__/Self-closing_components_siblings_are_siblings.snap b/internal/printer/__printer_js__/Self-closing_components_siblings_are_siblings.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_components_siblings_are_siblings.snap rename to internal/printer/__printer_js__/Self-closing_components_siblings_are_siblings.snap diff --git a/internal/printer/__snapshots__/Self-closing_formatting_elements.snap b/internal/printer/__printer_js__/Self-closing_formatting_elements.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_formatting_elements.snap rename to internal/printer/__printer_js__/Self-closing_formatting_elements.snap diff --git a/internal/printer/__snapshots__/Self-closing_formatting_elements_2.snap b/internal/printer/__printer_js__/Self-closing_formatting_elements_2.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_formatting_elements_2.snap rename to internal/printer/__printer_js__/Self-closing_formatting_elements_2.snap diff --git a/internal/printer/__snapshots__/Self-closing_script_in_head_works.snap b/internal/printer/__printer_js__/Self-closing_script_in_head_works.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_script_in_head_works.snap rename to internal/printer/__printer_js__/Self-closing_script_in_head_works.snap diff --git a/internal/printer/__snapshots__/Self-closing_title.snap b/internal/printer/__printer_js__/Self-closing_title.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_title.snap rename to internal/printer/__printer_js__/Self-closing_title.snap diff --git a/internal/printer/__snapshots__/Self-closing_title_II.snap b/internal/printer/__printer_js__/Self-closing_title_II.snap similarity index 100% rename from internal/printer/__snapshots__/Self-closing_title_II.snap rename to internal/printer/__printer_js__/Self-closing_title_II.snap diff --git a/internal/printer/__snapshots__/Use_of_interfaces_within_frontmatter.snap b/internal/printer/__printer_js__/Use_of_interfaces_within_frontmatter.snap similarity index 100% rename from internal/printer/__snapshots__/Use_of_interfaces_within_frontmatter.snap rename to internal/printer/__printer_js__/Use_of_interfaces_within_frontmatter.snap diff --git a/internal/printer/__snapshots__/XElement.snap b/internal/printer/__printer_js__/XElement.snap similarity index 100% rename from internal/printer/__snapshots__/XElement.snap rename to internal/printer/__printer_js__/XElement.snap diff --git a/internal/printer/__snapshots__/_955_ternary_slot_with_elements.snap b/internal/printer/__printer_js__/_955_ternary_slot_with_elements.snap similarity index 100% rename from internal/printer/__snapshots__/_955_ternary_slot_with_elements.snap rename to internal/printer/__printer_js__/_955_ternary_slot_with_elements.snap diff --git a/internal/printer/__snapshots__/_955_ternary_slot_with_text.snap b/internal/printer/__printer_js__/_955_ternary_slot_with_text.snap similarity index 100% rename from internal/printer/__snapshots__/_955_ternary_slot_with_text.snap rename to internal/printer/__printer_js__/_955_ternary_slot_with_text.snap diff --git a/internal/printer/__snapshots__/advanced_svg_expression.snap b/internal/printer/__printer_js__/advanced_svg_expression.snap similarity index 100% rename from internal/printer/__snapshots__/advanced_svg_expression.snap rename to internal/printer/__printer_js__/advanced_svg_expression.snap diff --git a/internal/printer/__snapshots__/anchor_content.snap b/internal/printer/__printer_js__/anchor_content.snap similarity index 100% rename from internal/printer/__snapshots__/anchor_content.snap rename to internal/printer/__printer_js__/anchor_content.snap diff --git a/internal/printer/__snapshots__/anchor_expressions.snap b/internal/printer/__printer_js__/anchor_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/anchor_expressions.snap rename to internal/printer/__printer_js__/anchor_expressions.snap diff --git a/internal/printer/__snapshots__/anchor_inside_expression.snap b/internal/printer/__printer_js__/anchor_inside_expression.snap similarity index 100% rename from internal/printer/__snapshots__/anchor_inside_expression.snap rename to internal/printer/__printer_js__/anchor_inside_expression.snap diff --git a/internal/printer/__snapshots__/attribute_with_template_literal.snap b/internal/printer/__printer_js__/attribute_with_template_literal.snap similarity index 100% rename from internal/printer/__snapshots__/attribute_with_template_literal.snap rename to internal/printer/__printer_js__/attribute_with_template_literal.snap diff --git a/internal/printer/__snapshots__/attribute_with_template_literal_interpolation.snap b/internal/printer/__printer_js__/attribute_with_template_literal_interpolation.snap similarity index 100% rename from internal/printer/__snapshots__/attribute_with_template_literal_interpolation.snap rename to internal/printer/__printer_js__/attribute_with_template_literal_interpolation.snap diff --git a/internal/printer/__snapshots__/backtick_in_HTML_comment.snap b/internal/printer/__printer_js__/backtick_in_HTML_comment.snap similarity index 100% rename from internal/printer/__snapshots__/backtick_in_HTML_comment.snap rename to internal/printer/__printer_js__/backtick_in_HTML_comment.snap diff --git a/internal/printer/__snapshots__/basic__frontmatter_.snap b/internal/printer/__printer_js__/basic__frontmatter_.snap similarity index 100% rename from internal/printer/__snapshots__/basic__frontmatter_.snap rename to internal/printer/__printer_js__/basic__frontmatter_.snap diff --git a/internal/printer/__snapshots__/basic__no_frontmatter_.snap b/internal/printer/__printer_js__/basic__no_frontmatter_.snap similarity index 100% rename from internal/printer/__snapshots__/basic__no_frontmatter_.snap rename to internal/printer/__printer_js__/basic__no_frontmatter_.snap diff --git a/internal/printer/__snapshots__/basic_renderHead.snap b/internal/printer/__printer_js__/basic_renderHead.snap similarity index 100% rename from internal/printer/__snapshots__/basic_renderHead.snap rename to internal/printer/__printer_js__/basic_renderHead.snap diff --git a/internal/printer/__snapshots__/caption_only.snap b/internal/printer/__printer_js__/caption_only.snap similarity index 100% rename from internal/printer/__snapshots__/caption_only.snap rename to internal/printer/__printer_js__/caption_only.snap diff --git a/internal/printer/__snapshots__/class_and_class_list_object.snap b/internal/printer/__printer_js__/class_and_class_list_object.snap similarity index 100% rename from internal/printer/__snapshots__/class_and_class_list_object.snap rename to internal/printer/__printer_js__/class_and_class_list_object.snap diff --git a/internal/printer/__snapshots__/class_and_class_list_set.snap b/internal/printer/__printer_js__/class_and_class_list_set.snap similarity index 100% rename from internal/printer/__snapshots__/class_and_class_list_set.snap rename to internal/printer/__printer_js__/class_and_class_list_set.snap diff --git a/internal/printer/__snapshots__/class_and_class_list_simple_array.snap b/internal/printer/__printer_js__/class_and_class_list_simple_array.snap similarity index 100% rename from internal/printer/__snapshots__/class_and_class_list_simple_array.snap rename to internal/printer/__printer_js__/class_and_class_list_simple_array.snap diff --git a/internal/printer/__snapshots__/class_list.snap b/internal/printer/__printer_js__/class_list.snap similarity index 100% rename from internal/printer/__snapshots__/class_list.snap rename to internal/printer/__printer_js__/class_list.snap diff --git a/internal/printer/__snapshots__/class_list_with_spread.snap b/internal/printer/__printer_js__/class_list_with_spread.snap similarity index 100% rename from internal/printer/__snapshots__/class_list_with_spread.snap rename to internal/printer/__printer_js__/class_list_with_spread.snap diff --git a/internal/printer/__snapshots__/class_with_spread.snap b/internal/printer/__printer_js__/class_with_spread.snap similarity index 100% rename from internal/printer/__snapshots__/class_with_spread.snap rename to internal/printer/__printer_js__/class_with_spread.snap diff --git a/internal/printer/__snapshots__/client_only_component__default_.snap b/internal/printer/__printer_js__/client_only_component__default_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__default_.snap rename to internal/printer/__printer_js__/client_only_component__default_.snap diff --git a/internal/printer/__snapshots__/client_only_component__multiple_.snap b/internal/printer/__printer_js__/client_only_component__multiple_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__multiple_.snap rename to internal/printer/__printer_js__/client_only_component__multiple_.snap diff --git a/internal/printer/__snapshots__/client_only_component__named_.snap b/internal/printer/__printer_js__/client_only_component__named_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__named_.snap rename to internal/printer/__printer_js__/client_only_component__named_.snap diff --git a/internal/printer/__snapshots__/client_only_component__namespace_.snap b/internal/printer/__printer_js__/client_only_component__namespace_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__namespace_.snap rename to internal/printer/__printer_js__/client_only_component__namespace_.snap diff --git a/internal/printer/__snapshots__/client_only_component__namespaced_default_.snap b/internal/printer/__printer_js__/client_only_component__namespaced_default_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__namespaced_default_.snap rename to internal/printer/__printer_js__/client_only_component__namespaced_default_.snap diff --git a/internal/printer/__snapshots__/client_only_component__namespaced_named_.snap b/internal/printer/__printer_js__/client_only_component__namespaced_named_.snap similarity index 100% rename from internal/printer/__snapshots__/client_only_component__namespaced_named_.snap rename to internal/printer/__printer_js__/client_only_component__namespaced_named_.snap diff --git a/internal/printer/__snapshots__/comment_only_expressions_are_removed_I.snap b/internal/printer/__printer_js__/comment_only_expressions_are_removed_I.snap similarity index 100% rename from internal/printer/__snapshots__/comment_only_expressions_are_removed_I.snap rename to internal/printer/__printer_js__/comment_only_expressions_are_removed_I.snap diff --git a/internal/printer/__snapshots__/comment_only_expressions_are_removed_II.snap b/internal/printer/__printer_js__/comment_only_expressions_are_removed_II.snap similarity index 100% rename from internal/printer/__snapshots__/comment_only_expressions_are_removed_II.snap rename to internal/printer/__printer_js__/comment_only_expressions_are_removed_II.snap diff --git a/internal/printer/__snapshots__/comment_only_expressions_are_removed_III.snap b/internal/printer/__printer_js__/comment_only_expressions_are_removed_III.snap similarity index 100% rename from internal/printer/__snapshots__/comment_only_expressions_are_removed_III.snap rename to internal/printer/__printer_js__/comment_only_expressions_are_removed_III.snap diff --git a/internal/printer/__snapshots__/comments_removed_from_attribute_list.snap b/internal/printer/__printer_js__/comments_removed_from_attribute_list.snap similarity index 100% rename from internal/printer/__snapshots__/comments_removed_from_attribute_list.snap rename to internal/printer/__printer_js__/comments_removed_from_attribute_list.snap diff --git a/internal/printer/__snapshots__/complex_nested_template_literal_expression.snap b/internal/printer/__printer_js__/complex_nested_template_literal_expression.snap similarity index 100% rename from internal/printer/__snapshots__/complex_nested_template_literal_expression.snap rename to internal/printer/__printer_js__/complex_nested_template_literal_expression.snap diff --git a/internal/printer/__snapshots__/complex_recursive_component.snap b/internal/printer/__printer_js__/complex_recursive_component.snap similarity index 100% rename from internal/printer/__snapshots__/complex_recursive_component.snap rename to internal/printer/__printer_js__/complex_recursive_component.snap diff --git a/internal/printer/__snapshots__/complex_table.snap b/internal/printer/__printer_js__/complex_table.snap similarity index 100% rename from internal/printer/__snapshots__/complex_table.snap rename to internal/printer/__printer_js__/complex_table.snap diff --git a/internal/printer/__snapshots__/component.snap b/internal/printer/__printer_js__/component.snap similarity index 100% rename from internal/printer/__snapshots__/component.snap rename to internal/printer/__printer_js__/component.snap diff --git a/internal/printer/__snapshots__/component_in_expression_with_its_child_expression_before_its_child_element.snap b/internal/printer/__printer_js__/component_in_expression_with_its_child_expression_before_its_child_element.snap similarity index 100% rename from internal/printer/__snapshots__/component_in_expression_with_its_child_expression_before_its_child_element.snap rename to internal/printer/__printer_js__/component_in_expression_with_its_child_expression_before_its_child_element.snap diff --git a/internal/printer/__snapshots__/component_with_only_a_script.snap b/internal/printer/__printer_js__/component_with_only_a_script.snap similarity index 100% rename from internal/printer/__snapshots__/component_with_only_a_script.snap rename to internal/printer/__printer_js__/component_with_only_a_script.snap diff --git a/internal/printer/__snapshots__/component_with_quoted_attributes.snap b/internal/printer/__printer_js__/component_with_quoted_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/component_with_quoted_attributes.snap rename to internal/printer/__printer_js__/component_with_quoted_attributes.snap diff --git a/internal/printer/__snapshots__/condition_expressions_at_the_top-level.snap b/internal/printer/__printer_js__/condition_expressions_at_the_top-level.snap similarity index 100% rename from internal/printer/__snapshots__/condition_expressions_at_the_top-level.snap rename to internal/printer/__printer_js__/condition_expressions_at_the_top-level.snap diff --git a/internal/printer/__snapshots__/condition_expressions_at_the_top-level_with_head_content.snap b/internal/printer/__printer_js__/condition_expressions_at_the_top-level_with_head_content.snap similarity index 100% rename from internal/printer/__snapshots__/condition_expressions_at_the_top-level_with_head_content.snap rename to internal/printer/__printer_js__/condition_expressions_at_the_top-level_with_head_content.snap diff --git a/internal/printer/__snapshots__/conditional_iframe.snap b/internal/printer/__printer_js__/conditional_iframe.snap similarity index 100% rename from internal/printer/__snapshots__/conditional_iframe.snap rename to internal/printer/__printer_js__/conditional_iframe.snap diff --git a/internal/printer/__snapshots__/conditional_noscript.snap b/internal/printer/__printer_js__/conditional_noscript.snap similarity index 100% rename from internal/printer/__snapshots__/conditional_noscript.snap rename to internal/printer/__printer_js__/conditional_noscript.snap diff --git a/internal/printer/__snapshots__/conditional_render.snap b/internal/printer/__printer_js__/conditional_render.snap similarity index 100% rename from internal/printer/__snapshots__/conditional_render.snap rename to internal/printer/__printer_js__/conditional_render.snap diff --git a/internal/printer/__snapshots__/conditional_rendering_of_title_containing_expression.snap b/internal/printer/__printer_js__/conditional_rendering_of_title_containing_expression.snap similarity index 100% rename from internal/printer/__snapshots__/conditional_rendering_of_title_containing_expression.snap rename to internal/printer/__printer_js__/conditional_rendering_of_title_containing_expression.snap diff --git a/internal/printer/__snapshots__/conditional_slot.snap b/internal/printer/__printer_js__/conditional_slot.snap similarity index 100% rename from internal/printer/__snapshots__/conditional_slot.snap rename to internal/printer/__printer_js__/conditional_slot.snap diff --git "a/internal/printer/__snapshots__/css_comment_doesn\342\200\231t_produce_semicolon.snap" "b/internal/printer/__printer_js__/css_comment_doesn\342\200\231t_produce_semicolon.snap" similarity index 100% rename from "internal/printer/__snapshots__/css_comment_doesn\342\200\231t_produce_semicolon.snap" rename to "internal/printer/__printer_js__/css_comment_doesn\342\200\231t_produce_semicolon.snap" diff --git a/internal/printer/__snapshots__/css_imports_are_not_included_in_module_metadata.snap b/internal/printer/__printer_js__/css_imports_are_not_included_in_module_metadata.snap similarity index 100% rename from internal/printer/__snapshots__/css_imports_are_not_included_in_module_metadata.snap rename to internal/printer/__printer_js__/css_imports_are_not_included_in_module_metadata.snap diff --git a/internal/printer/__snapshots__/custom-element.snap b/internal/printer/__printer_js__/custom-element.snap similarity index 100% rename from internal/printer/__snapshots__/custom-element.snap rename to internal/printer/__printer_js__/custom-element.snap diff --git a/internal/printer/__snapshots__/custom_elements.snap b/internal/printer/__printer_js__/custom_elements.snap similarity index 100% rename from internal/printer/__snapshots__/custom_elements.snap rename to internal/printer/__printer_js__/custom_elements.snap diff --git a/internal/printer/__snapshots__/define_vars_on_a_module_script_with_imports.snap b/internal/printer/__printer_js__/define_vars_on_a_module_script_with_imports.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_a_module_script_with_imports.snap rename to internal/printer/__printer_js__/define_vars_on_a_module_script_with_imports.snap diff --git a/internal/printer/__snapshots__/define_vars_on_non-root_elements.snap b/internal/printer/__printer_js__/define_vars_on_non-root_elements.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_non-root_elements.snap rename to internal/printer/__printer_js__/define_vars_on_non-root_elements.snap diff --git a/internal/printer/__snapshots__/define_vars_on_script_with_StaticExpression_turned_on.snap b/internal/printer/__printer_js__/define_vars_on_script_with_StaticExpression_turned_on.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_script_with_StaticExpression_turned_on.snap rename to internal/printer/__printer_js__/define_vars_on_script_with_StaticExpression_turned_on.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style.snap b/internal/printer/__printer_js__/define_vars_on_style.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style.snap rename to internal/printer/__printer_js__/define_vars_on_style.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style_tag_with_style_empty_attribute_on_element.snap b/internal/printer/__printer_js__/define_vars_on_style_tag_with_style_empty_attribute_on_element.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style_tag_with_style_empty_attribute_on_element.snap rename to internal/printer/__printer_js__/define_vars_on_style_tag_with_style_empty_attribute_on_element.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style_tag_with_style_expression_attribute_on_element.snap b/internal/printer/__printer_js__/define_vars_on_style_tag_with_style_expression_attribute_on_element.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style_tag_with_style_expression_attribute_on_element.snap rename to internal/printer/__printer_js__/define_vars_on_style_tag_with_style_expression_attribute_on_element.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style_tag_with_style_quoted_attribute_on_element.snap b/internal/printer/__printer_js__/define_vars_on_style_tag_with_style_quoted_attribute_on_element.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style_tag_with_style_quoted_attribute_on_element.snap rename to internal/printer/__printer_js__/define_vars_on_style_tag_with_style_quoted_attribute_on_element.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style_tag_with_style_shorthand_attribute_on_element.snap b/internal/printer/__printer_js__/define_vars_on_style_tag_with_style_shorthand_attribute_on_element.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style_tag_with_style_shorthand_attribute_on_element.snap rename to internal/printer/__printer_js__/define_vars_on_style_tag_with_style_shorthand_attribute_on_element.snap diff --git a/internal/printer/__snapshots__/define_vars_on_style_tag_with_style_template_literal_attribute_on_element.snap b/internal/printer/__printer_js__/define_vars_on_style_tag_with_style_template_literal_attribute_on_element.snap similarity index 100% rename from internal/printer/__snapshots__/define_vars_on_style_tag_with_style_template_literal_attribute_on_element.snap rename to internal/printer/__printer_js__/define_vars_on_style_tag_with_style_template_literal_attribute_on_element.snap diff --git a/internal/printer/__snapshots__/division_inside_expression.snap b/internal/printer/__printer_js__/division_inside_expression.snap similarity index 100% rename from internal/printer/__snapshots__/division_inside_expression.snap rename to internal/printer/__printer_js__/division_inside_expression.snap diff --git a/internal/printer/__snapshots__/doctype.snap b/internal/printer/__printer_js__/doctype.snap similarity index 100% rename from internal/printer/__snapshots__/doctype.snap rename to internal/printer/__printer_js__/doctype.snap diff --git a/internal/printer/__snapshots__/dot_component.snap b/internal/printer/__printer_js__/dot_component.snap similarity index 100% rename from internal/printer/__snapshots__/dot_component.snap rename to internal/printer/__printer_js__/dot_component.snap diff --git a/internal/printer/__snapshots__/dynamic_import.snap b/internal/printer/__printer_js__/dynamic_import.snap similarity index 100% rename from internal/printer/__snapshots__/dynamic_import.snap rename to internal/printer/__printer_js__/dynamic_import.snap diff --git a/internal/printer/__snapshots__/escaped_entity.snap b/internal/printer/__printer_js__/escaped_entity.snap similarity index 100% rename from internal/printer/__snapshots__/escaped_entity.snap rename to internal/printer/__printer_js__/escaped_entity.snap diff --git a/internal/printer/__snapshots__/export_comments_I.snap b/internal/printer/__printer_js__/export_comments_I.snap similarity index 100% rename from internal/printer/__snapshots__/export_comments_I.snap rename to internal/printer/__printer_js__/export_comments_I.snap diff --git a/internal/printer/__snapshots__/export_comments_II.snap b/internal/printer/__printer_js__/export_comments_II.snap similarity index 100% rename from internal/printer/__snapshots__/export_comments_II.snap rename to internal/printer/__printer_js__/export_comments_II.snap diff --git a/internal/printer/__snapshots__/export_member_does_not_panic.snap b/internal/printer/__printer_js__/export_member_does_not_panic.snap similarity index 100% rename from internal/printer/__snapshots__/export_member_does_not_panic.snap rename to internal/printer/__printer_js__/export_member_does_not_panic.snap diff --git a/internal/printer/__snapshots__/expression_returning_multiple_elements.snap b/internal/printer/__printer_js__/expression_returning_multiple_elements.snap similarity index 100% rename from internal/printer/__snapshots__/expression_returning_multiple_elements.snap rename to internal/printer/__printer_js__/expression_returning_multiple_elements.snap diff --git a/internal/printer/__snapshots__/expression_slot.snap b/internal/printer/__printer_js__/expression_slot.snap similarity index 100% rename from internal/printer/__snapshots__/expression_slot.snap rename to internal/printer/__printer_js__/expression_slot.snap diff --git a/internal/printer/__snapshots__/expression_with_leading_whitespace.snap b/internal/printer/__printer_js__/expression_with_leading_whitespace.snap similarity index 100% rename from internal/printer/__snapshots__/expression_with_leading_whitespace.snap rename to internal/printer/__printer_js__/expression_with_leading_whitespace.snap diff --git a/internal/printer/__snapshots__/expressions_with_JS_comments.snap b/internal/printer/__printer_js__/expressions_with_JS_comments.snap similarity index 100% rename from internal/printer/__snapshots__/expressions_with_JS_comments.snap rename to internal/printer/__printer_js__/expressions_with_JS_comments.snap diff --git a/internal/printer/__snapshots__/expressions_with_multiple_curly_braces.snap b/internal/printer/__printer_js__/expressions_with_multiple_curly_braces.snap similarity index 100% rename from internal/printer/__snapshots__/expressions_with_multiple_curly_braces.snap rename to internal/printer/__printer_js__/expressions_with_multiple_curly_braces.snap diff --git a/internal/printer/__snapshots__/function_expression_slots_I.snap b/internal/printer/__printer_js__/function_expression_slots_I.snap similarity index 100% rename from internal/printer/__snapshots__/function_expression_slots_I.snap rename to internal/printer/__printer_js__/function_expression_slots_I.snap diff --git a/internal/printer/__snapshots__/function_expression_slots_II___959_.snap b/internal/printer/__printer_js__/function_expression_slots_II___959_.snap similarity index 100% rename from internal/printer/__snapshots__/function_expression_slots_II___959_.snap rename to internal/printer/__printer_js__/function_expression_slots_II___959_.snap diff --git a/internal/printer/__snapshots__/getStaticPaths__basic_.snap b/internal/printer/__printer_js__/getStaticPaths__basic_.snap similarity index 100% rename from internal/printer/__snapshots__/getStaticPaths__basic_.snap rename to internal/printer/__printer_js__/getStaticPaths__basic_.snap diff --git a/internal/printer/__snapshots__/getStaticPaths__hoisted_.snap b/internal/printer/__printer_js__/getStaticPaths__hoisted_.snap similarity index 100% rename from internal/printer/__snapshots__/getStaticPaths__hoisted_.snap rename to internal/printer/__printer_js__/getStaticPaths__hoisted_.snap diff --git a/internal/printer/__snapshots__/getStaticPaths__hoisted_II_.snap b/internal/printer/__printer_js__/getStaticPaths__hoisted_II_.snap similarity index 100% rename from internal/printer/__snapshots__/getStaticPaths__hoisted_II_.snap rename to internal/printer/__printer_js__/getStaticPaths__hoisted_II_.snap diff --git a/internal/printer/__snapshots__/gets_all_potential_hydrated_components.snap b/internal/printer/__printer_js__/gets_all_potential_hydrated_components.snap similarity index 100% rename from internal/printer/__snapshots__/gets_all_potential_hydrated_components.snap rename to internal/printer/__printer_js__/gets_all_potential_hydrated_components.snap diff --git a/internal/printer/__snapshots__/head_expression.snap b/internal/printer/__printer_js__/head_expression.snap similarity index 100% rename from internal/printer/__snapshots__/head_expression.snap rename to internal/printer/__printer_js__/head_expression.snap diff --git a/internal/printer/__snapshots__/head_expression_and_conditional_rendering_of_fragment.snap b/internal/printer/__printer_js__/head_expression_and_conditional_rendering_of_fragment.snap similarity index 100% rename from internal/printer/__snapshots__/head_expression_and_conditional_rendering_of_fragment.snap rename to internal/printer/__printer_js__/head_expression_and_conditional_rendering_of_fragment.snap diff --git a/internal/printer/__snapshots__/head_inside_slot.snap b/internal/printer/__printer_js__/head_inside_slot.snap similarity index 100% rename from internal/printer/__snapshots__/head_inside_slot.snap rename to internal/printer/__printer_js__/head_inside_slot.snap diff --git a/internal/printer/__snapshots__/head_slot.snap b/internal/printer/__printer_js__/head_slot.snap similarity index 100% rename from internal/printer/__snapshots__/head_slot.snap rename to internal/printer/__printer_js__/head_slot.snap diff --git a/internal/printer/__snapshots__/head_slot_II.snap b/internal/printer/__printer_js__/head_slot_II.snap similarity index 100% rename from internal/printer/__snapshots__/head_slot_II.snap rename to internal/printer/__printer_js__/head_slot_II.snap diff --git a/internal/printer/__snapshots__/head_slot_III.snap b/internal/printer/__printer_js__/head_slot_III.snap similarity index 100% rename from internal/printer/__snapshots__/head_slot_III.snap rename to internal/printer/__printer_js__/head_slot_III.snap diff --git a/internal/printer/__snapshots__/html5_boilerplate.snap b/internal/printer/__printer_js__/html5_boilerplate.snap similarity index 100% rename from internal/printer/__snapshots__/html5_boilerplate.snap rename to internal/printer/__printer_js__/html5_boilerplate.snap diff --git a/internal/printer/__snapshots__/iframe.snap b/internal/printer/__printer_js__/iframe.snap similarity index 100% rename from internal/printer/__snapshots__/iframe.snap rename to internal/printer/__printer_js__/iframe.snap diff --git a/internal/printer/__snapshots__/import.meta.env.snap b/internal/printer/__printer_js__/import.meta.env.snap similarity index 100% rename from internal/printer/__snapshots__/import.meta.env.snap rename to internal/printer/__printer_js__/import.meta.env.snap diff --git a/internal/printer/__snapshots__/import.meta.snap b/internal/printer/__printer_js__/import.meta.snap similarity index 100% rename from internal/printer/__snapshots__/import.meta.snap rename to internal/printer/__printer_js__/import.meta.snap diff --git a/internal/printer/__snapshots__/import_assertions.snap b/internal/printer/__printer_js__/import_assertions.snap similarity index 100% rename from internal/printer/__snapshots__/import_assertions.snap rename to internal/printer/__printer_js__/import_assertions.snap diff --git a/internal/printer/__snapshots__/import_order.snap b/internal/printer/__printer_js__/import_order.snap similarity index 100% rename from internal/printer/__snapshots__/import_order.snap rename to internal/printer/__printer_js__/import_order.snap diff --git a/internal/printer/__snapshots__/import_to_identifier_named_assert.snap b/internal/printer/__printer_js__/import_to_identifier_named_assert.snap similarity index 100% rename from internal/printer/__snapshots__/import_to_identifier_named_assert.snap rename to internal/printer/__printer_js__/import_to_identifier_named_assert.snap diff --git a/internal/printer/__snapshots__/includes_comments_for_expression_attribute.snap b/internal/printer/__printer_js__/includes_comments_for_expression_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/includes_comments_for_expression_attribute.snap rename to internal/printer/__printer_js__/includes_comments_for_expression_attribute.snap diff --git a/internal/printer/__snapshots__/includes_comments_for_shorthand_attribute.snap b/internal/printer/__printer_js__/includes_comments_for_shorthand_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/includes_comments_for_shorthand_attribute.snap rename to internal/printer/__printer_js__/includes_comments_for_shorthand_attribute.snap diff --git a/internal/printer/__snapshots__/is_raw.snap b/internal/printer/__printer_js__/is_raw.snap similarity index 100% rename from internal/printer/__snapshots__/is_raw.snap rename to internal/printer/__printer_js__/is_raw.snap diff --git a/internal/printer/__snapshots__/map_basic.snap b/internal/printer/__printer_js__/map_basic.snap similarity index 100% rename from internal/printer/__snapshots__/map_basic.snap rename to internal/printer/__printer_js__/map_basic.snap diff --git a/internal/printer/__snapshots__/map_nested.snap b/internal/printer/__printer_js__/map_nested.snap similarity index 100% rename from internal/printer/__snapshots__/map_nested.snap rename to internal/printer/__printer_js__/map_nested.snap diff --git a/internal/printer/__snapshots__/map_with_component.snap b/internal/printer/__printer_js__/map_with_component.snap similarity index 100% rename from internal/printer/__snapshots__/map_with_component.snap rename to internal/printer/__printer_js__/map_with_component.snap diff --git a/internal/printer/__snapshots__/map_without_component.snap b/internal/printer/__printer_js__/map_without_component.snap similarity index 100% rename from internal/printer/__snapshots__/map_without_component.snap rename to internal/printer/__printer_js__/map_without_component.snap diff --git a/internal/printer/__snapshots__/maybeRenderHead_not_printed_for_hoisted_scripts.snap b/internal/printer/__printer_js__/maybeRenderHead_not_printed_for_hoisted_scripts.snap similarity index 100% rename from internal/printer/__snapshots__/maybeRenderHead_not_printed_for_hoisted_scripts.snap rename to internal/printer/__printer_js__/maybeRenderHead_not_printed_for_hoisted_scripts.snap diff --git a/internal/printer/__snapshots__/multibyte_character_+_script.snap b/internal/printer/__printer_js__/multibyte_character___script.snap similarity index 100% rename from internal/printer/__snapshots__/multibyte_character_+_script.snap rename to internal/printer/__printer_js__/multibyte_character___script.snap diff --git a/internal/printer/__snapshots__/multibyte_character_+_style.snap b/internal/printer/__printer_js__/multibyte_character___style.snap similarity index 100% rename from internal/printer/__snapshots__/multibyte_character_+_style.snap rename to internal/printer/__printer_js__/multibyte_character___style.snap diff --git a/internal/printer/__snapshots__/multibyte_characters.snap b/internal/printer/__printer_js__/multibyte_characters.snap similarity index 100% rename from internal/printer/__snapshots__/multibyte_characters.snap rename to internal/printer/__printer_js__/multibyte_characters.snap diff --git a/internal/printer/__snapshots__/multiple_define_vars_on_style.snap b/internal/printer/__printer_js__/multiple_define_vars_on_style.snap similarity index 100% rename from internal/printer/__snapshots__/multiple_define_vars_on_style.snap rename to internal/printer/__printer_js__/multiple_define_vars_on_style.snap diff --git a/internal/printer/__snapshots__/nested_expressions.snap b/internal/printer/__printer_js__/nested_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions.snap rename to internal/printer/__printer_js__/nested_expressions.snap diff --git a/internal/printer/__snapshots__/nested_expressions_II.snap b/internal/printer/__printer_js__/nested_expressions_II.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_II.snap rename to internal/printer/__printer_js__/nested_expressions_II.snap diff --git a/internal/printer/__snapshots__/nested_expressions_III.snap b/internal/printer/__printer_js__/nested_expressions_III.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_III.snap rename to internal/printer/__printer_js__/nested_expressions_III.snap diff --git a/internal/printer/__snapshots__/nested_expressions_IV.snap b/internal/printer/__printer_js__/nested_expressions_IV.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_IV.snap rename to internal/printer/__printer_js__/nested_expressions_IV.snap diff --git a/internal/printer/__snapshots__/nested_expressions_V.snap b/internal/printer/__printer_js__/nested_expressions_V.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_V.snap rename to internal/printer/__printer_js__/nested_expressions_V.snap diff --git a/internal/printer/__snapshots__/nested_expressions_VI.snap b/internal/printer/__printer_js__/nested_expressions_VI.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_VI.snap rename to internal/printer/__printer_js__/nested_expressions_VI.snap diff --git a/internal/printer/__snapshots__/nested_expressions_VII.snap b/internal/printer/__printer_js__/nested_expressions_VII.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_VII.snap rename to internal/printer/__printer_js__/nested_expressions_VII.snap diff --git a/internal/printer/__snapshots__/nested_expressions_VIII.snap b/internal/printer/__printer_js__/nested_expressions_VIII.snap similarity index 100% rename from internal/printer/__snapshots__/nested_expressions_VIII.snap rename to internal/printer/__printer_js__/nested_expressions_VIII.snap diff --git a/internal/printer/__snapshots__/nested_head_content_stays_in_the_head.snap b/internal/printer/__printer_js__/nested_head_content_stays_in_the_head.snap similarity index 100% rename from internal/printer/__snapshots__/nested_head_content_stays_in_the_head.snap rename to internal/printer/__printer_js__/nested_head_content_stays_in_the_head.snap diff --git a/internal/printer/__snapshots__/nested_template_literal_expression.snap b/internal/printer/__printer_js__/nested_template_literal_expression.snap similarity index 100% rename from internal/printer/__snapshots__/nested_template_literal_expression.snap rename to internal/printer/__printer_js__/nested_template_literal_expression.snap diff --git a/internal/printer/__snapshots__/no_expressions_in_math.snap b/internal/printer/__printer_js__/no_expressions_in_math.snap similarity index 100% rename from internal/printer/__snapshots__/no_expressions_in_math.snap rename to internal/printer/__printer_js__/no_expressions_in_math.snap diff --git a/internal/printer/__snapshots__/noscript_component.snap b/internal/printer/__printer_js__/noscript_component.snap similarity index 100% rename from internal/printer/__snapshots__/noscript_component.snap rename to internal/printer/__printer_js__/noscript_component.snap diff --git a/internal/printer/__snapshots__/noscript_deep_styles.snap b/internal/printer/__printer_js__/noscript_deep_styles.snap similarity index 100% rename from internal/printer/__snapshots__/noscript_deep_styles.snap rename to internal/printer/__printer_js__/noscript_deep_styles.snap diff --git a/internal/printer/__snapshots__/noscript_only.snap b/internal/printer/__printer_js__/noscript_only.snap similarity index 100% rename from internal/printer/__snapshots__/noscript_only.snap rename to internal/printer/__printer_js__/noscript_only.snap diff --git a/internal/printer/__snapshots__/noscript_styles.snap b/internal/printer/__printer_js__/noscript_styles.snap similarity index 100% rename from internal/printer/__snapshots__/noscript_styles.snap rename to internal/printer/__printer_js__/noscript_styles.snap diff --git a/internal/printer/__snapshots__/orphan_slot.snap b/internal/printer/__printer_js__/orphan_slot.snap similarity index 100% rename from internal/printer/__snapshots__/orphan_slot.snap rename to internal/printer/__printer_js__/orphan_slot.snap diff --git a/internal/printer/__snapshots__/passes_escaped_filename_into_createComponent_if_it_contains_single_quotes.snap b/internal/printer/__printer_js__/passes_escaped_filename_into_createComponent_if_it_contains_single_quotes.snap similarity index 100% rename from internal/printer/__snapshots__/passes_escaped_filename_into_createComponent_if_it_contains_single_quotes.snap rename to internal/printer/__printer_js__/passes_escaped_filename_into_createComponent_if_it_contains_single_quotes.snap diff --git a/internal/printer/__snapshots__/passes_filename_into_createComponent_if_passed_into_the_compiler_options.snap b/internal/printer/__printer_js__/passes_filename_into_createComponent_if_passed_into_the_compiler_options.snap similarity index 100% rename from internal/printer/__snapshots__/passes_filename_into_createComponent_if_passed_into_the_compiler_options.snap rename to internal/printer/__printer_js__/passes_filename_into_createComponent_if_passed_into_the_compiler_options.snap diff --git a/internal/printer/__snapshots__/preserve_is_inline_slot.snap b/internal/printer/__printer_js__/preserve_is_inline_slot.snap similarity index 100% rename from internal/printer/__snapshots__/preserve_is_inline_slot.snap rename to internal/printer/__printer_js__/preserve_is_inline_slot.snap diff --git a/internal/printer/__snapshots__/preserve_is_inline_slot_II.snap b/internal/printer/__printer_js__/preserve_is_inline_slot_II.snap similarity index 100% rename from internal/printer/__snapshots__/preserve_is_inline_slot_II.snap rename to internal/printer/__printer_js__/preserve_is_inline_slot_II.snap diff --git a/internal/printer/__snapshots__/script__renderScript__true_.snap b/internal/printer/__printer_js__/script__renderScript__true_.snap similarity index 100% rename from internal/printer/__snapshots__/script__renderScript__true_.snap rename to internal/printer/__printer_js__/script__renderScript__true_.snap diff --git a/internal/printer/__snapshots__/script_before_elements.snap b/internal/printer/__printer_js__/script_before_elements.snap similarity index 100% rename from internal/printer/__snapshots__/script_before_elements.snap rename to internal/printer/__printer_js__/script_before_elements.snap diff --git a/internal/printer/__snapshots__/script_define_vars_I.snap b/internal/printer/__printer_js__/script_define_vars_I.snap similarity index 100% rename from internal/printer/__snapshots__/script_define_vars_I.snap rename to internal/printer/__printer_js__/script_define_vars_I.snap diff --git a/internal/printer/__snapshots__/script_define_vars_II.snap b/internal/printer/__printer_js__/script_define_vars_II.snap similarity index 100% rename from internal/printer/__snapshots__/script_define_vars_II.snap rename to internal/printer/__printer_js__/script_define_vars_II.snap diff --git a/internal/printer/__snapshots__/script_external__renderScript__true_.snap b/internal/printer/__printer_js__/script_external__renderScript__true_.snap similarity index 100% rename from internal/printer/__snapshots__/script_external__renderScript__true_.snap rename to internal/printer/__printer_js__/script_external__renderScript__true_.snap diff --git a/internal/printer/__snapshots__/script_hoist_with_frontmatter.snap b/internal/printer/__printer_js__/script_hoist_with_frontmatter.snap similarity index 100% rename from internal/printer/__snapshots__/script_hoist_with_frontmatter.snap rename to internal/printer/__printer_js__/script_hoist_with_frontmatter.snap diff --git a/internal/printer/__snapshots__/script_hoist_without_frontmatter.snap b/internal/printer/__printer_js__/script_hoist_without_frontmatter.snap similarity index 100% rename from internal/printer/__snapshots__/script_hoist_without_frontmatter.snap rename to internal/printer/__printer_js__/script_hoist_without_frontmatter.snap diff --git a/internal/printer/__snapshots__/script_in__head_.snap b/internal/printer/__printer_js__/script_in__head_.snap similarity index 100% rename from internal/printer/__snapshots__/script_in__head_.snap rename to internal/printer/__printer_js__/script_in__head_.snap diff --git a/internal/printer/__snapshots__/script_inline.snap b/internal/printer/__printer_js__/script_inline.snap similarity index 100% rename from internal/printer/__snapshots__/script_inline.snap rename to internal/printer/__printer_js__/script_inline.snap diff --git a/internal/printer/__snapshots__/script_inline__renderScript__true_.snap b/internal/printer/__printer_js__/script_inline__renderScript__true_.snap similarity index 100% rename from internal/printer/__snapshots__/script_inline__renderScript__true_.snap rename to internal/printer/__printer_js__/script_inline__renderScript__true_.snap diff --git a/internal/printer/__snapshots__/script_mixed_handled_and_inline__renderScript__true_.snap b/internal/printer/__printer_js__/script_mixed_handled_and_inline__renderScript__true_.snap similarity index 100% rename from internal/printer/__snapshots__/script_mixed_handled_and_inline__renderScript__true_.snap rename to internal/printer/__printer_js__/script_mixed_handled_and_inline__renderScript__true_.snap diff --git a/internal/printer/__snapshots__/script_multiple__renderScript__true_.snap b/internal/printer/__printer_js__/script_multiple__renderScript__true_.snap similarity index 100% rename from internal/printer/__snapshots__/script_multiple__renderScript__true_.snap rename to internal/printer/__printer_js__/script_multiple__renderScript__true_.snap diff --git a/internal/printer/__snapshots__/select_in_form.snap b/internal/printer/__printer_js__/select_in_form.snap similarity index 100% rename from internal/printer/__snapshots__/select_in_form.snap rename to internal/printer/__printer_js__/select_in_form.snap diff --git a/internal/printer/__snapshots__/select_map_expression.snap b/internal/printer/__printer_js__/select_map_expression.snap similarity index 100% rename from internal/printer/__snapshots__/select_map_expression.snap rename to internal/printer/__printer_js__/select_map_expression.snap diff --git a/internal/printer/__snapshots__/select_nested_option.snap b/internal/printer/__printer_js__/select_nested_option.snap similarity index 100% rename from internal/printer/__snapshots__/select_nested_option.snap rename to internal/printer/__printer_js__/select_nested_option.snap diff --git a/internal/printer/__snapshots__/select_option_expression.snap b/internal/printer/__printer_js__/select_option_expression.snap similarity index 100% rename from internal/printer/__snapshots__/select_option_expression.snap rename to internal/printer/__printer_js__/select_option_expression.snap diff --git a/internal/printer/__snapshots__/self-closing_td.snap b/internal/printer/__printer_js__/self-closing_td.snap similarity index 100% rename from internal/printer/__snapshots__/self-closing_td.snap rename to internal/printer/__printer_js__/self-closing_td.snap diff --git a/internal/printer/__snapshots__/set_html.snap b/internal/printer/__printer_js__/set_html.snap similarity index 100% rename from internal/printer/__snapshots__/set_html.snap rename to internal/printer/__printer_js__/set_html.snap diff --git a/internal/printer/__snapshots__/set_html_and_set_text.snap b/internal/printer/__printer_js__/set_html_and_set_text.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_and_set_text.snap rename to internal/printer/__printer_js__/set_html_and_set_text.snap diff --git a/internal/printer/__snapshots__/set_html_on_Component.snap b/internal/printer/__printer_js__/set_html_on_Component.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Component.snap rename to internal/printer/__printer_js__/set_html_on_Component.snap diff --git a/internal/printer/__snapshots__/set_html_on_Component_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_Component_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Component_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_Component_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_Component_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_Component_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Component_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_Component_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_Component_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_Component_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Component_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_Component_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_Fragment.snap b/internal/printer/__printer_js__/set_html_on_Fragment.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Fragment.snap rename to internal/printer/__printer_js__/set_html_on_Fragment.snap diff --git a/internal/printer/__snapshots__/set_html_on_Fragment_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_Fragment_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Fragment_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_Fragment_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_Fragment_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_Fragment_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Fragment_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_Fragment_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_Fragment_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_Fragment_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_Fragment_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_Fragment_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_custom-element.snap b/internal/printer/__printer_js__/set_html_on_custom-element.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_custom-element.snap rename to internal/printer/__printer_js__/set_html_on_custom-element.snap diff --git a/internal/printer/__snapshots__/set_html_on_custom-element_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_custom-element_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_custom-element_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_custom-element_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_custom-element_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_custom-element_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_custom-element_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_custom-element_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_custom-element_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_custom-element_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_custom-element_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_custom-element_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_empty_tag.snap b/internal/printer/__printer_js__/set_html_on_empty_tag.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_empty_tag.snap rename to internal/printer/__printer_js__/set_html_on_empty_tag.snap diff --git a/internal/printer/__snapshots__/set_html_on_empty_tag_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_empty_tag_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_empty_tag_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_empty_tag_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_empty_tag_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_empty_tag_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_empty_tag_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_empty_tag_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_empty_tag_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_empty_tag_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_empty_tag_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_empty_tag_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_script.snap b/internal/printer/__printer_js__/set_html_on_script.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_script.snap rename to internal/printer/__printer_js__/set_html_on_script.snap diff --git a/internal/printer/__snapshots__/set_html_on_script_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_script_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_script_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_script_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_script_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_script_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_script_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_script_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_script_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_script_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_script_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_script_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_self-closing_tag.snap b/internal/printer/__printer_js__/set_html_on_self-closing_tag.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_self-closing_tag.snap rename to internal/printer/__printer_js__/set_html_on_self-closing_tag.snap diff --git a/internal/printer/__snapshots__/set_html_on_self-closing_tag_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_self-closing_tag_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_self-closing_tag_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_self-closing_tag_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_self-closing_tag_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_self-closing_tag_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_self-closing_tag_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_self-closing_tag_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_self-closing_tag_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_self-closing_tag_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_self-closing_tag_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_self-closing_tag_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_style.snap b/internal/printer/__printer_js__/set_html_on_style.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_style.snap rename to internal/printer/__printer_js__/set_html_on_style.snap diff --git a/internal/printer/__snapshots__/set_html_on_style_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_style_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_style_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_style_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_style_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_style_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_style_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_style_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_style_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_style_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_style_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_style_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_children.snap b/internal/printer/__printer_js__/set_html_on_tag_with_children.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_children.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_children.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_children_and_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_tag_with_children_and_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_children_and_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_children_and_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_children_and_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_tag_with_children_and_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_children_and_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_children_and_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_children_and_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_tag_with_children_and_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_children_and_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_children_and_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace.snap b/internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_on_tag_with_empty_whitespace_and_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_with_other_attributes.snap b/internal/printer/__printer_js__/set_html_with_other_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_other_attributes.snap rename to internal/printer/__printer_js__/set_html_with_other_attributes.snap diff --git a/internal/printer/__snapshots__/set_html_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_html_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_html_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_html_with_quoted_attribute_and_other_attributes.snap b/internal/printer/__printer_js__/set_html_with_quoted_attribute_and_other_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_quoted_attribute_and_other_attributes.snap rename to internal/printer/__printer_js__/set_html_with_quoted_attribute_and_other_attributes.snap diff --git a/internal/printer/__snapshots__/set_html_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_html_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_html_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_html_with_template_literal_attribute_with_variable_and_other_attributes.snap b/internal/printer/__printer_js__/set_html_with_template_literal_attribute_with_variable_and_other_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_template_literal_attribute_with_variable_and_other_attributes.snap rename to internal/printer/__printer_js__/set_html_with_template_literal_attribute_with_variable_and_other_attributes.snap diff --git a/internal/printer/__snapshots__/set_html_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_html_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_html_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_html_with_template_literal_attribute_without_variable_and_other_attributes.snap b/internal/printer/__printer_js__/set_html_with_template_literal_attribute_without_variable_and_other_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/set_html_with_template_literal_attribute_without_variable_and_other_attributes.snap rename to internal/printer/__printer_js__/set_html_with_template_literal_attribute_without_variable_and_other_attributes.snap diff --git a/internal/printer/__snapshots__/set_text.snap b/internal/printer/__printer_js__/set_text.snap similarity index 100% rename from internal/printer/__snapshots__/set_text.snap rename to internal/printer/__printer_js__/set_text.snap diff --git a/internal/printer/__snapshots__/set_text_on_Component.snap b/internal/printer/__printer_js__/set_text_on_Component.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_Component.snap rename to internal/printer/__printer_js__/set_text_on_Component.snap diff --git a/internal/printer/__snapshots__/set_text_on_Component_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_text_on_Component_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_Component_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_text_on_Component_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_text_on_Component_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_text_on_Component_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_Component_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_text_on_Component_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_text_on_Component_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_text_on_Component_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_Component_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_text_on_Component_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_text_on_custom-element.snap b/internal/printer/__printer_js__/set_text_on_custom-element.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_custom-element.snap rename to internal/printer/__printer_js__/set_text_on_custom-element.snap diff --git a/internal/printer/__snapshots__/set_text_on_custom-element_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_text_on_custom-element_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_custom-element_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_text_on_custom-element_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_text_on_custom-element_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_text_on_custom-element_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_custom-element_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_text_on_custom-element_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_text_on_custom-element_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_text_on_custom-element_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_on_custom-element_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_text_on_custom-element_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/set_text_with_quoted_attribute.snap b/internal/printer/__printer_js__/set_text_with_quoted_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_with_quoted_attribute.snap rename to internal/printer/__printer_js__/set_text_with_quoted_attribute.snap diff --git a/internal/printer/__snapshots__/set_text_with_template_literal_attribute_with_variable.snap b/internal/printer/__printer_js__/set_text_with_template_literal_attribute_with_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_with_template_literal_attribute_with_variable.snap rename to internal/printer/__printer_js__/set_text_with_template_literal_attribute_with_variable.snap diff --git a/internal/printer/__snapshots__/set_text_with_template_literal_attribute_without_variable.snap b/internal/printer/__printer_js__/set_text_with_template_literal_attribute_without_variable.snap similarity index 100% rename from internal/printer/__snapshots__/set_text_with_template_literal_attribute_without_variable.snap rename to internal/printer/__printer_js__/set_text_with_template_literal_attribute_without_variable.snap diff --git a/internal/printer/__snapshots__/sibling_expressions.snap b/internal/printer/__printer_js__/sibling_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/sibling_expressions.snap rename to internal/printer/__printer_js__/sibling_expressions.snap diff --git a/internal/printer/__snapshots__/simple_ternary.snap b/internal/printer/__printer_js__/simple_ternary.snap similarity index 100% rename from internal/printer/__snapshots__/simple_ternary.snap rename to internal/printer/__printer_js__/simple_ternary.snap diff --git a/internal/printer/__snapshots__/slot_inside_of_Base.snap b/internal/printer/__printer_js__/slot_inside_of_Base.snap similarity index 100% rename from internal/printer/__snapshots__/slot_inside_of_Base.snap rename to internal/printer/__printer_js__/slot_inside_of_Base.snap diff --git a/internal/printer/__snapshots__/slot_with_fallback.snap b/internal/printer/__printer_js__/slot_with_fallback.snap similarity index 100% rename from internal/printer/__snapshots__/slot_with_fallback.snap rename to internal/printer/__printer_js__/slot_with_fallback.snap diff --git a/internal/printer/__snapshots__/slot_with_fallback_II.snap b/internal/printer/__printer_js__/slot_with_fallback_II.snap similarity index 100% rename from internal/printer/__snapshots__/slot_with_fallback_II.snap rename to internal/printer/__printer_js__/slot_with_fallback_II.snap diff --git a/internal/printer/__snapshots__/slot_with_fallback_III.snap b/internal/printer/__printer_js__/slot_with_fallback_III.snap similarity index 100% rename from internal/printer/__snapshots__/slot_with_fallback_III.snap rename to internal/printer/__printer_js__/slot_with_fallback_III.snap diff --git a/internal/printer/__snapshots__/slot_with_quoted_attributes.snap b/internal/printer/__printer_js__/slot_with_quoted_attributes.snap similarity index 100% rename from internal/printer/__snapshots__/slot_with_quoted_attributes.snap rename to internal/printer/__printer_js__/slot_with_quoted_attributes.snap diff --git a/internal/printer/__snapshots__/slots__basic_.snap b/internal/printer/__printer_js__/slots__basic_.snap similarity index 100% rename from internal/printer/__snapshots__/slots__basic_.snap rename to internal/printer/__printer_js__/slots__basic_.snap diff --git a/internal/printer/__snapshots__/slots__dynamic_name_.snap b/internal/printer/__printer_js__/slots__dynamic_name_.snap similarity index 100% rename from internal/printer/__snapshots__/slots__dynamic_name_.snap rename to internal/printer/__printer_js__/slots__dynamic_name_.snap diff --git a/internal/printer/__snapshots__/slots__expression_.snap b/internal/printer/__printer_js__/slots__expression_.snap similarity index 100% rename from internal/printer/__snapshots__/slots__expression_.snap rename to internal/printer/__printer_js__/slots__expression_.snap diff --git a/internal/printer/__snapshots__/slots__named_only_.snap b/internal/printer/__printer_js__/slots__named_only_.snap similarity index 100% rename from internal/printer/__snapshots__/slots__named_only_.snap rename to internal/printer/__printer_js__/slots__named_only_.snap diff --git a/internal/printer/__snapshots__/slots__no_comments_.snap b/internal/printer/__printer_js__/slots__no_comments_.snap similarity index 100% rename from internal/printer/__snapshots__/slots__no_comments_.snap rename to internal/printer/__printer_js__/slots__no_comments_.snap diff --git a/internal/printer/__snapshots__/small_expression.snap b/internal/printer/__printer_js__/small_expression.snap similarity index 100% rename from internal/printer/__snapshots__/small_expression.snap rename to internal/printer/__printer_js__/small_expression.snap diff --git a/internal/printer/__snapshots__/solidus_in_template_literal_expression.snap b/internal/printer/__printer_js__/solidus_in_template_literal_expression.snap similarity index 100% rename from internal/printer/__snapshots__/solidus_in_template_literal_expression.snap rename to internal/printer/__printer_js__/solidus_in_template_literal_expression.snap diff --git a/internal/printer/__snapshots__/spread_with_double_quotation_marks.snap b/internal/printer/__printer_js__/spread_with_double_quotation_marks.snap similarity index 100% rename from internal/printer/__snapshots__/spread_with_double_quotation_marks.snap rename to internal/printer/__printer_js__/spread_with_double_quotation_marks.snap diff --git a/internal/printer/__snapshots__/spread_with_style_but_no_explicit_class.snap b/internal/printer/__printer_js__/spread_with_style_but_no_explicit_class.snap similarity index 100% rename from internal/printer/__snapshots__/spread_with_style_but_no_explicit_class.snap rename to internal/printer/__printer_js__/spread_with_style_but_no_explicit_class.snap diff --git a/internal/printer/__snapshots__/spread_without_style_or_class.snap b/internal/printer/__printer_js__/spread_without_style_or_class.snap similarity index 100% rename from internal/printer/__snapshots__/spread_without_style_or_class.snap rename to internal/printer/__printer_js__/spread_without_style_or_class.snap diff --git a/internal/printer/__snapshots__/styles__no_frontmatter_.snap b/internal/printer/__printer_js__/styles__no_frontmatter_.snap similarity index 100% rename from internal/printer/__snapshots__/styles__no_frontmatter_.snap rename to internal/printer/__printer_js__/styles__no_frontmatter_.snap diff --git a/internal/printer/__snapshots__/svg_expressions.snap b/internal/printer/__printer_js__/svg_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/svg_expressions.snap rename to internal/printer/__printer_js__/svg_expressions.snap diff --git a/internal/printer/__snapshots__/table.snap b/internal/printer/__printer_js__/table.snap similarity index 100% rename from internal/printer/__snapshots__/table.snap rename to internal/printer/__printer_js__/table.snap diff --git a/internal/printer/__snapshots__/table_II.snap b/internal/printer/__printer_js__/table_II.snap similarity index 100% rename from internal/printer/__snapshots__/table_II.snap rename to internal/printer/__printer_js__/table_II.snap diff --git a/internal/printer/__snapshots__/table_III.snap b/internal/printer/__printer_js__/table_III.snap similarity index 100% rename from internal/printer/__snapshots__/table_III.snap rename to internal/printer/__printer_js__/table_III.snap diff --git a/internal/printer/__snapshots__/table_IV.snap b/internal/printer/__printer_js__/table_IV.snap similarity index 100% rename from internal/printer/__snapshots__/table_IV.snap rename to internal/printer/__printer_js__/table_IV.snap diff --git a/internal/printer/__snapshots__/table_caption_expression.snap b/internal/printer/__printer_js__/table_caption_expression.snap similarity index 100% rename from internal/printer/__snapshots__/table_caption_expression.snap rename to internal/printer/__printer_js__/table_caption_expression.snap diff --git a/internal/printer/__snapshots__/table_expression_with_trailing_div.snap b/internal/printer/__printer_js__/table_expression_with_trailing_div.snap similarity index 100% rename from internal/printer/__snapshots__/table_expression_with_trailing_div.snap rename to internal/printer/__printer_js__/table_expression_with_trailing_div.snap diff --git a/internal/printer/__snapshots__/table_expressions__no_implicit_tbody_.snap b/internal/printer/__printer_js__/table_expressions__no_implicit_tbody_.snap similarity index 100% rename from internal/printer/__snapshots__/table_expressions__no_implicit_tbody_.snap rename to internal/printer/__printer_js__/table_expressions__no_implicit_tbody_.snap diff --git a/internal/printer/__snapshots__/table_simple_case.snap b/internal/printer/__printer_js__/table_simple_case.snap similarity index 100% rename from internal/printer/__snapshots__/table_simple_case.snap rename to internal/printer/__printer_js__/table_simple_case.snap diff --git a/internal/printer/__snapshots__/table_slot_I.snap b/internal/printer/__printer_js__/table_slot_I.snap similarity index 100% rename from internal/printer/__snapshots__/table_slot_I.snap rename to internal/printer/__printer_js__/table_slot_I.snap diff --git a/internal/printer/__snapshots__/table_slot_II.snap b/internal/printer/__printer_js__/table_slot_II.snap similarity index 100% rename from internal/printer/__snapshots__/table_slot_II.snap rename to internal/printer/__printer_js__/table_slot_II.snap diff --git a/internal/printer/__snapshots__/table_slot_III.snap b/internal/printer/__printer_js__/table_slot_III.snap similarity index 100% rename from internal/printer/__snapshots__/table_slot_III.snap rename to internal/printer/__printer_js__/table_slot_III.snap diff --git a/internal/printer/__snapshots__/table_slot_IV.snap b/internal/printer/__printer_js__/table_slot_IV.snap similarity index 100% rename from internal/printer/__snapshots__/table_slot_IV.snap rename to internal/printer/__printer_js__/table_slot_IV.snap diff --git a/internal/printer/__snapshots__/table_slot_V.snap b/internal/printer/__printer_js__/table_slot_V.snap similarity index 100% rename from internal/printer/__snapshots__/table_slot_V.snap rename to internal/printer/__printer_js__/table_slot_V.snap diff --git a/internal/printer/__snapshots__/table_with_expression_in_'th'.snap b/internal/printer/__printer_js__/table_with_expression_in__th_.snap similarity index 100% rename from internal/printer/__snapshots__/table_with_expression_in_'th'.snap rename to internal/printer/__printer_js__/table_with_expression_in__th_.snap diff --git a/internal/printer/__snapshots__/tbody_expressions.snap b/internal/printer/__printer_js__/tbody_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/tbody_expressions.snap rename to internal/printer/__printer_js__/tbody_expressions.snap diff --git a/internal/printer/__snapshots__/tbody_expressions_2.snap b/internal/printer/__printer_js__/tbody_expressions_2.snap similarity index 100% rename from internal/printer/__snapshots__/tbody_expressions_2.snap rename to internal/printer/__printer_js__/tbody_expressions_2.snap diff --git a/internal/printer/__snapshots__/tbody_expressions_3.snap b/internal/printer/__printer_js__/tbody_expressions_3.snap similarity index 100% rename from internal/printer/__snapshots__/tbody_expressions_3.snap rename to internal/printer/__printer_js__/tbody_expressions_3.snap diff --git a/internal/printer/__snapshots__/td_expressions.snap b/internal/printer/__printer_js__/td_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/td_expressions.snap rename to internal/printer/__printer_js__/td_expressions.snap diff --git a/internal/printer/__snapshots__/td_expressions_II.snap b/internal/printer/__printer_js__/td_expressions_II.snap similarity index 100% rename from internal/printer/__snapshots__/td_expressions_II.snap rename to internal/printer/__printer_js__/td_expressions_II.snap diff --git a/internal/printer/__snapshots__/template_literal_attribute_on_component.snap b/internal/printer/__printer_js__/template_literal_attribute_on_component.snap similarity index 100% rename from internal/printer/__snapshots__/template_literal_attribute_on_component.snap rename to internal/printer/__printer_js__/template_literal_attribute_on_component.snap diff --git a/internal/printer/__snapshots__/template_literal_attribute_with_variable_on_component.snap b/internal/printer/__printer_js__/template_literal_attribute_with_variable_on_component.snap similarity index 100% rename from internal/printer/__snapshots__/template_literal_attribute_with_variable_on_component.snap rename to internal/printer/__printer_js__/template_literal_attribute_with_variable_on_component.snap diff --git a/internal/printer/__snapshots__/ternary_component.snap b/internal/printer/__printer_js__/ternary_component.snap similarity index 100% rename from internal/printer/__snapshots__/ternary_component.snap rename to internal/printer/__printer_js__/ternary_component.snap diff --git a/internal/printer/__snapshots__/ternary_layout.snap b/internal/printer/__printer_js__/ternary_layout.snap similarity index 100% rename from internal/printer/__snapshots__/ternary_layout.snap rename to internal/printer/__printer_js__/ternary_layout.snap diff --git a/internal/printer/__snapshots__/ternary_slot.snap b/internal/printer/__printer_js__/ternary_slot.snap similarity index 100% rename from internal/printer/__snapshots__/ternary_slot.snap rename to internal/printer/__printer_js__/ternary_slot.snap diff --git a/internal/printer/__snapshots__/text_after_title_expression.snap b/internal/printer/__printer_js__/text_after_title_expression.snap similarity index 100% rename from internal/printer/__snapshots__/text_after_title_expression.snap rename to internal/printer/__printer_js__/text_after_title_expression.snap diff --git a/internal/printer/__snapshots__/text_after_title_expressions.snap b/internal/printer/__printer_js__/text_after_title_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/text_after_title_expressions.snap rename to internal/printer/__printer_js__/text_after_title_expressions.snap diff --git a/internal/printer/__snapshots__/text_only.snap b/internal/printer/__printer_js__/text_only.snap similarity index 100% rename from internal/printer/__snapshots__/text_only.snap rename to internal/printer/__printer_js__/text_only.snap diff --git a/internal/printer/__snapshots__/textarea.snap b/internal/printer/__printer_js__/textarea.snap similarity index 100% rename from internal/printer/__snapshots__/textarea.snap rename to internal/printer/__printer_js__/textarea.snap diff --git a/internal/printer/__snapshots__/textarea_in_form.snap b/internal/printer/__printer_js__/textarea_in_form.snap similarity index 100% rename from internal/printer/__snapshots__/textarea_in_form.snap rename to internal/printer/__printer_js__/textarea_in_form.snap diff --git a/internal/printer/__snapshots__/textarea_inside_expression.snap b/internal/printer/__printer_js__/textarea_inside_expression.snap similarity index 100% rename from internal/printer/__snapshots__/textarea_inside_expression.snap rename to internal/printer/__printer_js__/textarea_inside_expression.snap diff --git a/internal/printer/__snapshots__/th_expressions.snap b/internal/printer/__printer_js__/th_expressions.snap similarity index 100% rename from internal/printer/__snapshots__/th_expressions.snap rename to internal/printer/__printer_js__/th_expressions.snap diff --git a/internal/printer/__snapshots__/tr_only.snap b/internal/printer/__printer_js__/tr_only.snap similarity index 100% rename from internal/printer/__snapshots__/tr_only.snap rename to internal/printer/__printer_js__/tr_only.snap diff --git a/internal/printer/__snapshots__/trailing_expression.snap b/internal/printer/__printer_js__/trailing_expression.snap similarity index 100% rename from internal/printer/__snapshots__/trailing_expression.snap rename to internal/printer/__printer_js__/trailing_expression.snap diff --git a/internal/printer/__snapshots__/transition_animate_on_Component.snap b/internal/printer/__printer_js__/transition_animate_on_Component.snap similarity index 100% rename from internal/printer/__snapshots__/transition_animate_on_Component.snap rename to internal/printer/__printer_js__/transition_animate_on_Component.snap diff --git a/internal/printer/__snapshots__/transition_animate_with_an_expression.snap b/internal/printer/__printer_js__/transition_animate_with_an_expression.snap similarity index 100% rename from internal/printer/__snapshots__/transition_animate_with_an_expression.snap rename to internal/printer/__printer_js__/transition_animate_with_an_expression.snap diff --git a/internal/printer/__snapshots__/transition_name_with_an_expression.snap b/internal/printer/__printer_js__/transition_name_with_an_expression.snap similarity index 100% rename from internal/printer/__snapshots__/transition_name_with_an_expression.snap rename to internal/printer/__printer_js__/transition_name_with_an_expression.snap diff --git a/internal/printer/__snapshots__/transition_name_with_an_template_literal.snap b/internal/printer/__printer_js__/transition_name_with_an_template_literal.snap similarity index 100% rename from internal/printer/__snapshots__/transition_name_with_an_template_literal.snap rename to internal/printer/__printer_js__/transition_name_with_an_template_literal.snap diff --git a/internal/printer/__snapshots__/transition_persist-props_converted_to_a_data_attribute.snap b/internal/printer/__printer_js__/transition_persist-props_converted_to_a_data_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/transition_persist-props_converted_to_a_data_attribute.snap rename to internal/printer/__printer_js__/transition_persist-props_converted_to_a_data_attribute.snap diff --git a/internal/printer/__snapshots__/transition_persist_converted_to_a_data_attribute.snap b/internal/printer/__printer_js__/transition_persist_converted_to_a_data_attribute.snap similarity index 100% rename from internal/printer/__snapshots__/transition_persist_converted_to_a_data_attribute.snap rename to internal/printer/__printer_js__/transition_persist_converted_to_a_data_attribute.snap diff --git a/internal/printer/__snapshots__/transition_persist_uses_transition_name_if_defined.snap b/internal/printer/__printer_js__/transition_persist_uses_transition_name_if_defined.snap similarity index 100% rename from internal/printer/__snapshots__/transition_persist_uses_transition_name_if_defined.snap rename to internal/printer/__printer_js__/transition_persist_uses_transition_name_if_defined.snap diff --git a/internal/printer/__snapshots__/type_import.snap b/internal/printer/__printer_js__/type_import.snap similarity index 100% rename from internal/printer/__snapshots__/type_import.snap rename to internal/printer/__printer_js__/type_import.snap diff --git a/internal/printer/__snapshots__/unusual_line_terminator_I.snap b/internal/printer/__printer_js__/unusual_line_terminator_I.snap similarity index 100% rename from internal/printer/__snapshots__/unusual_line_terminator_I.snap rename to internal/printer/__printer_js__/unusual_line_terminator_I.snap diff --git a/internal/printer/__snapshots__/unusual_line_terminator_II.snap b/internal/printer/__printer_js__/unusual_line_terminator_II.snap similarity index 100% rename from internal/printer/__snapshots__/unusual_line_terminator_II.snap rename to internal/printer/__printer_js__/unusual_line_terminator_II.snap diff --git a/internal/printer/__snapshots__/user-defined_`implicit`_is_printed.snap b/internal/printer/__printer_js__/user-defined__implicit__is_printed.snap similarity index 100% rename from internal/printer/__snapshots__/user-defined_`implicit`_is_printed.snap rename to internal/printer/__printer_js__/user-defined__implicit__is_printed.snap diff --git a/internal/printer/__printer_json__/Comment.snap b/internal/printer/__printer_json__/Comment.snap new file mode 100755 index 000000000..e229e982a --- /dev/null +++ b/internal/printer/__printer_json__/Comment.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Comment - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"comment","value":"hello"}]} +``` +--- diff --git a/internal/printer/__printer_json__/Comment_preserves_whitespace.snap b/internal/printer/__printer_json__/Comment_preserves_whitespace.snap new file mode 100755 index 000000000..fa89df036 --- /dev/null +++ b/internal/printer/__printer_json__/Comment_preserves_whitespace.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Comment_preserves_whitespace - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"comment","value":" hello "}]} +``` +--- diff --git a/internal/printer/__printer_json__/Component.snap b/internal/printer/__printer_json__/Component.snap new file mode 100755 index 000000000..b0c833fc7 --- /dev/null +++ b/internal/printer/__printer_json__/Component.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Component - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"component","name":"Component","attributes":[],"children":[]}]} +``` +--- diff --git a/internal/printer/__printer_json__/Doctype.snap b/internal/printer/__printer_json__/Doctype.snap new file mode 100755 index 000000000..feaedfd9e --- /dev/null +++ b/internal/printer/__printer_json__/Doctype.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Doctype - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"doctype","value":"html"}]} +``` +--- diff --git a/internal/printer/__printer_json__/Fragment_Literal.snap b/internal/printer/__printer_json__/Fragment_Literal.snap new file mode 100755 index 000000000..326e337db --- /dev/null +++ b/internal/printer/__printer_json__/Fragment_Literal.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Fragment_Literal - 1] +## Input + +``` +World +``` + +## Output + +```json +{"type":"root","children":[{"type":"fragment","name":"Fragment","attributes":[],"children":[{"type":"text","value":"World"}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/Fragment_Shorthand.snap b/internal/printer/__printer_json__/Fragment_Shorthand.snap new file mode 100755 index 000000000..01023c606 --- /dev/null +++ b/internal/printer/__printer_json__/Fragment_Shorthand.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Fragment_Shorthand - 1] +## Input + +``` +<>Hello +``` + +## Output + +```json +{"type":"root","children":[{"type":"fragment","name":"","attributes":[],"children":[{"type":"text","value":"Hello"}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/Frontmatter.snap b/internal/printer/__printer_json__/Frontmatter.snap new file mode 100755 index 000000000..69f6875e3 --- /dev/null +++ b/internal/printer/__printer_json__/Frontmatter.snap @@ -0,0 +1,17 @@ + +[TestPrintToJSON/Frontmatter - 1] +## Input + +``` +/-/-/-/ +const a = "hey" +/-/-/-/ +
{a}
+``` + +## Output + +```json +{"type":"root","children":[{"type":"frontmatter","value":"\nconst a = \"hey\"\n"},{"type":"element","name":"div","attributes":[],"children":[{"type":"expression","children":[{"type":"text","value":"a"}]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/JSON_escape.snap b/internal/printer/__printer_json__/JSON_escape.snap new file mode 100755 index 000000000..876b4117a --- /dev/null +++ b/internal/printer/__printer_json__/JSON_escape.snap @@ -0,0 +1,19 @@ + +[TestPrintToJSON/JSON_escape - 1] +## Input + +``` +/-/-/-/ +const a = "\n" +const b = "\"" +const c = '\'' +/-/-/-/ +{a + b + c} +``` + +## Output + +```json +{"type":"root","children":[{"type":"frontmatter","value":"\nconst a = \"\\n\"\nconst b = \"\\\"\"\nconst c = '\\''\n"},{"type":"expression","children":[{"type":"text","value":"a + b + c"}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/Preserve_namespaces.snap b/internal/printer/__printer_json__/Preserve_namespaces.snap new file mode 100755 index 000000000..034f752a0 --- /dev/null +++ b/internal/printer/__printer_json__/Preserve_namespaces.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/Preserve_namespaces - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"svg","attributes":[{"type":"attribute","kind":"quoted","name":"xmlns","value":"http://www.w3.org/2000/svg","raw":"\"http://www.w3.org/2000/svg\""},{"type":"attribute","kind":"quoted","name":"xmlns:xlink","value":"http://www.w3.org/1999/xlink","raw":"\"http://www.w3.org/1999/xlink\""}],"children":[{"type":"element","name":"rect","attributes":[{"type":"attribute","kind":"quoted","name":"xlink:href","value":"#id","raw":"\"#id\""}],"children":[]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/basic.snap b/internal/printer/__printer_json__/basic.snap new file mode 100755 index 000000000..a52e1917d --- /dev/null +++ b/internal/printer/__printer_json__/basic.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/basic - 1] +## Input + +``` +

Hello world!

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello world!"}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/custom-element.snap b/internal/printer/__printer_json__/custom-element.snap new file mode 100755 index 000000000..ddeb7e459 --- /dev/null +++ b/internal/printer/__printer_json__/custom-element.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/custom-element - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"custom-element","name":"custom-element","attributes":[],"children":[]}]} +``` +--- diff --git a/internal/printer/__printer_json__/element_with_unterminated_double_quote_attribute.snap b/internal/printer/__printer_json__/element_with_unterminated_double_quote_attribute.snap new file mode 100755 index 000000000..d2668807d --- /dev/null +++ b/internal/printer/__printer_json__/element_with_unterminated_double_quote_attribute.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/element_with_unterminated_double_quote_attribute - 1] +## Input + +``` +
+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"main","attributes":[{"type":"attribute","kind":"template-literal","name":"id","value":"gotcha","raw":"`gotcha"}],"children":[]}]} +``` +--- diff --git a/internal/printer/__printer_json__/expression.snap b/internal/printer/__printer_json__/expression.snap new file mode 100755 index 000000000..53836cfa5 --- /dev/null +++ b/internal/printer/__printer_json__/expression.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/expression - 1] +## Input + +``` +

Hello {world}

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello "},{"type":"expression","children":[{"type":"text","value":"world"}]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_after_html.snap b/internal/printer/__printer_json__/style_after_html.snap new file mode 100755 index 000000000..6c15b8474 --- /dev/null +++ b/internal/printer/__printer_json__/style_after_html.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_after_html - 1] +## Input + +``` +

Hello world!

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[],"children":[{"type":"element","name":"body","attributes":[],"children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello world!"}]}]}]},{"type":"element","name":"style","attributes":[],"children":[]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_before_html.snap b/internal/printer/__printer_json__/style_before_html.snap new file mode 100755 index 000000000..aa1f40a8b --- /dev/null +++ b/internal/printer/__printer_json__/style_before_html.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_before_html - 1] +## Input + +``` +

Hello world!

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"style","attributes":[],"children":[]},{"type":"element","name":"html","attributes":[],"children":[{"type":"element","name":"body","attributes":[],"children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello world!"}]}]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_in_body.snap b/internal/printer/__printer_json__/style_in_body.snap new file mode 100755 index 000000000..cedebcd7d --- /dev/null +++ b/internal/printer/__printer_json__/style_in_body.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_in_body - 1] +## Input + +``` +

Hello world!

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[],"children":[{"type":"element","name":"body","attributes":[],"children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello world!"}]},{"type":"element","name":"style","attributes":[],"children":[]}]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_in_html.snap b/internal/printer/__printer_json__/style_in_html.snap new file mode 100755 index 000000000..ab1e6941d --- /dev/null +++ b/internal/printer/__printer_json__/style_in_html.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_in_html - 1] +## Input + +``` +

Hello world!

+``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[],"children":[{"type":"element","name":"body","attributes":[],"children":[{"type":"element","name":"h1","attributes":[],"children":[{"type":"text","value":"Hello world!"}]}]},{"type":"element","name":"style","attributes":[],"children":[]}]}]} +``` +--- diff --git a/internal/printer/printer_css_test.go b/internal/printer/printer_css_test.go index 78e554b4a..8beeb82c4 100644 --- a/internal/printer/printer_css_test.go +++ b/internal/printer/printer_css_test.go @@ -108,6 +108,16 @@ func TestPrinterCSS(t *testing.T) { if diff := test_utils.ANSIDiff(test_utils.Dedent(toMatch), test_utils.Dedent(output)); diff != "" { t.Errorf("mismatch (-want +got):\n%s", diff) } + + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: code, + Output: output, + Kind: test_utils.CssOutput, + FolderName: "__printer_css__", + }) }) } } diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index 454ceaee4..e0ac0432a 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" - "github.com/gkampitakis/go-snaps/snaps" astro "github.com/withastro/compiler/internal" "github.com/withastro/compiler/internal/handler" types "github.com/withastro/compiler/internal/t" @@ -3704,23 +3703,16 @@ const meta = { title: 'My App' }; if diff := test_utils.ANSIDiff(test_utils.RemoveNewlines(test_utils.Dedent(toMatch)), test_utils.RemoveNewlines(test_utils.Dedent(output))); diff != "" { t.Errorf("mismatch (-want +got):\n%s", diff) } + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: code, + Output: output, + Kind: test_utils.JsOutput, + FolderName: "__printer_js__", + }) - snapshotName := strings.ReplaceAll(tt.name, "#", "_") - snapshotName = strings.ReplaceAll(snapshotName, "<", "_") - snapshotName = strings.ReplaceAll(snapshotName, ">", "_") - snapshotName = strings.ReplaceAll(snapshotName, ")", "_") - snapshotName = strings.ReplaceAll(snapshotName, "(", "_") - snapshotName = strings.ReplaceAll(snapshotName, ":", "_") - snapshotName = strings.ReplaceAll(snapshotName, " ", "_") - snapshotName = strings.ReplaceAll(snapshotName, "#", "_") - - s := snaps.WithConfig( - snaps.Filename(snapshotName), - ) - - snapshot := fmt.Sprintf("%s%s%s%s%s%s%s%s", "## Input\n\n", "```\n", test_utils.Dedent(code), "\n```", "\n\n## Output\n\n", "```js\n", test_utils.Dedent(output), "\n```") - - s.MatchSnapshot(t, snapshot) }) } } @@ -3851,6 +3843,16 @@ const c = '\'' if diff := test_utils.ANSIDiff(test_utils.Dedent(string(toMatch)), test_utils.Dedent(string(result.Output))); diff != "" { t.Errorf("mismatch (-want +got):\n%s", diff) } + + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: code, + Output: string(result.Output), + Kind: test_utils.JsonOutput, + FolderName: "__printer_json__", + }) }) } } diff --git a/internal/test_utils/test_utils.go b/internal/test_utils/test_utils.go index 76937c50e..535905f0f 100644 --- a/internal/test_utils/test_utils.go +++ b/internal/test_utils/test_utils.go @@ -3,7 +3,9 @@ package test_utils import ( "fmt" "strings" + "testing" + "github.com/gkampitakis/go-snaps/snaps" "github.com/google/go-cmp/cmp" "github.com/lithammer/dedent" ) @@ -41,3 +43,78 @@ func ANSIDiff(x, y interface{}, opts ...cmp.Option) string { } return strings.Join(ss, "\n") } + +// Removes unsupported characters from the test case name, because it will be used as name for the snapshot +func RedactTestName(testCaseName string) string { + snapshotName := strings.ReplaceAll(testCaseName, "#", "_") + snapshotName = strings.ReplaceAll(snapshotName, "<", "_") + snapshotName = strings.ReplaceAll(snapshotName, ">", "_") + snapshotName = strings.ReplaceAll(snapshotName, ")", "_") + snapshotName = strings.ReplaceAll(snapshotName, "(", "_") + snapshotName = strings.ReplaceAll(snapshotName, ":", "_") + snapshotName = strings.ReplaceAll(snapshotName, " ", "_") + snapshotName = strings.ReplaceAll(snapshotName, "#", "_") + snapshotName = strings.ReplaceAll(snapshotName, "'", "_") + snapshotName = strings.ReplaceAll(snapshotName, "\"", "_") + snapshotName = strings.ReplaceAll(snapshotName, "@", "_") + snapshotName = strings.ReplaceAll(snapshotName, "`", "_") + snapshotName = strings.ReplaceAll(snapshotName, "+", "_") + return snapshotName +} + +type OutputKind int + +const ( + JsOutput = iota + JsonOutput + CssOutput + HtmlOutput + JsxOutput +) + +var outputKind = map[OutputKind]string{ + JsOutput: "js", + JsonOutput: "json", + CssOutput: "css", + HtmlOutput: "html", + JsxOutput: "jsx", +} + +type SnapshotOptions struct { + Testing *testing.T + TestCaseName string + Input string + Output string + Kind OutputKind + FolderName string +} + +// It creates a snapshot for the given test case, the snapshot will include the input and the output of the test case +func MakeSnapshot(options *SnapshotOptions) { + t := options.Testing + testCaseName := options.TestCaseName + input := options.Input + output := options.Output + kind := options.Kind + + folderName := "__snapshots__" + if options.FolderName != "" { + folderName = options.FolderName + } + snapshotName := RedactTestName(testCaseName) + + s := snaps.WithConfig( + snaps.Filename(snapshotName), + snaps.Dir(folderName), + ) + + snapshot := "## Input\n\n```\n" + snapshot += Dedent(input) + snapshot += "\n```\n\n## Output\n\n" + snapshot += "```" + outputKind[kind] + "\n" + snapshot += Dedent(output) + snapshot += "\n```" + + s.MatchSnapshot(t, snapshot) + +} diff --git a/internal/transform/__js_scanner__/component_className_expression.snap b/internal/transform/__js_scanner__/component_className_expression.snap new file mode 100755 index 000000000..b135c4505 --- /dev/null +++ b/internal/transform/__js_scanner__/component_className_expression.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_expression - 1] +## Input + +``` + +``` + +## Output + +```js + +``` +--- diff --git a/internal/transform/__js_scanner__/component_className_not_scoped.snap b/internal/transform/__js_scanner__/component_className_not_scoped.snap new file mode 100755 index 000000000..64969f6e8 --- /dev/null +++ b/internal/transform/__js_scanner__/component_className_not_scoped.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_not_scoped - 1] +## Input + +``` + +``` + +## Output + +```js + +``` +--- diff --git a/internal/transform/__js_scanner__/component_className_shorthand.snap b/internal/transform/__js_scanner__/component_className_shorthand.snap new file mode 100755 index 000000000..f2e497e98 --- /dev/null +++ b/internal/transform/__js_scanner__/component_className_shorthand.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_shorthand - 1] +## Input + +``` + +``` + +## Output + +```js + +``` +--- diff --git a/internal/transform/__js_scanner__/component_class_list.snap b/internal/transform/__js_scanner__/component_class_list.snap new file mode 100755 index 000000000..93e3e97ad --- /dev/null +++ b/internal/transform/__js_scanner__/component_class_list.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_class:list - 1] +## Input + +``` + +``` + +## Output + +```js + +``` +--- diff --git a/internal/transform/__js_scanner__/element_class_list.snap b/internal/transform/__js_scanner__/element_class_list.snap new file mode 100755 index 000000000..82498e205 --- /dev/null +++ b/internal/transform/__js_scanner__/element_class_list.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/element_class:list - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/element_class_list_string.snap b/internal/transform/__js_scanner__/element_class_list_string.snap new file mode 100755 index 000000000..9a24f4c15 --- /dev/null +++ b/internal/transform/__js_scanner__/element_class_list_string.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/element_class:list_string - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/empty.snap b/internal/transform/__js_scanner__/empty.snap new file mode 100755 index 000000000..706f1403f --- /dev/null +++ b/internal/transform/__js_scanner__/empty.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/empty - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/expression_dynamic.snap b/internal/transform/__js_scanner__/expression_dynamic.snap new file mode 100755 index 000000000..cf0983e96 --- /dev/null +++ b/internal/transform/__js_scanner__/expression_dynamic.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_dynamic - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/expression_function.snap b/internal/transform/__js_scanner__/expression_function.snap new file mode 100755 index 000000000..6be68643b --- /dev/null +++ b/internal/transform/__js_scanner__/expression_function.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_function - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/expression_string.snap b/internal/transform/__js_scanner__/expression_string.snap new file mode 100755 index 000000000..016d77a68 --- /dev/null +++ b/internal/transform/__js_scanner__/expression_string.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_string - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/fault_input_currently_accepted.snap b/internal/transform/__js_scanner__/fault_input_currently_accepted.snap new file mode 100755 index 000000000..bd41af054 --- /dev/null +++ b/internal/transform/__js_scanner__/fault_input_currently_accepted.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/fault_input_currently_accepted - 1] +## Input + +``` + +``` + +## Output + +```js +={0>} class="astro-xxxxxx"> +``` +--- diff --git a/internal/transform/__js_scanner__/none.snap b/internal/transform/__js_scanner__/none.snap new file mode 100755 index 000000000..3812b3d00 --- /dev/null +++ b/internal/transform/__js_scanner__/none.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/none - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/quoted.snap b/internal/transform/__js_scanner__/quoted.snap new file mode 100755 index 000000000..198ffb659 --- /dev/null +++ b/internal/transform/__js_scanner__/quoted.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/quoted - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/quoted_no_trim.snap b/internal/transform/__js_scanner__/quoted_no_trim.snap new file mode 100755 index 000000000..19db55e1f --- /dev/null +++ b/internal/transform/__js_scanner__/quoted_no_trim.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/quoted_no_trim - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__js_scanner__/template_literal.snap b/internal/transform/__js_scanner__/template_literal.snap new file mode 100755 index 000000000..e554a5ba6 --- /dev/null +++ b/internal/transform/__js_scanner__/template_literal.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/template_literal - 1] +## Input + +``` +
+``` + +## Output + +```js +
+``` +--- diff --git a/internal/transform/__scope-css__/_container.snap b/internal/transform/__scope-css__/_container.snap new file mode 100755 index 000000000..0733e8cd5 --- /dev/null +++ b/internal/transform/__scope-css__/_container.snap @@ -0,0 +1,18 @@ + +[TestScopeStyle/@container - 1] +## Input + +``` +@container (min-width: 200px) and (min-height: 200px) { + h1 { + font-size: 30px; + } + } +``` + +## Output + +```css +@container (min-width: 200px) and (min-height: 200px){h1:where(.astro-xxxxxx){font-size:30px}} +``` +--- diff --git a/internal/transform/__scope-css__/_layer.snap b/internal/transform/__scope-css__/_layer.snap new file mode 100755 index 000000000..6faa8085a --- /dev/null +++ b/internal/transform/__scope-css__/_layer.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/@layer - 1] +## Input + +``` +@layer theme, layout, utilities; @layer special { .item { color: rebeccapurple; }} +``` + +## Output + +```css +@layer theme,layout,utilities;@layer special{.item:where(.astro-xxxxxx){color:rebeccapurple}} +``` +--- diff --git a/internal/transform/__scope-css__/_root.snap b/internal/transform/__scope-css__/_root.snap new file mode 100755 index 000000000..b022f1f67 --- /dev/null +++ b/internal/transform/__scope-css__/_root.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/:root - 1] +## Input + +``` +:root{} +``` + +## Output + +```css +:root{} +``` +--- diff --git a/internal/transform/__scope-css__/_starting-style.snap b/internal/transform/__scope-css__/_starting-style.snap new file mode 100755 index 000000000..cef96b927 --- /dev/null +++ b/internal/transform/__scope-css__/_starting-style.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/@starting-style - 1] +## Input + +``` +@starting-style{.class{}} +``` + +## Output + +```css +@starting-style{.class:where(.astro-xxxxxx){}} +``` +--- diff --git a/internal/transform/__scope-css__/adjacent_sibling.snap b/internal/transform/__scope-css__/adjacent_sibling.snap new file mode 100755 index 000000000..50a413d4c --- /dev/null +++ b/internal/transform/__scope-css__/adjacent_sibling.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/adjacent_sibling - 1] +## Input + +``` +.class+.class{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx)+.class:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/and_selector.snap b/internal/transform/__scope-css__/and_selector.snap new file mode 100755 index 000000000..28af4d6a0 --- /dev/null +++ b/internal/transform/__scope-css__/and_selector.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/and_selector - 1] +## Input + +``` +.class,.class{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx),.class:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/attr.snap b/internal/transform/__scope-css__/attr.snap new file mode 100755 index 000000000..73a0bf34a --- /dev/null +++ b/internal/transform/__scope-css__/attr.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/attr - 1] +## Input + +``` +a[aria-current=page]{} +``` + +## Output + +```css +a:where(.astro-xxxxxx)[aria-current=page]{} +``` +--- diff --git a/internal/transform/__scope-css__/attr_universal_implied.snap b/internal/transform/__scope-css__/attr_universal_implied.snap new file mode 100755 index 000000000..67be54c16 --- /dev/null +++ b/internal/transform/__scope-css__/attr_universal_implied.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/attr_universal_implied - 1] +## Input + +``` +[aria-visible],[aria-hidden]{} +``` + +## Output + +```css +:where(.astro-xxxxxx)[aria-visible],:where(.astro-xxxxxx)[aria-hidden]{} +``` +--- diff --git a/internal/transform/__scope-css__/attributes.snap b/internal/transform/__scope-css__/attributes.snap new file mode 100755 index 000000000..756610481 --- /dev/null +++ b/internal/transform/__scope-css__/attributes.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/attributes - 1] +## Input + +``` +body{background-image:url('/assets/bg.jpg');clip-path:polygon(0% 0%,100% 0%,100% 100%,0% 100%);} +``` + +## Output + +```css +body{background-image:url(/assets/bg.jpg);clip-path:polygon(0% 0%,100% 0%,100% 100%,0% 100%)} +``` +--- diff --git a/internal/transform/__scope-css__/body.snap b/internal/transform/__scope-css__/body.snap new file mode 100755 index 000000000..d9727659d --- /dev/null +++ b/internal/transform/__scope-css__/body.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/body - 1] +## Input + +``` +body h1{} +``` + +## Output + +```css +body h1:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/body_class.snap b/internal/transform/__scope-css__/body_class.snap new file mode 100755 index 000000000..5a2f8f288 --- /dev/null +++ b/internal/transform/__scope-css__/body_class.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/body_class - 1] +## Input + +``` +body.theme-dark{} +``` + +## Output + +```css +body.theme-dark{} +``` +--- diff --git a/internal/transform/__scope-css__/calc.snap b/internal/transform/__scope-css__/calc.snap new file mode 100755 index 000000000..3cae72639 --- /dev/null +++ b/internal/transform/__scope-css__/calc.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/calc - 1] +## Input + +``` +:root{padding:calc(var(--space) * 2);} +``` + +## Output + +```css +:root{padding:calc(var(--space) * 2)} +``` +--- diff --git a/internal/transform/__scope-css__/chained__not__.snap b/internal/transform/__scope-css__/chained__not__.snap new file mode 100755 index 000000000..445b321a7 --- /dev/null +++ b/internal/transform/__scope-css__/chained__not__.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/chained_:not() - 1] +## Input + +``` +.class:not(.is-active):not(.is-disabled){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx):not(.is-active):not(.is-disabled){} +``` +--- diff --git a/internal/transform/__scope-css__/charset.snap b/internal/transform/__scope-css__/charset.snap new file mode 100755 index 000000000..e77587e76 --- /dev/null +++ b/internal/transform/__scope-css__/charset.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/charset - 1] +## Input + +``` +@charset "utf-8"; +``` + +## Output + +```css +@charset "utf-8"; +``` +--- diff --git a/internal/transform/__scope-css__/children_universal.snap b/internal/transform/__scope-css__/children_universal.snap new file mode 100755 index 000000000..89998fe39 --- /dev/null +++ b/internal/transform/__scope-css__/children_universal.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/children_universal - 1] +## Input + +``` +.class *{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) :where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/class.snap b/internal/transform/__scope-css__/class.snap new file mode 100755 index 000000000..74ad92e3e --- /dev/null +++ b/internal/transform/__scope-css__/class.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/class - 1] +## Input + +``` +.class{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/class_chained_global.snap b/internal/transform/__scope-css__/class_chained_global.snap new file mode 100755 index 000000000..9da2dd9db --- /dev/null +++ b/internal/transform/__scope-css__/class_chained_global.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/class_chained_global - 1] +## Input + +``` +.class:global(.bar){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx).bar{} +``` +--- diff --git a/internal/transform/__scope-css__/element.snap b/internal/transform/__scope-css__/element.snap new file mode 100755 index 000000000..9d25795b1 --- /dev/null +++ b/internal/transform/__scope-css__/element.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/element - 1] +## Input + +``` +h1{} +``` + +## Output + +```css +h1:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/element___pseudo_element.snap b/internal/transform/__scope-css__/element___pseudo_element.snap new file mode 100755 index 000000000..5ed70d1e5 --- /dev/null +++ b/internal/transform/__scope-css__/element___pseudo_element.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/element_+_pseudo_element - 1] +## Input + +``` +.class h3::before{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) h3:where(.astro-xxxxxx)::before{} +``` +--- diff --git a/internal/transform/__scope-css__/element___pseudo_state.snap b/internal/transform/__scope-css__/element___pseudo_state.snap new file mode 100755 index 000000000..fc4765ef0 --- /dev/null +++ b/internal/transform/__scope-css__/element___pseudo_state.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/element_+_pseudo_state - 1] +## Input + +``` +.class button:focus{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) button:where(.astro-xxxxxx):focus{} +``` +--- diff --git a/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap b/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap new file mode 100755 index 000000000..ceb0e4a11 --- /dev/null +++ b/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/element_+_pseudo_state_+_pseudo_element - 1] +## Input + +``` +button:focus::before{} +``` + +## Output + +```css +button:where(.astro-xxxxxx):focus::before{} +``` +--- diff --git a/internal/transform/__scope-css__/escaped_characters.snap b/internal/transform/__scope-css__/escaped_characters.snap new file mode 100755 index 000000000..92cf80a75 --- /dev/null +++ b/internal/transform/__scope-css__/escaped_characters.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/escaped_characters - 1] +## Input + +``` +.class\:class:focus{} +``` + +## Output + +```css +.class\:class:where(.astro-xxxxxx):focus{} +``` +--- diff --git a/internal/transform/__scope-css__/global_chaining_global.snap b/internal/transform/__scope-css__/global_chaining_global.snap new file mode 100755 index 000000000..8c6c95719 --- /dev/null +++ b/internal/transform/__scope-css__/global_chaining_global.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_chaining_global - 1] +## Input + +``` +:global(.foo):global(.bar){} +``` + +## Output + +```css +.foo.bar{} +``` +--- diff --git a/internal/transform/__scope-css__/global_children.snap b/internal/transform/__scope-css__/global_children.snap new file mode 100755 index 000000000..df3f2f1da --- /dev/null +++ b/internal/transform/__scope-css__/global_children.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_children - 1] +## Input + +``` +.class :global(ul li){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) ul li{} +``` +--- diff --git a/internal/transform/__scope-css__/global_nested_parens.snap b/internal/transform/__scope-css__/global_nested_parens.snap new file mode 100755 index 000000000..7a67fb484 --- /dev/null +++ b/internal/transform/__scope-css__/global_nested_parens.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_nested_parens - 1] +## Input + +``` +.class :global(.nav:not(.is-active)){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) .nav:not(.is-active){} +``` +--- diff --git a/internal/transform/__scope-css__/global_nested_parens___chained_class.snap b/internal/transform/__scope-css__/global_nested_parens___chained_class.snap new file mode 100755 index 000000000..bee113787 --- /dev/null +++ b/internal/transform/__scope-css__/global_nested_parens___chained_class.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_nested_parens_+_chained_class - 1] +## Input + +``` +:global(body:not(.is-light)).is-dark,:global(body:not(.is-dark)).is-light{} +``` + +## Output + +```css +body:not(.is-light).is-dark,body:not(.is-dark).is-light{} +``` +--- diff --git a/internal/transform/__scope-css__/global_universal.snap b/internal/transform/__scope-css__/global_universal.snap new file mode 100755 index 000000000..5ca5d7b30 --- /dev/null +++ b/internal/transform/__scope-css__/global_universal.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_universal - 1] +## Input + +``` +.class :global(*){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx) *{} +``` +--- diff --git a/internal/transform/__scope-css__/global_with_scoped_children.snap b/internal/transform/__scope-css__/global_with_scoped_children.snap new file mode 100755 index 000000000..892294403 --- /dev/null +++ b/internal/transform/__scope-css__/global_with_scoped_children.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/global_with_scoped_children - 1] +## Input + +``` +:global(section) .class{} +``` + +## Output + +```css +section .class:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/grid-template-columns.snap b/internal/transform/__scope-css__/grid-template-columns.snap new file mode 100755 index 000000000..d1e5f31c9 --- /dev/null +++ b/internal/transform/__scope-css__/grid-template-columns.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/grid-template-columns - 1] +## Input + +``` +div{grid-template-columns: [content-start] 1fr [content-end];} +``` + +## Output + +```css +div:where(.astro-xxxxxx){grid-template-columns:[content-start] 1fr [content-end]} +``` +--- diff --git a/internal/transform/__scope-css__/html_and_body.snap b/internal/transform/__scope-css__/html_and_body.snap new file mode 100755 index 000000000..691ab0c86 --- /dev/null +++ b/internal/transform/__scope-css__/html_and_body.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/html_and_body - 1] +## Input + +``` +html,body{} +``` + +## Output + +```css +html,body{} +``` +--- diff --git a/internal/transform/__scope-css__/id.snap b/internal/transform/__scope-css__/id.snap new file mode 100755 index 000000000..32f5667f9 --- /dev/null +++ b/internal/transform/__scope-css__/id.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/id - 1] +## Input + +``` +#class{} +``` + +## Output + +```css +#class:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/immediate_child_universal.snap b/internal/transform/__scope-css__/immediate_child_universal.snap new file mode 100755 index 000000000..cba3336c5 --- /dev/null +++ b/internal/transform/__scope-css__/immediate_child_universal.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/immediate_child_universal - 1] +## Input + +``` +.class>*{} +``` + +## Output + +```css +.class:where(.astro-xxxxxx)>:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/import__plain_.snap b/internal/transform/__scope-css__/import__plain_.snap new file mode 100755 index 000000000..94a506142 --- /dev/null +++ b/internal/transform/__scope-css__/import__plain_.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/import_(plain) - 1] +## Input + +``` +@import "./my-file.css"; +``` + +## Output + +```css +@import"./my-file.css"; +``` +--- diff --git a/internal/transform/__scope-css__/import__url_.snap b/internal/transform/__scope-css__/import__url_.snap new file mode 100755 index 000000000..52271b50c --- /dev/null +++ b/internal/transform/__scope-css__/import__url_.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/import_(url) - 1] +## Input + +``` +@import url("./my-file.css"); +``` + +## Output + +```css +@import"./my-file.css"; +``` +--- diff --git a/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap b/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap new file mode 100755 index 000000000..74ecf4ec9 --- /dev/null +++ b/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap @@ -0,0 +1,17 @@ + +[TestScopeStyle/invalid_CSS_(`missing_semi`) - 1] +## Input + +``` +.foo { + color: blue + font-size: 18px; +} +``` + +## Output + +```css +.foo:where(.astro-xxxxxx){color:blue font-size: 18px} +``` +--- diff --git a/internal/transform/__scope-css__/keyframes.snap b/internal/transform/__scope-css__/keyframes.snap new file mode 100755 index 000000000..aa7973367 --- /dev/null +++ b/internal/transform/__scope-css__/keyframes.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/keyframes - 1] +## Input + +``` +@keyframes shuffle{from{transform:rotate(0deg);}to{transform:rotate(360deg);}} +``` + +## Output + +```css +@keyframes shuffle{from{transform:rotate(0deg)}to{transform:rotate(360deg)}} +``` +--- diff --git a/internal/transform/__scope-css__/keyframes_2.snap b/internal/transform/__scope-css__/keyframes_2.snap new file mode 100755 index 000000000..47ed1f970 --- /dev/null +++ b/internal/transform/__scope-css__/keyframes_2.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/keyframes_2 - 1] +## Input + +``` +@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} +``` + +## Output + +```css +@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} +``` +--- diff --git a/internal/transform/__scope-css__/keyframes_end.snap b/internal/transform/__scope-css__/keyframes_end.snap new file mode 100755 index 000000000..227024fa1 --- /dev/null +++ b/internal/transform/__scope-css__/keyframes_end.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/keyframes_end - 1] +## Input + +``` +h1{} h2{} @keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} +``` + +## Output + +```css +h1:where(.astro-xxxxxx){}h2:where(.astro-xxxxxx){}@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} +``` +--- diff --git a/internal/transform/__scope-css__/keyframes_middle.snap b/internal/transform/__scope-css__/keyframes_middle.snap new file mode 100755 index 000000000..b602c81b0 --- /dev/null +++ b/internal/transform/__scope-css__/keyframes_middle.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/keyframes_middle - 1] +## Input + +``` +h1{} @keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} h2{} +``` + +## Output + +```css +h1:where(.astro-xxxxxx){}@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}}h2:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/keyframes_start.snap b/internal/transform/__scope-css__/keyframes_start.snap new file mode 100755 index 000000000..edd58c861 --- /dev/null +++ b/internal/transform/__scope-css__/keyframes_start.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/keyframes_start - 1] +## Input + +``` +@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} h1{} h2{} +``` + +## Output + +```css +@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}}h1:where(.astro-xxxxxx){}h2:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/media_query.snap b/internal/transform/__scope-css__/media_query.snap new file mode 100755 index 000000000..1676c66d4 --- /dev/null +++ b/internal/transform/__scope-css__/media_query.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/media_query - 1] +## Input + +``` +@media screen and (min-width:640px){.class{}} +``` + +## Output + +```css +@media screen and (min-width:640px){.class:where(.astro-xxxxxx){}} +``` +--- diff --git a/internal/transform/__scope-css__/more_weird_chaining.snap b/internal/transform/__scope-css__/more_weird_chaining.snap new file mode 100755 index 000000000..a6ab26452 --- /dev/null +++ b/internal/transform/__scope-css__/more_weird_chaining.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/more_weird_chaining - 1] +## Input + +``` +:not(.is-disabled).a{} +``` + +## Output + +```css +:not(.is-disabled).a:where(.astro-xxxxxx){} +``` +--- diff --git a/internal/transform/__scope-css__/nesting_combinator.snap b/internal/transform/__scope-css__/nesting_combinator.snap new file mode 100755 index 000000000..63c3719ed --- /dev/null +++ b/internal/transform/__scope-css__/nesting_combinator.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/nesting_combinator - 1] +## Input + +``` +div { & span { color: blue } } +``` + +## Output + +```css +div:where(.astro-xxxxxx){& span:where(.astro-xxxxxx){color:blue}} +``` +--- diff --git a/internal/transform/__scope-css__/nesting_media.snap b/internal/transform/__scope-css__/nesting_media.snap new file mode 100755 index 000000000..81e7e9528 --- /dev/null +++ b/internal/transform/__scope-css__/nesting_media.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/nesting_media - 1] +## Input + +``` +:global(html) { @media (min-width: 640px) { color: blue } }html { background-color: lime } +``` + +## Output + +```css +html{@media (min-width: 640px){color:blue}}html{background-color:lime} +``` +--- diff --git a/internal/transform/__scope-css__/nesting_modifier.snap b/internal/transform/__scope-css__/nesting_modifier.snap new file mode 100755 index 000000000..0300c1f37 --- /dev/null +++ b/internal/transform/__scope-css__/nesting_modifier.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/nesting_modifier - 1] +## Input + +``` +.header { background-color: white; &.dark { background-color: blue; }} +``` + +## Output + +```css +.header:where(.astro-xxxxxx){background-color:white;&.dark{background-color:blue}} +``` +--- diff --git a/internal/transform/__scope-css__/subsequent_siblings___global.snap b/internal/transform/__scope-css__/subsequent_siblings___global.snap new file mode 100755 index 000000000..19e1e7d87 --- /dev/null +++ b/internal/transform/__scope-css__/subsequent_siblings___global.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/subsequent_siblings_+_global - 1] +## Input + +``` +.class~:global(a){} +``` + +## Output + +```css +.class:where(.astro-xxxxxx)~a{} +``` +--- diff --git a/internal/transform/__scope-css__/universal_pseudo_state.snap b/internal/transform/__scope-css__/universal_pseudo_state.snap new file mode 100755 index 000000000..c65de1e8d --- /dev/null +++ b/internal/transform/__scope-css__/universal_pseudo_state.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/universal_pseudo_state - 1] +## Input + +``` +*:hover{} +``` + +## Output + +```css +:where(.astro-xxxxxx):hover{} +``` +--- diff --git a/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap b/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap new file mode 100755 index 000000000..5d89b219c --- /dev/null +++ b/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/valid_CSS,_madeup_syntax - 1] +## Input + +``` +@tailwind base; +``` + +## Output + +```css +@tailwind base; +``` +--- diff --git a/internal/transform/__scope-css__/variables.snap b/internal/transform/__scope-css__/variables.snap new file mode 100755 index 000000000..45aad6de6 --- /dev/null +++ b/internal/transform/__scope-css__/variables.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/variables - 1] +## Input + +``` +body{--bg:red;background:var(--bg);color:black;} +``` + +## Output + +```css +body{--bg:red;background:var(--bg);color:black} +``` +--- diff --git a/internal/transform/__scope-css__/weird_chaining.snap b/internal/transform/__scope-css__/weird_chaining.snap new file mode 100755 index 000000000..557c80d56 --- /dev/null +++ b/internal/transform/__scope-css__/weird_chaining.snap @@ -0,0 +1,14 @@ + +[TestScopeStyle/weird_chaining - 1] +## Input + +``` +:hover.a:focus{} +``` + +## Output + +```css +:hover.a:where(.astro-xxxxxx):focus{} +``` +--- diff --git a/internal/transform/__scope_html__/component_className_expression.snap b/internal/transform/__scope_html__/component_className_expression.snap new file mode 100755 index 000000000..af3a7c552 --- /dev/null +++ b/internal/transform/__scope_html__/component_className_expression.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_expression - 1] +## Input + +``` + +``` + +## Output + +```jsx + +``` +--- diff --git a/internal/transform/__scope_html__/component_className_not_scoped.snap b/internal/transform/__scope_html__/component_className_not_scoped.snap new file mode 100755 index 000000000..3d3810612 --- /dev/null +++ b/internal/transform/__scope_html__/component_className_not_scoped.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_not_scoped - 1] +## Input + +``` + +``` + +## Output + +```jsx + +``` +--- diff --git a/internal/transform/__scope_html__/component_className_shorthand.snap b/internal/transform/__scope_html__/component_className_shorthand.snap new file mode 100755 index 000000000..9675a0839 --- /dev/null +++ b/internal/transform/__scope_html__/component_className_shorthand.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_className_shorthand - 1] +## Input + +``` + +``` + +## Output + +```jsx + +``` +--- diff --git a/internal/transform/__scope_html__/component_class_list.snap b/internal/transform/__scope_html__/component_class_list.snap new file mode 100755 index 000000000..99ecb087d --- /dev/null +++ b/internal/transform/__scope_html__/component_class_list.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/component_class:list - 1] +## Input + +``` + +``` + +## Output + +```jsx + +``` +--- diff --git a/internal/transform/__scope_html__/element_class_list.snap b/internal/transform/__scope_html__/element_class_list.snap new file mode 100755 index 000000000..187da645c --- /dev/null +++ b/internal/transform/__scope_html__/element_class_list.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/element_class:list - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/element_class_list_string.snap b/internal/transform/__scope_html__/element_class_list_string.snap new file mode 100755 index 000000000..74ff57709 --- /dev/null +++ b/internal/transform/__scope_html__/element_class_list_string.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/element_class:list_string - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/empty.snap b/internal/transform/__scope_html__/empty.snap new file mode 100755 index 000000000..7c9036a1c --- /dev/null +++ b/internal/transform/__scope_html__/empty.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/empty - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/expression_dynamic.snap b/internal/transform/__scope_html__/expression_dynamic.snap new file mode 100755 index 000000000..6fb8042f5 --- /dev/null +++ b/internal/transform/__scope_html__/expression_dynamic.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_dynamic - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/expression_function.snap b/internal/transform/__scope_html__/expression_function.snap new file mode 100755 index 000000000..ba8f51c97 --- /dev/null +++ b/internal/transform/__scope_html__/expression_function.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_function - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/expression_string.snap b/internal/transform/__scope_html__/expression_string.snap new file mode 100755 index 000000000..a4da718d9 --- /dev/null +++ b/internal/transform/__scope_html__/expression_string.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/expression_string - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/fault_input_currently_accepted.snap b/internal/transform/__scope_html__/fault_input_currently_accepted.snap new file mode 100755 index 000000000..4059ef05b --- /dev/null +++ b/internal/transform/__scope_html__/fault_input_currently_accepted.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/fault_input_currently_accepted - 1] +## Input + +``` + +``` + +## Output + +```jsx +={0>} class="astro-xxxxxx"> +``` +--- diff --git a/internal/transform/__scope_html__/none.snap b/internal/transform/__scope_html__/none.snap new file mode 100755 index 000000000..14a5f1a90 --- /dev/null +++ b/internal/transform/__scope_html__/none.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/none - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/quoted.snap b/internal/transform/__scope_html__/quoted.snap new file mode 100755 index 000000000..1abcb1338 --- /dev/null +++ b/internal/transform/__scope_html__/quoted.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/quoted - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/quoted_no_trim.snap b/internal/transform/__scope_html__/quoted_no_trim.snap new file mode 100755 index 000000000..c70d3cb9b --- /dev/null +++ b/internal/transform/__scope_html__/quoted_no_trim.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/quoted_no_trim - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__scope_html__/template_literal.snap b/internal/transform/__scope_html__/template_literal.snap new file mode 100755 index 000000000..712da2a8f --- /dev/null +++ b/internal/transform/__scope_html__/template_literal.snap @@ -0,0 +1,14 @@ + +[TestScopeHTML/template_literal - 1] +## Input + +``` +
+``` + +## Output + +```jsx +
+``` +--- diff --git a/internal/transform/__transform__/basic.snap b/internal/transform/__transform__/basic.snap new file mode 100755 index 000000000..83a592bdc --- /dev/null +++ b/internal/transform/__transform__/basic.snap @@ -0,0 +1,14 @@ + +[TestAnnotation/basic - 1] +## Input + +``` +
Hello world!
+``` + +## Output + +```jsx +
Hello world!
+``` +--- diff --git a/internal/transform/__transform__/injects_root.snap b/internal/transform/__transform__/injects_root.snap new file mode 100755 index 000000000..20ae559a0 --- /dev/null +++ b/internal/transform/__transform__/injects_root.snap @@ -0,0 +1,14 @@ + +[TestAnnotation/injects_root - 1] +## Input + +``` + +``` + +## Output + +```jsx + +``` +--- diff --git a/internal/transform/__transform__/no_components.snap b/internal/transform/__transform__/no_components.snap new file mode 100755 index 000000000..b53eaf4d6 --- /dev/null +++ b/internal/transform/__transform__/no_components.snap @@ -0,0 +1,14 @@ + +[TestAnnotation/no_components - 1] +## Input + +``` +Hello world! +``` + +## Output + +```jsx +Hello world! +``` +--- diff --git a/internal/transform/scope-css_test.go b/internal/transform/scope-css_test.go index 9510b841b..e327c9ae9 100644 --- a/internal/transform/scope-css_test.go +++ b/internal/transform/scope-css_test.go @@ -290,6 +290,14 @@ func TestScopeStyle(t *testing.T) { if tt.want != got { t.Errorf("\nFAIL: %s\n want: %s\n got: %s", tt.name, tt.want, got) } + test_utils.MakeSnapshot(&test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: tt.source, + Output: got, + Kind: test_utils.CssOutput, + FolderName: "__scope-css__", + }) }) } } diff --git a/internal/transform/scope-html_test.go b/internal/transform/scope-html_test.go index 0349fd576..792bc7378 100644 --- a/internal/transform/scope-html_test.go +++ b/internal/transform/scope-html_test.go @@ -7,6 +7,7 @@ import ( astro "github.com/withastro/compiler/internal" "github.com/withastro/compiler/internal/handler" + "github.com/withastro/compiler/internal/test_utils" "golang.org/x/net/html/atom" ) @@ -120,6 +121,15 @@ func TestScopeHTML(t *testing.T) { if err != nil { t.Error(err) } + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: tt.source, + Output: string(got), + Kind: test_utils.JsxOutput, + FolderName: "__scope_html__", + }) ScopeElement(nodes[0], TransformOptions{Scope: "xxxxxx"}) astro.PrintToSource(&b, nodes[0]) }) diff --git a/internal/transform/transform_test.go b/internal/transform/transform_test.go index a52dc11b6..ae3b9e1f7 100644 --- a/internal/transform/transform_test.go +++ b/internal/transform/transform_test.go @@ -8,6 +8,7 @@ import ( astro "github.com/withastro/compiler/internal" "github.com/withastro/compiler/internal/handler" + "github.com/withastro/compiler/internal/test_utils" ) func transformScopingFixtures() []struct { @@ -528,6 +529,16 @@ func TestAnnotation(t *testing.T) { if tt.want != got { t.Errorf("\nFAIL: %s\n want: %s\n got: %s", tt.name, tt.want, got) } + + test_utils.MakeSnapshot( + &test_utils.SnapshotOptions{ + Testing: t, + TestCaseName: tt.name, + Input: tt.source, + Output: string(got), + Kind: test_utils.JsxOutput, + FolderName: "__transform__", + }) }) } } From b44b65d3e446bcb347ab2addf108fff6cacafe10 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 20 Jun 2024 08:45:14 +0100 Subject: [PATCH 4/9] fix rebase changes --- CONTRIBUTING.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 49b078c96..8e345734b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ go test -v ./internal/printer ``` ### Run a specific test case -Many of your test cases are designed like this: +Many of our test cases are designed like this: ```go func TestPrintToJSON(t *testing.T) { @@ -72,11 +72,7 @@ go test -v ./internal/... -run TestPrintToJSON/basic go test -v ./internal/... -run TestPrintToJSON/Comment preserves whitespace ``` -### Adding new tests - -Adding tests for the tokenizer, scanner, and printer can be found in `internal/token_test.go`, `internal/js_scanner_test.go`, and `internal/printer/printer_test.go`, respectively. - -### Snapshot testing +#### Snapshot testing We use [go-snaps](https://github.com/gkampitakis/go-snaps) for snapshot testing. Visit their repository for more details on how to use it @@ -94,6 +90,11 @@ Instead, if there are some **obsolete snapshots**, you can `UPDATE_SNAPS=clean`: UPDATE_SNAPS=clean go test -v ./internal/... ``` + +### Adding new tests + +Adding tests for the tokenizer, scanner, and printer can be found in `internal/token_test.go`, `internal/js_scanner_test.go`, and `internal/printer/printer_test.go`, respectively. + [homebrew]: https://brew.sh/ [go]: https://golang.org/ [go-vscode]: https://marketplace.visualstudio.com/items?itemName=golang.go From f2b243337fb48d56925a199c11388172a0f0e3bb Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Thu, 20 Jun 2024 08:47:17 +0100 Subject: [PATCH 5/9] chore: document utility --- internal/test_utils/test_utils.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/test_utils/test_utils.go b/internal/test_utils/test_utils.go index 535905f0f..67c186fac 100644 --- a/internal/test_utils/test_utils.go +++ b/internal/test_utils/test_utils.go @@ -81,12 +81,18 @@ var outputKind = map[OutputKind]string{ } type SnapshotOptions struct { - Testing *testing.T + // The testing instances + Testing *testing.T + // The name of the test case TestCaseName string - Input string - Output string - Kind OutputKind - FolderName string + // The initial source code that needs to be tested + Input string + // The final output + Output string + // The kind of **markdown block** that the output will be wrapped + Kind OutputKind + // The folder name that the snapshots will be stored + FolderName string } // It creates a snapshot for the given test case, the snapshot will include the input and the output of the test case From a798f47e9d98e7dab5aa983ee9201c8efaa2f000 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 30 Jul 2024 11:15:26 +0100 Subject: [PATCH 6/9] remove want from printer tests --- internal/js_scanner/__js_scanner__/array.snap | 14 - internal/js_scanner/__js_scanner__/basic.snap | 14 - .../__js_scanner__/invalid_strings.snap | 14 - .../js_scanner/__js_scanner__/literal.snap | 14 - .../js_scanner/__js_scanner__/multiple.snap | 14 - .../js_scanner/__js_scanner__/objects.snap | 14 - .../js_scanner/__js_scanner__/regexp.snap | 14 - .../js_scanner/__js_scanner__/shorhand.snap | 14 - .../__js_scanner__/valid_strings.snap | 14 - internal/js_scanner/js_scanner_test.go | 9 - .../printer/__printer_js__/scriptinline.snap | 41 + internal/printer/printer_css_test.go | 11 - internal/printer/printer_test.go | 1634 +---------------- .../component_className_expression.snap | 14 - .../component_className_not_scoped.snap | 14 - .../component_className_shorthand.snap | 14 - .../__js_scanner__/component_class_list.snap | 14 - .../__js_scanner__/element_class_list.snap | 14 - .../element_class_list_string.snap | 14 - internal/transform/__js_scanner__/empty.snap | 14 - .../__js_scanner__/expression_dynamic.snap | 14 - .../__js_scanner__/expression_function.snap | 14 - .../__js_scanner__/expression_string.snap | 14 - .../fault_input_currently_accepted.snap | 14 - internal/transform/__js_scanner__/none.snap | 14 - internal/transform/__js_scanner__/quoted.snap | 14 - .../__js_scanner__/quoted_no_trim.snap | 14 - .../__js_scanner__/template_literal.snap | 14 - .../transform/__scope-css__/_container.snap | 18 - internal/transform/__scope-css__/_layer.snap | 14 - internal/transform/__scope-css__/_root.snap | 14 - .../__scope-css__/_starting-style.snap | 14 - .../__scope-css__/adjacent_sibling.snap | 14 - .../transform/__scope-css__/and_selector.snap | 14 - internal/transform/__scope-css__/attr.snap | 14 - .../__scope-css__/attr_universal_implied.snap | 14 - .../transform/__scope-css__/attributes.snap | 14 - internal/transform/__scope-css__/body.snap | 14 - .../transform/__scope-css__/body_class.snap | 14 - internal/transform/__scope-css__/calc.snap | 14 - .../__scope-css__/chained__not__.snap | 14 - internal/transform/__scope-css__/charset.snap | 14 - .../__scope-css__/children_universal.snap | 14 - internal/transform/__scope-css__/class.snap | 14 - .../__scope-css__/class_chained_global.snap | 14 - internal/transform/__scope-css__/element.snap | 14 - .../element___pseudo_element.snap | 14 - .../__scope-css__/element___pseudo_state.snap | 14 - ...ement___pseudo_state___pseudo_element.snap | 14 - .../__scope-css__/escaped_characters.snap | 14 - .../__scope-css__/global_chaining_global.snap | 14 - .../__scope-css__/global_children.snap | 14 - .../__scope-css__/global_nested_parens.snap | 14 - .../global_nested_parens___chained_class.snap | 14 - .../__scope-css__/global_universal.snap | 14 - .../global_with_scoped_children.snap | 14 - .../__scope-css__/grid-template-columns.snap | 14 - .../__scope-css__/html_and_body.snap | 14 - internal/transform/__scope-css__/id.snap | 14 - .../immediate_child_universal.snap | 14 - .../__scope-css__/import__plain_.snap | 14 - .../transform/__scope-css__/import__url_.snap | 14 - .../invalid_CSS___missing_semi__.snap | 17 - .../transform/__scope-css__/keyframes.snap | 14 - .../transform/__scope-css__/keyframes_2.snap | 14 - .../__scope-css__/keyframes_end.snap | 14 - .../__scope-css__/keyframes_middle.snap | 14 - .../__scope-css__/keyframes_start.snap | 14 - .../transform/__scope-css__/media_query.snap | 14 - .../__scope-css__/more_weird_chaining.snap | 14 - .../__scope-css__/nesting_combinator.snap | 14 - .../__scope-css__/nesting_media.snap | 14 - .../__scope-css__/nesting_modifier.snap | 14 - .../subsequent_siblings___global.snap | 14 - .../__scope-css__/universal_pseudo_state.snap | 14 - .../valid_CSS,_madeup_syntax.snap | 14 - .../transform/__scope-css__/variables.snap | 14 - .../__scope-css__/weird_chaining.snap | 14 - .../component_className_expression.snap | 14 - .../component_className_not_scoped.snap | 14 - .../component_className_shorthand.snap | 14 - .../__scope_html__/component_class_list.snap | 14 - .../__scope_html__/element_class_list.snap | 14 - .../element_class_list_string.snap | 14 - internal/transform/__scope_html__/empty.snap | 14 - .../__scope_html__/expression_dynamic.snap | 14 - .../__scope_html__/expression_function.snap | 14 - .../__scope_html__/expression_string.snap | 14 - .../fault_input_currently_accepted.snap | 14 - internal/transform/__scope_html__/none.snap | 14 - internal/transform/__scope_html__/quoted.snap | 14 - .../__scope_html__/quoted_no_trim.snap | 14 - .../__scope_html__/template_literal.snap | 14 - internal/transform/__transform__/basic.snap | 14 - .../transform/__transform__/injects_root.snap | 14 - .../__transform__/no_components.snap | 14 - internal/transform/scope-css_test.go | 8 - internal/transform/scope-html_test.go | 11 +- internal/transform/transform_test.go | 10 - 99 files changed, 45 insertions(+), 2974 deletions(-) delete mode 100755 internal/js_scanner/__js_scanner__/array.snap delete mode 100755 internal/js_scanner/__js_scanner__/basic.snap delete mode 100755 internal/js_scanner/__js_scanner__/invalid_strings.snap delete mode 100755 internal/js_scanner/__js_scanner__/literal.snap delete mode 100755 internal/js_scanner/__js_scanner__/multiple.snap delete mode 100755 internal/js_scanner/__js_scanner__/objects.snap delete mode 100755 internal/js_scanner/__js_scanner__/regexp.snap delete mode 100755 internal/js_scanner/__js_scanner__/shorhand.snap delete mode 100755 internal/js_scanner/__js_scanner__/valid_strings.snap create mode 100755 internal/printer/__printer_js__/scriptinline.snap delete mode 100755 internal/transform/__js_scanner__/component_className_expression.snap delete mode 100755 internal/transform/__js_scanner__/component_className_not_scoped.snap delete mode 100755 internal/transform/__js_scanner__/component_className_shorthand.snap delete mode 100755 internal/transform/__js_scanner__/component_class_list.snap delete mode 100755 internal/transform/__js_scanner__/element_class_list.snap delete mode 100755 internal/transform/__js_scanner__/element_class_list_string.snap delete mode 100755 internal/transform/__js_scanner__/empty.snap delete mode 100755 internal/transform/__js_scanner__/expression_dynamic.snap delete mode 100755 internal/transform/__js_scanner__/expression_function.snap delete mode 100755 internal/transform/__js_scanner__/expression_string.snap delete mode 100755 internal/transform/__js_scanner__/fault_input_currently_accepted.snap delete mode 100755 internal/transform/__js_scanner__/none.snap delete mode 100755 internal/transform/__js_scanner__/quoted.snap delete mode 100755 internal/transform/__js_scanner__/quoted_no_trim.snap delete mode 100755 internal/transform/__js_scanner__/template_literal.snap delete mode 100755 internal/transform/__scope-css__/_container.snap delete mode 100755 internal/transform/__scope-css__/_layer.snap delete mode 100755 internal/transform/__scope-css__/_root.snap delete mode 100755 internal/transform/__scope-css__/_starting-style.snap delete mode 100755 internal/transform/__scope-css__/adjacent_sibling.snap delete mode 100755 internal/transform/__scope-css__/and_selector.snap delete mode 100755 internal/transform/__scope-css__/attr.snap delete mode 100755 internal/transform/__scope-css__/attr_universal_implied.snap delete mode 100755 internal/transform/__scope-css__/attributes.snap delete mode 100755 internal/transform/__scope-css__/body.snap delete mode 100755 internal/transform/__scope-css__/body_class.snap delete mode 100755 internal/transform/__scope-css__/calc.snap delete mode 100755 internal/transform/__scope-css__/chained__not__.snap delete mode 100755 internal/transform/__scope-css__/charset.snap delete mode 100755 internal/transform/__scope-css__/children_universal.snap delete mode 100755 internal/transform/__scope-css__/class.snap delete mode 100755 internal/transform/__scope-css__/class_chained_global.snap delete mode 100755 internal/transform/__scope-css__/element.snap delete mode 100755 internal/transform/__scope-css__/element___pseudo_element.snap delete mode 100755 internal/transform/__scope-css__/element___pseudo_state.snap delete mode 100755 internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap delete mode 100755 internal/transform/__scope-css__/escaped_characters.snap delete mode 100755 internal/transform/__scope-css__/global_chaining_global.snap delete mode 100755 internal/transform/__scope-css__/global_children.snap delete mode 100755 internal/transform/__scope-css__/global_nested_parens.snap delete mode 100755 internal/transform/__scope-css__/global_nested_parens___chained_class.snap delete mode 100755 internal/transform/__scope-css__/global_universal.snap delete mode 100755 internal/transform/__scope-css__/global_with_scoped_children.snap delete mode 100755 internal/transform/__scope-css__/grid-template-columns.snap delete mode 100755 internal/transform/__scope-css__/html_and_body.snap delete mode 100755 internal/transform/__scope-css__/id.snap delete mode 100755 internal/transform/__scope-css__/immediate_child_universal.snap delete mode 100755 internal/transform/__scope-css__/import__plain_.snap delete mode 100755 internal/transform/__scope-css__/import__url_.snap delete mode 100755 internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap delete mode 100755 internal/transform/__scope-css__/keyframes.snap delete mode 100755 internal/transform/__scope-css__/keyframes_2.snap delete mode 100755 internal/transform/__scope-css__/keyframes_end.snap delete mode 100755 internal/transform/__scope-css__/keyframes_middle.snap delete mode 100755 internal/transform/__scope-css__/keyframes_start.snap delete mode 100755 internal/transform/__scope-css__/media_query.snap delete mode 100755 internal/transform/__scope-css__/more_weird_chaining.snap delete mode 100755 internal/transform/__scope-css__/nesting_combinator.snap delete mode 100755 internal/transform/__scope-css__/nesting_media.snap delete mode 100755 internal/transform/__scope-css__/nesting_modifier.snap delete mode 100755 internal/transform/__scope-css__/subsequent_siblings___global.snap delete mode 100755 internal/transform/__scope-css__/universal_pseudo_state.snap delete mode 100755 internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap delete mode 100755 internal/transform/__scope-css__/variables.snap delete mode 100755 internal/transform/__scope-css__/weird_chaining.snap delete mode 100755 internal/transform/__scope_html__/component_className_expression.snap delete mode 100755 internal/transform/__scope_html__/component_className_not_scoped.snap delete mode 100755 internal/transform/__scope_html__/component_className_shorthand.snap delete mode 100755 internal/transform/__scope_html__/component_class_list.snap delete mode 100755 internal/transform/__scope_html__/element_class_list.snap delete mode 100755 internal/transform/__scope_html__/element_class_list_string.snap delete mode 100755 internal/transform/__scope_html__/empty.snap delete mode 100755 internal/transform/__scope_html__/expression_dynamic.snap delete mode 100755 internal/transform/__scope_html__/expression_function.snap delete mode 100755 internal/transform/__scope_html__/expression_string.snap delete mode 100755 internal/transform/__scope_html__/fault_input_currently_accepted.snap delete mode 100755 internal/transform/__scope_html__/none.snap delete mode 100755 internal/transform/__scope_html__/quoted.snap delete mode 100755 internal/transform/__scope_html__/quoted_no_trim.snap delete mode 100755 internal/transform/__scope_html__/template_literal.snap delete mode 100755 internal/transform/__transform__/basic.snap delete mode 100755 internal/transform/__transform__/injects_root.snap delete mode 100755 internal/transform/__transform__/no_components.snap diff --git a/internal/js_scanner/__js_scanner__/array.snap b/internal/js_scanner/__js_scanner__/array.snap deleted file mode 100755 index e52bca2e6..000000000 --- a/internal/js_scanner/__js_scanner__/array.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/array - 1] -## Input - -``` -{ a: [0, 1, 2], b: ["one", "two", "three"], c: 0 } -``` - -## Output - -```js -["a","b","c"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/basic.snap b/internal/js_scanner/__js_scanner__/basic.snap deleted file mode 100755 index 08a4d76e6..000000000 --- a/internal/js_scanner/__js_scanner__/basic.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/basic - 1] -## Input - -``` -{ value } -``` - -## Output - -```js -["value"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/invalid_strings.snap b/internal/js_scanner/__js_scanner__/invalid_strings.snap deleted file mode 100755 index 31e047481..000000000 --- a/internal/js_scanner/__js_scanner__/invalid_strings.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/invalid_strings - 1] -## Input - -``` -{ "dash-case": true, "with.dot": true, "with space": true } -``` - -## Output - -```js -["\"dash-case\": dashCase","\"with.dot\": withDot","\"with space\": withSpace"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/literal.snap b/internal/js_scanner/__js_scanner__/literal.snap deleted file mode 100755 index c8187ed93..000000000 --- a/internal/js_scanner/__js_scanner__/literal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/literal - 1] -## Input - -``` -{ value: 0 } -``` - -## Output - -```js -["value"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/multiple.snap b/internal/js_scanner/__js_scanner__/multiple.snap deleted file mode 100755 index 72da6e75c..000000000 --- a/internal/js_scanner/__js_scanner__/multiple.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/multiple - 1] -## Input - -``` -{ a: 0, b: 1, c: 2 } -``` - -## Output - -```js -["a","b","c"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/objects.snap b/internal/js_scanner/__js_scanner__/objects.snap deleted file mode 100755 index fe22e4266..000000000 --- a/internal/js_scanner/__js_scanner__/objects.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/objects - 1] -## Input - -``` -{ a: { a1: 0 }, b: { b1: { b2: 0 }}, c: { c1: { c2: { c3: 0 }}} } -``` - -## Output - -```js -["a","b","c"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/regexp.snap b/internal/js_scanner/__js_scanner__/regexp.snap deleted file mode 100755 index af053d82c..000000000 --- a/internal/js_scanner/__js_scanner__/regexp.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/regexp - 1] -## Input - -``` -{ a: /hello/g, b: 0 } -``` - -## Output - -```js -["a","b"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/shorhand.snap b/internal/js_scanner/__js_scanner__/shorhand.snap deleted file mode 100755 index 11f28b696..000000000 --- a/internal/js_scanner/__js_scanner__/shorhand.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/shorhand - 1] -## Input - -``` -{ value, foo, bar, baz, bing } -``` - -## Output - -```js -["value","foo","bar","baz","bing"] -``` ---- diff --git a/internal/js_scanner/__js_scanner__/valid_strings.snap b/internal/js_scanner/__js_scanner__/valid_strings.snap deleted file mode 100755 index c13ed8fa7..000000000 --- a/internal/js_scanner/__js_scanner__/valid_strings.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestGetObjectKeys/valid_strings - 1] -## Input - -``` -{ "lowercase": true, "camelCase": true, "PascalCase": true, "snake_case": true, "__private": true, ["computed"]: true, } -``` - -## Output - -```js -["lowercase","camelCase","PascalCase","snake_case","__private","computed"] -``` ---- diff --git a/internal/js_scanner/js_scanner_test.go b/internal/js_scanner/js_scanner_test.go index e2abf1435..c54edc879 100644 --- a/internal/js_scanner/js_scanner_test.go +++ b/internal/js_scanner/js_scanner_test.go @@ -662,15 +662,6 @@ func TestGetObjectKeys(t *testing.T) { t.Errorf("mismatch (-want +got):\n%s", diff) } - test_utils.MakeSnapshot( - &test_utils.SnapshotOptions{ - Testing: t, - TestCaseName: tt.name, - Input: tt.source, - Output: string(got), - Kind: test_utils.JsOutput, - FolderName: "__js_scanner__", - }) }) } } diff --git a/internal/printer/__printer_js__/scriptinline.snap b/internal/printer/__printer_js__/scriptinline.snap new file mode 100755 index 000000000..37db1063f --- /dev/null +++ b/internal/printer/__printer_js__/scriptinline.snap @@ -0,0 +1,41 @@ + +[TestPrinter/scriptinline - 1] +## Input + +``` +
+``` + +## Output + +```js +import { + Fragment, + render as $$render, + createAstro as $$createAstro, + createComponent as $$createComponent, + renderComponent as $$renderComponent, + renderHead as $$renderHead, + maybeRenderHead as $$maybeRenderHead, + unescapeHTML as $$unescapeHTML, + renderSlot as $$renderSlot, + mergeSlots as $$mergeSlots, + addAttribute as $$addAttribute, + spreadAttributes as $$spreadAttributes, + defineStyleVars as $$defineStyleVars, + defineScriptVars as $$defineScriptVars, + renderTransition as $$renderTransition, + createTransitionScope as $$createTransitionScope, + renderScript as $$renderScript, + createMetadata as $$createMetadata +} from "http://localhost:3000/"; + +export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydratedComponents: [], clientOnlyComponents: [], hydrationDirectives: new Set([]), hoisted: [] }); + +const $$Component = $$createComponent(($$result, $$props, $$slots) => { + +return $$render`${$$maybeRenderHead($$result)}
`; +}, undefined, undefined); +export default $$Component; +``` +--- diff --git a/internal/printer/printer_css_test.go b/internal/printer/printer_css_test.go index 8beeb82c4..25d8ff12d 100644 --- a/internal/printer/printer_css_test.go +++ b/internal/printer/printer_css_test.go @@ -13,7 +13,6 @@ import ( type testcase_css struct { name string source string - want string scopedStyleStrategy string } @@ -34,7 +33,6 @@ func TestPrinterCSS(t *testing.T) {

Page Title

I’m a page

`, - want: ".title:where(.astro-dpohflym){font-family:fantasy;font-size:28px}.body:where(.astro-dpohflym){font-size:1em}", }, { name: "scopedStyleStrategy: 'class'", @@ -52,7 +50,6 @@ func TestPrinterCSS(t *testing.T) {

Page Title

I’m a page

`, scopedStyleStrategy: "class", - want: ".title.astro-dpohflym{font-family:fantasy;font-size:28px}.body.astro-dpohflym{font-size:1em}", }, { name: "scopedStyleStrategy: 'attribute'", @@ -70,7 +67,6 @@ func TestPrinterCSS(t *testing.T) {

Page Title

I’m a page

`, scopedStyleStrategy: "attribute", - want: ".title[data-astro-cid-dpohflym]{font-family:fantasy;font-size:28px}.body[data-astro-cid-dpohflym]{font-size:1em}", }, } @@ -102,13 +98,6 @@ func TestPrinterCSS(t *testing.T) { output += string(bytes) } - toMatch := tt.want - - // compare to expected string, show diff if mismatch - if diff := test_utils.ANSIDiff(test_utils.Dedent(toMatch), test_utils.Dedent(output)); diff != "" { - t.Errorf("mismatch (-want +got):\n%s", diff) - } - test_utils.MakeSnapshot( &test_utils.SnapshotOptions{ Testing: t, diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index e0ac0432a..a32cd6d99 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -2,8 +2,6 @@ package printer import ( "fmt" - "regexp" - "strconv" "strings" "testing" @@ -81,7 +79,6 @@ type testcase struct { transitions bool transformOptions transform.TransformOptions filename string - want want } type jsonTestcase struct { @@ -100,107 +97,62 @@ func TestPrinter(t *testing.T) { { name: "text only", source: `Foo`, - want: want{ - code: `Foo`, - }, }, { name: "unusual line terminator I", source: `Pre-set & Time-limited \u2028holiday campaigns`, - want: want{ - code: `Pre-set & Time-limited \\u2028holiday campaigns`, - }, }, { name: "unusual line terminator II", source: `Pre-set & Time-limited 
holiday campaigns`, - want: want{ - code: `Pre-set & Time-limited 
holiday campaigns`, - }, }, { name: "basic (no frontmatter)", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "basic renderHead", source: `Ah`, - want: want{ - code: `Ah` + RENDER_HEAD_RESULT + ``, - }, }, { name: "head inside slot", source: ``, - want: want{ - code: `${$$renderSlot($$result,$$slots["default"],$$render` + BACKTICK + `` + RENDER_HEAD_RESULT + `` + BACKTICK + `)}`, - }, }, { name: "head slot", source: ``, - want: want{ - code: `${$$renderSlot($$result,$$slots["default"])}` + RENDER_HEAD_RESULT + ``, - }, }, { name: "head slot II", source: ``, - want: want{ - code: `${$$renderSlot($$result,$$slots["default"])}` + RENDER_HEAD_RESULT + ``, - }, }, { name: "head slot III", source: ``, - want: want{ - code: `${$$renderSlot($$result,$$slots["baseHeadExtension"],$$render` + BACKTICK + `` + BACKTICK + `)}` + RENDER_HEAD_RESULT + ``, - }, }, { name: "ternary component", source: `{special ?

Special

:

Not special

}`, - want: want{ - code: `${special ? $$render` + BACKTICK + `${$$renderComponent($$result,'ChildDiv',ChildDiv,{},{"default": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}

Special

` + BACKTICK + `,})}` + BACKTICK + ` : $$render` + BACKTICK + `

Not special

` + BACKTICK + `}`, - }, }, { name: "ternary layout", source: `{toggleError ?

SITE: {Astro.site}

: <>

SITE: {Astro.site}

}`, - want: want{ - code: `${toggleError ? $$render` + BACKTICK + `${$$renderComponent($$result,'BaseLayout',BaseLayout,{},{"default": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}

SITE: ${Astro.site}

` + BACKTICK + `,})}` + BACKTICK + ` : $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `

SITE: ${Astro.site}

` + BACKTICK + `,})}` + BACKTICK + `}`, - }, }, { name: "orphan slot", source: ``, - want: want{ - code: `${$$renderSlot($$result,$$slots["default"])}`, - }, }, { name: "conditional slot", source: `{value &&
foo
}
`, - want: want{ - code: "${$$renderComponent($$result,'Component',Component,{},{\"test\": () => $$render`${value && $$render`${$$maybeRenderHead($$result)}
foo
`}`,})}", - }, }, { name: "ternary slot", source: `{Math.random() > 0.5 ?
A
:
B
}
`, - want: want{ - code: "${$$renderComponent($$result,'Component',Component,{},$$mergeSlots({},Math.random() > 0.5 ? {\"a\": () => $$render`${$$maybeRenderHead($$result)}
A
`} : {\"b\": () => $$render`
B
`}))}", - }, }, { name: "function expression slots I", source: "\n{() => { switch (value) {\ncase 'a': return
A
\ncase 'b': return
B
\ncase 'c': return
C
\n}\n}}\n
", - want: want{ - code: "${$$renderComponent($$result,'Component',Component,{},$$mergeSlots({},() => { switch (value) {\ncase 'a': return {\"a\": () => $$render`${$$maybeRenderHead($$result)}
A
`}\ncase 'b': return {\"b\": () => $$render`
B
`}\ncase 'c': return {\"c\": () => $$render`
C
`}}\n}))}", - }, }, { name: "function expression slots II (#959)", @@ -218,62 +170,30 @@ func TestPrinter(t *testing.T) {
`, - want: want{ - code: `${$$renderComponent($$result,'Layout',Layout,{"title":"Welcome to Astro."},{"default": () => $$render` + BACKTICK + ` - ${$$maybeRenderHead($$result)}
- ${$$renderComponent($$result,'Layout',Layout,{"title":"switch bug"},{"default": () => $$render` + BACKTICK + `${components.map((component, i) => { - switch(component) { - case "Hero": - return $$render` + BACKTICK + `
Hero
` + BACKTICK + ` - case "Component2": - return $$render` + BACKTICK + `
Component2
` + BACKTICK + ` - } - })}` + BACKTICK + `,})} -
-` + BACKTICK + `,})}`, - }, }, { name: "expression slot", source: `{true &&
A
}{false &&
B
}
`, - want: want{ - code: "${$$renderComponent($$result,'Component',Component,{},{\"a\": () => $$render`${true && $$render`${$$maybeRenderHead($$result)}
A
`}`,\"b\": () => $$render`${false && $$render`
B
`}`,})}", - }, }, { name: "preserve is:inline slot", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "preserve is:inline slot II", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "slot with fallback", source: `

Hello world!

`, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderSlot($$result,$$slots["default"],$$render` + BACKTICK + `

Hello world!

` + BACKTICK + `)}`, - }, }, { name: "slot with fallback II", source: `

Hello world!

`, - want: want{ - code: `${$$renderSlot($$result,$$slots["test"],$$render` + BACKTICK + `${$$maybeRenderHead($$result)}

Hello world!

` + BACKTICK + `)}`, - }, }, { name: "slot with fallback III", source: `

Fallback

`, - want: want{ - code: `${$$maybeRenderHead($$result)}
${$$renderSlot($$result,$$slots["test"],$$render` + BACKTICK + `

Fallback

` + BACKTICK + `)}
`, - }, }, { name: "Preserve slot whitespace", @@ -281,39 +201,22 @@ func TestPrinter(t *testing.T) {

Paragraph 1

Paragraph 2

`, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + ` - ${$$maybeRenderHead($$result)}

Paragraph 1

-

Paragraph 2

` + BACKTICK + `,})}`, - }, }, { name: "text only", source: "Hello!", - want: want{ - code: "Hello!", - }, }, { name: "custom-element", source: "{show && }", - want: want{ - code: "${show && $$render`${$$renderComponent($$result,'client-only-element','client-only-element',{})}`}", - }, }, { name: "attribute with template literal", source: "Home", - want: want{ - code: "${$$maybeRenderHead($$result)}Home", - }, }, { name: "attribute with template literal interpolation", source: "Home", - want: want{ - code: "${$$maybeRenderHead($$result)}Home", - }, }, { name: "basic (frontmatter)", @@ -321,10 +224,6 @@ func TestPrinter(t *testing.T) { const href = '/about'; --- About`, - want: want{ - frontmatter: []string{"", "const href = '/about';"}, - code: `${$$maybeRenderHead($$result)}About`, - }, }, { name: "getStaticPaths (basic)", @@ -334,12 +233,6 @@ export const getStaticPaths = async () => { } ---
`, - want: want{ - getStaticPaths: `export const getStaticPaths = async () => { - return { paths: [] } -}`, - code: `${$$maybeRenderHead($$result)}
`, - }, }, { name: "getStaticPaths (hoisted)", @@ -350,13 +243,6 @@ export const getStaticPaths = async () => { } ---
`, - want: want{ - frontmatter: []string{"", `const a = 0;`}, - getStaticPaths: `export const getStaticPaths = async () => { - return { paths: [] } -}`, - code: `${$$maybeRenderHead($$result)}
`, - }, }, { name: "getStaticPaths (hoisted II)", @@ -368,15 +254,6 @@ export async function getStaticPaths() { const b = 0; ---
`, - want: want{ - frontmatter: []string{"", `const a = 0; - -const b = 0;`}, - getStaticPaths: `export async function getStaticPaths() { - return { paths: [] } -}`, - code: `${$$maybeRenderHead($$result)}
`, - }, }, { name: "export member does not panic", @@ -384,10 +261,6 @@ const b = 0;`}, mod.export(); ---
`, - want: want{ - frontmatter: []string{``, `mod.export();`}, - code: `${$$maybeRenderHead($$result)}
`, - }, }, { name: "export comments I", @@ -397,10 +270,6 @@ export const foo = 0 /* */ ---`, - want: want{ - frontmatter: []string{"", "// hmm\n/*\n*/"}, - getStaticPaths: "export const foo = 0", - }, }, { name: "export comments II", @@ -410,10 +279,6 @@ export const foo = 0; /* */ ---`, - want: want{ - frontmatter: []string{"", "// hmm\n/*\n*/"}, - getStaticPaths: "export const foo = 0;", - }, }, { name: "import assertions", @@ -421,12 +286,6 @@ export const foo = 0; import data from "test" assert { type: 'json' }; --- `, - want: want{ - frontmatter: []string{ - `import data from "test" assert { type: 'json' };`, - }, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {type:'json'} }`}}, - }, }, { name: "import to identifier named assert", @@ -434,19 +293,10 @@ import data from "test" assert { type: 'json' }; source: `--- import assert from 'test'; ---`, - want: want{ - frontmatter: []string{ - `import assert from 'test';`, - }, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - }, }, { name: "no expressions in math", source: `

Hello, world! This is a buggy formula: f ⁣:XR2xf\colon X \to \mathbb R^{2x}

`, - want: want{ - code: `${$$maybeRenderHead($$result)}

Hello, world! This is a buggy formula: f ⁣:XR2xf\\colon X \\to \\mathbb R^{2x}

`, - }, }, { name: "import order", @@ -458,14 +308,6 @@ import data from "test";
{data}
`, - want: want{ - frontmatter: []string{ - `import data from "test";`, - "let testWord = \"Test\"\n// comment", - }, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - code: "${$$maybeRenderHead($$result)}
${data}
", - }, }, { name: "type import", @@ -475,19 +317,10 @@ import type data from "test"
{data}
`, - want: want{ - frontmatter: []string{ - `import type data from "test"`, - }, - code: "${$$maybeRenderHead($$result)}
${data}
", - }, }, { name: "no expressions in math", source: `

Hello, world! This is a buggy formula: f ⁣:XR2xf\colon X \to \mathbb R^{2x}

`, - want: want{ - code: `${$$maybeRenderHead($$result)}

Hello, world! This is a buggy formula: f ⁣:XR2xf\\colon X \\to \\mathbb R^{2x}

`, - }, }, { @@ -496,32 +329,18 @@ import type data from "test" import './styles.css'; --- `, - want: want{ - frontmatter: []string{ - `import './styles.css';`, - }, - }, }, { name: "solidus in template literal expression", source: "
", - want: want{ - code: "${$$maybeRenderHead($$result)}
", - }, }, { name: "nested template literal expression", source: "
", - want: want{ - code: "${$$maybeRenderHead($$result)}
", - }, }, { name: "component in expression with its child expression before its child element", source: "{list.map(() => ({name}))}", - want: want{ - code: "${list.map(() => ($$render`${$$renderComponent($$result,'Component',Component,{},{\"default\": () => $$render`${name}`,})}`))}", - }, }, { name: "expression returning multiple elements", @@ -548,32 +367,6 @@ import type data from "test" }
`, - - want: want{ - code: `${$$renderComponent($$result,'Layout',Layout,{"title":"Welcome to Astro."},{"default": () => $$render` + BACKTICK + ` - ${$$maybeRenderHead($$result)}
-

Welcome to Astro

- ${ - Object.entries(DUMMY_DATA).map(([dummyKey, dummyValue]) => { - return ( - $$render` + BACKTICK + `

- onlyp ${dummyKey} -

-

- onlyh2 ${dummyKey} -

-
-

div+h2 ${dummyKey}

-
-

-

p+h2 ${dummyKey}

- ` + BACKTICK + ` - ); - }) - } -
-` + BACKTICK + `,})}`, - }, }, { name: "nested template literal expression", @@ -583,21 +376,10 @@ import type data from "test" {Object.keys(importedAuthors).map(author =>

{author}

)} `, - want: want{ - code: ` -${$$maybeRenderHead($$result)} -${Object.keys(importedAuthors).map(author => $$render` + BACKTICK + `

hello
` + BACKTICK + `)} -${Object.keys(importedAuthors).map(author => $$render` + BACKTICK + `

${author}
` + BACKTICK + `)} - -`, - }, }, { name: "complex nested template literal expression", source: "
", - want: want{ - code: "${$$maybeRenderHead($$result)}
", - }, }, { name: "component", @@ -612,20 +394,6 @@ import VueComponent from '../components/Vue.vue'; `, - want: want{ - frontmatter: []string{ - `import VueComponent from '../components/Vue.vue';`, - }, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: '../components/Vue.vue', assert: {} }`}}, - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'VueComponent',VueComponent,{})} - - `, - }, }, { name: "dot component", @@ -640,46 +408,22 @@ import * as ns from '../components'; `, - want: want{ - frontmatter: []string{`import * as ns from '../components';`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: '../components', assert: {} }`}}, - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'ns.Component',ns.Component,{})} - - `, - }, }, { name: "component with quoted attributes", source: ``, - want: want{ - code: `${` + RENDER_COMPONENT + `($$result,'Component',Component,{"is":"\"cool\""})}`, - }, }, { name: "slot with quoted attributes", source: `
`, - want: want{ - code: `${` + RENDER_COMPONENT + `($$result,'Component',Component,{},{"\"name\"": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}
` + BACKTICK + `,})}`, - }, }, { name: "#955 ternary slot with text", source: `Hello{isLeaf ?

Leaf

:

Branch

}world
`, - want: want{ - code: `${` + RENDER_COMPONENT + `($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `Hello${isLeaf ? $$render` + BACKTICK + `${$$maybeRenderHead($$result)}

Leaf

` + BACKTICK + ` : $$render` + BACKTICK + `

Branch

` + BACKTICK + `}world` + BACKTICK + `,})}`, - }, }, { name: "#955 ternary slot with elements", source: `
{isLeaf ?

Leaf

:

Branch

}
`, - want: want{ - code: `${` + RENDER_COMPONENT + `($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}
${isLeaf ? $$render` + BACKTICK + `

Leaf

` + BACKTICK + ` : $$render` + BACKTICK + `

Branch

` + BACKTICK + `}
` + BACKTICK + `,})}`, - }, }, { name: "noscript component", @@ -692,37 +436,18 @@ import * as ns from '../components'; `, - want: want{ - code: ` - ` + RENDER_HEAD_RESULT + ` - - - - `, - }, }, { name: "noscript styles", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "noscript deep styles", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "noscript only", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "client:only component (default)", @@ -737,21 +462,6 @@ import Component from '../components'; `, - want: want{ - frontmatter: []string{"import Component from '../components';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'Component',null,{"client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"default"})} - `, - }, }, { name: "client:only component (named)", @@ -766,21 +476,6 @@ import { Component } from '../components'; `, - want: want{ - frontmatter: []string{"import { Component } from '../components';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'Component',null,{"client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"Component"})} - `, - }, }, { name: "client:only component (namespace)", @@ -795,21 +490,6 @@ import * as components from '../components'; `, - want: want{ - frontmatter: []string{"import * as components from '../components';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'components.A',null,{"client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"A"})} - `, - }, }, { name: "client:only component (namespaced default)", @@ -824,21 +504,6 @@ import defaultImport from '../components/ui-1'; `, - want: want{ - frontmatter: []string{"import defaultImport from '../components/ui-1';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components/ui-1"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'defaultImport.Counter1',null,{"client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components/ui-1")),"client:component-export":"default.Counter1"})} - `, - }, }, { name: "client:only component (namespaced named)", @@ -853,21 +518,6 @@ import { namedImport } from '../components/ui-2'; `, - want: want{ - frontmatter: []string{"import { namedImport } from '../components/ui-2';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components/ui-2"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'namedImport.Counter2',null,{"client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components/ui-2")),"client:component-export":"namedImport.Counter2"})} - `, - }, }, { name: "client:only component (multiple)", @@ -884,58 +534,26 @@ import Component from '../components'; `, - want: want{ - frontmatter: []string{"import Component from '../components';"}, - metadata: metadata{ - hydrationDirectives: []string{"only"}, - clientOnlyComponents: []string{"../components"}, - }, - // Specifically do NOT render any metadata here, we need to skip this import - code: ` - - Hello world - ` + RENDER_HEAD_RESULT + ` - - ${` + RENDER_COMPONENT + `($$result,'Component',null,{"test":"a","client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"default"})} - ${` + RENDER_COMPONENT + `($$result,'Component',null,{"test":"b","client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"default"})} - ${` + RENDER_COMPONENT + `($$result,'Component',null,{"test":"c","client:only":true,"client:component-hydration":"only","client:component-path":($$metadata.resolvePath("../components")),"client:component-export":"default"})} - `, - }, }, { name: "iframe", source: `", - }, }, { name: "conditional render", source: `{false ?
#f
:
#t
}`, - want: want{ - code: "${$$maybeRenderHead($$result)}${false ? $$render`
#f
` : $$render`
#t
`}", - }, }, { name: "conditional noscript", source: `{mode === "production" && }`, - want: want{ - code: "${mode === \"production\" && $$render`${$$maybeRenderHead($$result)}`}", - }, }, { name: "conditional iframe", source: `{bool && }`, - want: want{ - code: "${bool && $$render`${$$maybeRenderHead($$result)}`}", - }, }, { name: "simple ternary", source: `{link ? {link} :
no link
}`, - want: want{ - code: fmt.Sprintf(`${$$maybeRenderHead($$result)}${link ? $$render%s${link}%s : $$render%s
no link
%s}`, BACKTICK, BACKTICK, BACKTICK, BACKTICK), - }, }, { name: "map basic", @@ -947,28 +565,14 @@ const items = [0, 1, 2]; return
  • {item}
  • ; })} `, - want: want{ - frontmatter: []string{"", "const items = [0, 1, 2];"}, - code: fmt.Sprintf(`${$$maybeRenderHead($$result)}
      - ${items.map(item => { - return $$render%s
    • ${item}
    • %s; - })} -
    `, BACKTICK, BACKTICK), - }, }, { name: "map without component", source: `
    `, - want: want{ - code: fmt.Sprintf(`${$$maybeRenderHead($$result)}
    `, BACKTICK, BACKTICK), - }, }, { name: "map with component", source: `
    `, - want: want{ - code: fmt.Sprintf(`${$$maybeRenderHead($$result)}
    ${$$renderComponent($$result,'Hello',Hello,{})}
    `, BACKTICK, BACKTICK), - }, }, { name: "map nested", @@ -984,95 +588,50 @@ const groups = [[0, 1, 2], [3, 4, 5]]; } })}
    `, - want: want{ - frontmatter: []string{"", "const groups = [[0, 1, 2], [3, 4, 5]];"}, - code: fmt.Sprintf(`${$$maybeRenderHead($$result)}
    - ${groups.map(items => { - return %s
      ${ - items.map(item => { - return %s
    • ${item}
    • %s; - }) - }
    %s - })} -
    `, "$$render"+BACKTICK, "$$render"+BACKTICK, BACKTICK, BACKTICK), - }, }, { name: "backtick in HTML comment", source: "", - want: want{ - code: "${$$maybeRenderHead($$result)}", - }, }, { name: "HTML comment in component inside expression I", source: "{(() => )}", - want: want{ - code: "${(() => $$render`${$$renderComponent($$result,'Component',Component,{},{})}`)}", - }, }, { name: "HTML comment in component inside expression II", source: "{list.map(() => )}", - want: want{ - code: "${list.map(() => $$render`${$$renderComponent($$result,'Component',Component,{},{})}`)}", - }, }, { name: "nested expressions", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${(previous || next) && $$render` + BACKTICK + `` + BACKTICK + `}
    `, - }, }, { name: "nested expressions II", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${(previous || next) && $$render` + BACKTICK + `` + BACKTICK + `}
    `, - }, }, { name: "nested expressions III", source: `
    {x.map((x) => x ?
    {true ? {x} : null}
    :
    {false ? null : {x}}
    )}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${x.map((x) => x ? $$render`
    ${true ? $$render`${x}` : null}
    ` : $$render`
    ${false ? null : $$render`${x}`}
    `)}
    ", - }, }, { name: "nested expressions IV", source: `
    {() => { if (value > 0.25) { return Default } else if (value > 0.5) { return Another } else if (value > 0.75) { return Other } return Yet Other }}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${() => { if (value > 0.25) { return $$render`Default` } else if (value > 0.5) { return $$render`Another` } else if (value > 0.75) { return $$render`Other` } return $$render`Yet Other` }}
    ", - }, }, { name: "nested expressions V", source: `

    title

    {list.map(group =>

    {group.label}

    {group.items.map(item => {item})}
    )}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}

    title

    ${list.map(group => $$render`${$$renderComponent($$result,'Fragment',Fragment,{},{\"default\": () => $$render`

    ${group.label}

    ${group.items.map(item => $$render`${item}`)}`,})}`)}
    ", - }, }, { name: "nested expressions VI", source: `
    {()=>{ if (true) { return
    ;} if (true) { return ;}}}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${()=>{ if (true) { return $$render`
    `;} if (true) { return $$render``;}}}
    ", - }, }, { name: "nested expressions VII", source: `
    {() => { if (value > 0.25) { return
    ;} else if (value > 0.5) { return
    ;} else if (value > 0.75) { return
    ;} return
    Yaaay
    ;}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${() => { if (value > 0.25) { return $$render`
    `;} else if (value > 0.5) { return $$render`
    `;} else if (value > 0.75) { return $$render`
    `;} return $$render`
    Yaaay
    `;}}
    ", - }, }, { name: "nested expressions VIII", source: `
    { items.map(({ type, ...data }) => { switch (type) { case 'card': { return ( ); } case 'paragraph': { return (

    {data.body}

    );}}})}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${ items.map(({ type, ...data }) => { switch (type) { case 'card': { return ( $$render`${$$renderComponent($$result,'Card',Card,{...(data)})}` ); } case 'paragraph': { return ( $$render`

    ${data.body}

    `);}}})}
    ", - }, }, { name: "expressions with JS comments", @@ -1088,18 +647,6 @@ const items = ['red', 'yellow', 'blue']; /* foo < > < } */
    color
    ))}
    `, - want: want{ - frontmatter: []string{"", "const items = ['red', 'yellow', 'blue'];"}, - code: `${$$maybeRenderHead($$result)}
    - ${items.map((item) => ( - // foo < > < } - $$render` + "`" + `color
    ` + "`" + ` - ))} - ${items.map((item) => ( - /* foo < > < } */ $$render` + "`" + `color` + "`" + ` - ))} -`, - }, }, { name: "expressions with multiple curly braces", @@ -1115,19 +662,6 @@ const items = ['red', 'yellow', 'blue']; } } `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    -${ - () => { - let generate = (input) => { - let a = () => { return; }; - let b = () => { return; }; - let c = () => { return; }; - }; - } -} -
    `, - }, }, { name: "slots (basic)", @@ -1138,11 +672,6 @@ import Component from "test";
    Default
    Named
    `, - want: want{ - frontmatter: []string{`import Component from "test";`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + "`" + ` ${$$maybeRenderHead($$result)}
    Default
    ` + "`" + `,"named": () => $$render` + "`" + `
    Named
    ` + "`" + `,})}`, - }, }, { name: "slots (no comments)", @@ -1154,11 +683,6 @@ import Component from 'test';
    Named
    `, - want: want{ - frontmatter: []string{`import Component from 'test';`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + "`" + ` ${$$maybeRenderHead($$result)}
    Default
    ` + "`" + `,"named": () => $$render` + "`" + `
    Named
    ` + "`" + `,})}`, - }, }, { name: "slots (expression)", @@ -1166,9 +690,6 @@ import Component from 'test'; {items.map(item =>
    {item}
    )}
    `, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{"data":(data)},{"default": () => $$render` + BACKTICK + `${items.map(item => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}
    ${item}
    ` + BACKTICK + `)}` + BACKTICK + `,})}`, - }, }, { name: "head expression", @@ -1183,17 +704,6 @@ const name = "world";
    `, - want: want{ - frontmatter: []string{``, `const name = "world";`}, - code: ` - - Hello ${name} - ` + RENDER_HEAD_RESULT + ` - -
    - - `, - }, }, { name: "head expression and conditional rendering of fragment", @@ -1210,18 +720,6 @@ const testBool = true;
    `, - want: want{ - frontmatter: []string{``, `const testBool = true;`}, - code: ` - - - ${testBool ? "Hey" : "Bye"} - ${testBool && ($$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `` + BACKTICK + `,})}` + BACKTICK + `)} - ` + RENDER_HEAD_RESULT + ` - -
    - `, - }, }, { name: "conditional rendering of title containing expression", @@ -1234,17 +732,6 @@ const testBool = true; ) }`, - want: want{ - code: `${ - props.title && ( - $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + ` - ${props.title} - - - ` + BACKTICK + `,})}` + BACKTICK + ` - ) -}`, - }, }, { name: "styles (no frontmatter)", @@ -1261,10 +748,6 @@ const testBool = true;

    Page Title

    I’m a page

    `, - want: want{ - code: "\n\n\t\t" + `${$$maybeRenderHead($$result)}

    Page Title

    -

    I’m a page

    `, - }, }, { name: "html5 boilerplate", @@ -1298,36 +781,6 @@ const testBool = true; `, - want: want{ - code: ` - - - - - A Basic HTML5 Template - - - - - - - - - - - - - - - -` + RENDER_HEAD_RESULT + ` - - - - - -`, - }, }, { name: "React framework example", @@ -1376,36 +829,6 @@ const someProps = { `, - want: want{ - frontmatter: []string{`import Counter from '../components/Counter.jsx'`, - `// Component Imports -const someProps = { - count: 0, -} - -// Full Astro Component Syntax: -// https://docs.astro.build/core-concepts/astro-components/`}, - metadata: metadata{ - modules: []string{`{ module: $$module1, specifier: '../components/Counter.jsx', assert: {} }`}, - hydratedComponents: []string{`Counter`}, - hydrationDirectives: []string{"visible"}, - }, - code: ` - - - - - - ` + RENDER_HEAD_RESULT + ` - -
    - ${$$renderComponent($$result,'Counter',Counter,{...(someProps),"client:visible":true,"client:component-hydration":"visible","client:component-path":("../components/Counter.jsx"),"client:component-export":("default"),"class":"astro-hmnnhvcq"},{"default": () => $$render` + "`" + ` -

    Hello React!

    - ` + "`" + `,})} -
    - - `, - }, }, { name: "script in ", @@ -1417,30 +840,12 @@ import Widget2 from '../components/Widget2.astro'; `, - want: want{ - frontmatter: []string{`import Widget from '../components/Widget.astro'; -import Widget2 from '../components/Widget2.astro';`}, - metadata: metadata{ - modules: []string{ - `{ module: $$module1, specifier: '../components/Widget.astro', assert: {} }`, - `{ module: $$module2, specifier: '../components/Widget2.astro', assert: {} }`}, - }, - code: ` - - - ` + RENDER_HEAD_RESULT + ``, - }, }, { name: "script hoist with frontmatter", source: `--- --- `, - want: want{ - frontmatter: []string{""}, - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("Hello");%s }`, BACKTICK, BACKTICK)}}, - code: ``, - }, }, { name: "script hoist without frontmatter", @@ -1448,40 +853,22 @@ import Widget2 from '../components/Widget2.astro';`},
    `, - want: want{ - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("Hello");%s }`, BACKTICK, BACKTICK)}}, - code: "${$$maybeRenderHead($$result)}
    \n" + - "
    ", - }, }, { - name: "script inline", + name: "scriptinline", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "script define:vars I", source: ``, - want: want{ - code: ``, - }, }, { name: "script define:vars II", source: ``, - want: want{ - code: ``, - }, }, { name: "script before elements", source: `
    `, - want: want{ - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sHere%s }`, BACKTICK, BACKTICK)}}, - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "script (renderScript: true)", @@ -1490,10 +877,6 @@ import Widget2 from '../components/Widget2.astro';`}, RenderScript: true, }, filename: "/src/pages/index.astro", - want: want{ - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("Hello");%s }`, BACKTICK, BACKTICK)}}, - code: `${$$maybeRenderHead($$result)}
    ${$$renderScript($$result,"/src/pages/index.astro?astro&type=script&index=0&lang.ts")}
    `, - }, }, { name: "script multiple (renderScript: true)", @@ -1502,15 +885,6 @@ import Widget2 from '../components/Widget2.astro';`}, RenderScript: true, }, filename: "/src/pages/index.astro", - want: want{ - metadata: metadata{ - hoisted: []string{ - fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("World");%s }`, BACKTICK, BACKTICK), - fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("Hello");%s }`, BACKTICK, BACKTICK), - }, - }, - code: `${$$maybeRenderHead($$result)}
    ${$$renderScript($$result,"/src/pages/index.astro?astro&type=script&index=0&lang.ts")}${$$renderScript($$result,"/src/pages/index.astro?astro&type=script&index=1&lang.ts")}
    `, - }, }, { name: "script external (renderScript: true)", @@ -1519,10 +893,6 @@ import Widget2 from '../components/Widget2.astro';`}, RenderScript: true, }, filename: "/src/pages/index.astro", - want: want{ - metadata: metadata{hoisted: []string{`{ type: 'external', src: './hello.js' }`}}, - code: `${$$maybeRenderHead($$result)}
    ${$$renderScript($$result,"/src/pages/index.astro?astro&type=script&index=0&lang.ts")}
    `, - }, }, { name: "script inline (renderScript: true)", @@ -1530,9 +900,6 @@ import Widget2 from '../components/Widget2.astro';`}, transformOptions: transform.TransformOptions{ RenderScript: true, }, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "script mixed handled and inline (renderScript: true)", @@ -1541,24 +908,14 @@ import Widget2 from '../components/Widget2.astro';`}, RenderScript: true, }, filename: "/src/pages/index.astro", - want: want{ - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sconsole.log("Hello");%s }`, BACKTICK, BACKTICK)}}, - code: `${$$maybeRenderHead($$result)}
    ${$$renderScript($$result,"/src/pages/index.astro?astro&type=script&index=0&lang.ts")}
    `, - }, }, { name: "text after title expression", source: `a {expr} b`, - want: want{ - code: `a ${expr} b`, - }, }, { name: "text after title expressions", source: `a {expr} b {expr} c`, - want: want{ - code: `a ${expr} b ${expr} c`, - }, }, { name: "slots (dynamic name)", @@ -1569,11 +926,6 @@ const name = 'named';
    Named
    `, - want: want{ - frontmatter: []string{`import Component from 'test';`, `const name = 'named';`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - code: `${$$renderComponent($$result,'Component',Component,{},{[name]: () => $$render` + "`" + `${$$maybeRenderHead($$result)}
    Named
    ` + "`" + `,})}`, - }, }, { name: "slots (named only)", @@ -1582,23 +934,14 @@ const name = 'named'; B C `, - want: want{ - code: `${$$renderComponent($$result,'Slotted',Slotted,{},{"a": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}A` + BACKTICK + `,"b": () => $$render` + BACKTICK + `B` + BACKTICK + `,"c": () => $$render` + BACKTICK + `C` + BACKTICK + `,})}`, - }, }, { name: "condition expressions at the top-level", source: `{cond && }{cond && }`, - want: want{ - code: "${cond && $$render`${$$maybeRenderHead($$result)}`}${cond && $$render``}", - }, }, { name: "condition expressions at the top-level with head content", source: `{cond && }{cond && My title}`, - want: want{ - code: "${cond && $$render``}${cond && $$render`My title`}", - }, }, { name: "custom elements", @@ -1606,11 +949,6 @@ const name = 'named'; import 'test'; --- `, - want: want{ - frontmatter: []string{`import 'test';`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'test', assert: {} }`}}, - code: `${$$renderComponent($$result,'my-element','my-element',{})}`, - }, }, { name: "gets all potential hydrated components", @@ -1624,73 +962,34 @@ const name = 'world'; `, - want: want{ - frontmatter: []string{`import One from 'one'; -import Two from 'two'; -import 'custom-element';`, - `const name = 'world';`}, - metadata: metadata{ - modules: []string{ - `{ module: $$module1, specifier: 'one', assert: {} }`, - `{ module: $$module2, specifier: 'two', assert: {} }`, - `{ module: $$module3, specifier: 'custom-element', assert: {} }`, - }, - hydratedComponents: []string{"'my-element'", "Two", "One"}, - hydrationDirectives: []string{"load"}, - }, - code: `${$$renderComponent($$result,'One',One,{"client:load":true,"client:component-hydration":"load","client:component-path":("one"),"client:component-export":("default")})} -${$$renderComponent($$result,'Two',Two,{"client:load":true,"client:component-hydration":"load","client:component-path":("two"),"client:component-export":("default")})} -${$$renderComponent($$result,'my-element','my-element',{"client:load":true,"client:component-hydration":"load"})}`, - }, }, { name: "Component siblings are siblings", source: ``, - want: want{ - code: `${$$renderComponent($$result,'BaseHead',BaseHead,{})}`, - }, }, { name: "Self-closing components siblings are siblings", source: ``, - want: want{ - code: `${$$renderComponent($$result,'BaseHead',BaseHead,{})}`, - }, }, { name: "Self-closing script in head works", source: `` + RENDER_HEAD_RESULT + ``, - }, }, { name: "Self-closing title", source: ``, - want: want{ - code: `<title>`, - }, }, { name: "Self-closing title II", source: `</head><body></body></html>`, - want: want{ - code: `<html><head><title>` + RENDER_HEAD_RESULT + ``, - }, }, { name: "Self-closing components in head can have siblings", source: ``, - want: want{ - code: `${$$renderComponent($$result,'BaseHead',BaseHead,{})}` + RENDER_HEAD_RESULT + ``, - }, }, { name: "Self-closing formatting elements", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "Self-closing formatting elements 2", @@ -1699,13 +998,6 @@ ${$$renderComponent($$result,'my-element','my-element',{"client:load":true,"clie
    `, - want: want{ - code: `${$$maybeRenderHead($$result)} -
    -
    -
    -`, - }, }, { name: "Nested HTML in expressions, wrapped in parens", @@ -1714,11 +1006,6 @@ const image = './penguin.png'; const canonicalURL = new URL('http://example.com'); --- {image && ()}`, - want: want{ - frontmatter: []string{"", `const image = './penguin.png'; -const canonicalURL = new URL('http://example.com');`}, - code: "${image && ($$render``)}", - }, }, { name: "Use of interfaces within frontmatter", @@ -1731,15 +1018,6 @@ interface MarkdownFrontmatter { let allPosts = Astro.fetchContent('./post/*.md'); ---
    testing
    `, - want: want{ - frontmatter: []string{"", `interface MarkdownFrontmatter { - date: number; - image: string; - author: string; -} -let allPosts = Astro.fetchContent('./post/*.md');`}, - code: "${$$maybeRenderHead($$result)}
    testing
    ", - }, }, { name: "dynamic import", @@ -1748,11 +1026,7 @@ const markdownDocs = await Astro.glob('../markdown/*.md') const article2 = await import('../markdown/article2.md') ---
    -`, want: want{ - frontmatter: []string{"", `const markdownDocs = await Astro.glob('../markdown/*.md') -const article2 = await import('../markdown/article2.md')`}, - code: "${$$maybeRenderHead($$result)}
    ", - }, +`, }, { name: "Component names A-Z", @@ -1765,21 +1039,6 @@ import ZComponent from '../components/ZComponent.jsx'; `, - want: want{ - frontmatter: []string{ - `import AComponent from '../components/AComponent.jsx'; -import ZComponent from '../components/ZComponent.jsx';`}, - metadata: metadata{ - modules: []string{ - `{ module: $$module1, specifier: '../components/AComponent.jsx', assert: {} }`, - `{ module: $$module2, specifier: '../components/ZComponent.jsx', assert: {} }`, - }, - }, - code: `${$$maybeRenderHead($$result)} - ${` + RENDER_COMPONENT + `($$result,'AComponent',AComponent,{})} - ${` + RENDER_COMPONENT + `($$result,'ZComponent',ZComponent,{})} -`, - }, }, { name: "Parser can handle files > 4096 chars", @@ -1791,16 +1050,10 @@ import ZComponent from '../components/ZComponent.jsx';`}, srcSet="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 800w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 1200w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1600&q=75 1600w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=2400&q=75 2400w" sizes="(max-width: 800px) 800px, (max-width: 1200px) 1200px, (max-width: 1600px) 1600px, (max-width: 2400px) 2400px, 1200px" >`, - want: want{ - code: `${$$maybeRenderHead($$result)}` + longRandomString + ``, - }, }, { name: "SVG styles", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "svg expressions", @@ -1808,10 +1061,6 @@ import ZComponent from '../components/ZComponent.jsx';`}, const title = 'icon'; --- {title ?? null}`, - want: want{ - frontmatter: []string{"", "const title = 'icon';"}, - code: `${$$maybeRenderHead($$result)}${title ?? null}`, - }, }, { name: "advanced svg expression", @@ -1819,25 +1068,14 @@ const title = 'icon'; const title = 'icon'; --- {title ? {title} : null}`, - want: want{ - frontmatter: []string{"", "const title = 'icon';"}, - code: `${$$maybeRenderHead($$result)}${title ? $$render` + BACKTICK + `${title}` + BACKTICK + ` : null}`, - }, }, { name: "Empty script", source: ``, - want: want{ - code: ``, - }, }, { name: "Empty style", source: ``, - want: want{ - definedVars: []string{`{ color: "Gainsboro" }`}, - code: ``, - }, }, { name: "No extra script tag", @@ -1882,48 +1120,6 @@ const title = 'icon'; gtag('js', new Date()); gtag('config', 'G-TEL60V1WM9'); -->`, - want: want{ - code: ` - - - - - - - - - - - - - - - - - - - - - - - - -`, - }, }, { name: "All components", @@ -1939,11 +1135,6 @@ import { Container, Col, Row } from 'react-bootstrap'; `, - want: want{ - frontmatter: []string{`import { Container, Col, Row } from 'react-bootstrap';`}, - metadata: metadata{modules: []string{`{ module: $$module1, specifier: 'react-bootstrap', assert: {} }`}}, - code: "${$$renderComponent($$result,'Container',Container,{},{\"default\": () => $$render`\n ${$$renderComponent($$result,'Row',Row,{},{\"default\": () => $$render`\n ${$$renderComponent($$result,'Col',Col,{},{\"default\": () => $$render`\n ${$$maybeRenderHead($$result)}

    Hi!

    \n `,})}\n `,})}`,})}", - }, }, { name: "Mixed style siblings", @@ -1953,142 +1144,82 @@ import { Container, Col, Row } from 'react-bootstrap';
    `, - want: want{ - code: "\n\n\n\n\n\n\n" + RENDER_HEAD_RESULT + "\n
    ", - }, }, { name: "spread with double quotation marks", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class with spread", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class:list with spread", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class list", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class and class list simple array", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class and class list object", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "class and class list set", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "spread without style or class", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "spread with style but no explicit class", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "Fragment", source: `
    Default
    Named
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `
    Default
    Named
    ` + BACKTICK + `,})}`, - }, }, { name: "Fragment shorthand", source: `<>
    Default
    Named
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `
    Default
    Named
    ` + BACKTICK + `,})}`, - }, }, { name: "Fragment shorthand only", source: `<>Hello`, - want: want{ - code: `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `Hello` + BACKTICK + `,})}`, - }, }, { name: "Fragment literal only", source: `world`, - want: want{ - code: `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `world` + BACKTICK + `,})}`, - }, }, { name: "Fragment slotted", source: `<>
    Default
    Named
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `
    Default
    Named
    ` + BACKTICK + `,})}` + BACKTICK + `,})}`, - }, }, { name: "Fragment slotted with name", source: `
    Default
    Named
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderComponent($$result,'Component',Component,{},{"named": () => $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{"slot":"named"},{"default": () => $$render` + BACKTICK + `
    Default
    Named
    ` + BACKTICK + `,})}` + BACKTICK + `,})}`, - }, }, { name: "Preserve slots inside custom-element", source: `
    Name
    Default
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${$$renderComponent($$result,'my-element','my-element',{},{"default": () => $$render` + BACKTICK + `
    Name
    Default
    ` + BACKTICK + `,})}`, - }, }, { name: "Preserve namespaces", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "Preserve namespaces in expressions", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "Preserve namespaces for components", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{"some:thing":"foobar"})}`, - }, }, { name: "import.meta.env", @@ -2135,55 +1266,6 @@ const { product } = Astro.props;
    `, BACKTICK, BACKTICK), - want: want{ - code: ` - - - - Shoperoni | Buy ${product.node.title} - - - -` + RENDER_HEAD_RESULT + ` - - ${$$renderComponent($$result,'Header',Header,{})} -
    -
    - ${$$renderComponent($$result,'ProductPageContent',ProductPageContent,{"client:visible":true,"product":(product.node),"client:component-hydration":"visible","client:component-path":("../../components/ProductPageContent.jsx"),"client:component-export":("default")})} -
    -
    - ${$$renderComponent($$result,'Footer',Footer,{})} - -`, - frontmatter: []string{ - `import Header from '../../components/Header.jsx' -import Footer from '../../components/Footer.astro' -import ProductPageContent from '../../components/ProductPageContent.jsx';`, - "const { product } = Astro.props;", - }, - getStaticPaths: fmt.Sprintf(`export async function getStaticPaths() { - let products = await fetch(%s${import.meta.env.PUBLIC_NETLIFY_URL}/.netlify/functions/get-product-list%s) - .then(res => res.json()).then((response) => { - console.log('--- built product pages ---') - return response.products.edges - }); - - return products.map((p, i) => { - return { - params: {pid: p.node.handle}, - props: {product: p}, - }; - }); -}`, BACKTICK, BACKTICK), - metadata: metadata{ - modules: []string{`{ module: $$module1, specifier: '../../components/Header.jsx', assert: {} }`, - `{ module: $$module2, specifier: '../../components/Footer.astro', assert: {} }`, - `{ module: $$module3, specifier: '../../components/ProductPageContent.jsx', assert: {} }`, - }, - hydratedComponents: []string{`ProductPageContent`}, - hydrationDirectives: []string{"visible"}, - }, - }, }, { name: "import.meta", @@ -2192,18 +1274,10 @@ const components = import.meta.glob("../components/*.astro", { import: 'default' }); ---`, - want: want{ - frontmatter: []string{"", `const components = import.meta.glob("../components/*.astro", { - import: 'default' -});`}, - }, }, { name: "doctype", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "select option expression", @@ -2211,10 +1285,6 @@ const components = import.meta.glob("../components/*.astro", { const value = 'test'; --- `, - want: want{ - frontmatter: []string{"", "const value = 'test';"}, - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "select nested option", @@ -2222,17 +1292,10 @@ const value = 'test'; const value = 'test'; --- `, - want: want{ - frontmatter: []string{"", "const value = 'test';"}, - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "select map expression", source: `
    Hello world!
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    Hello world!
    `, - }, }, { name: "textarea", @@ -2240,17 +1303,10 @@ const value = 'test'; const value = 'test'; --- `, - want: want{ - frontmatter: []string{"", "const value = 'test';"}, - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "textarea inside expression", source: `{bool && } {!bool && }`, - want: want{ - code: `${bool && $$render` + BACKTICK + `${$$maybeRenderHead($$result)}` + BACKTICK + `} ${!bool && $$render` + BACKTICK + `` + BACKTICK + `}`, - }, }, { name: "table simple case", @@ -2275,25 +1331,6 @@ const content = "lol"; `, - want: want{ - frontmatter: []string{"", `const content = "lol";`}, - code: ` - ${$$maybeRenderHead($$result)} - - - - - ${ - ( - $$render` + BACKTICK + ` - - ` + BACKTICK + ` - ) - } -
    ${content}
    1
    Hello - -`, - }, }, { name: "complex table", @@ -2341,52 +1378,6 @@ const content = "lol";
    `, - want: want{ - code: ` - - - - Astro Multi Table - ${$$renderHead($$result)} - -
    -
    - ${Array(3).fill(false).map((item, idx) => $$render` + BACKTICK + `
    -
    - ${'a'} - - - - ${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `${Array(7).fill(false).map((entry, index) => $$render` + BACKTICK + `` + BACKTICK + `)}` + BACKTICK + `,})} - - - - - -
    A
    -
    -
    ` + BACKTICK + `)} -
    -
    -
    - - - - - - - - - - - -
    BBB
    -
    -
    -
    - -`, - }, }, { name: "table with expression in 'th'", @@ -2436,51 +1427,6 @@ console.log(tables); } `, - want: want{ - frontmatter: []string{``, `const { title, footnotes, tables } = Astro.props; - -interface Table { - title: string; - data: any[]; - showTitle: boolean; - footnotes: string; -} -console.log(tables);`}, - code: `${$$maybeRenderHead($$result)}
    -
    -

    - ${title} -

    - ${ - tables.map((table: Table) => ( - $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + ` -
    -

    ${table.title}

    - - - ${Object.keys(table.data[0]).map((thead) => ( - $$render` + BACKTICK + `` + BACKTICK + ` - ))} - - - ${table.data.map((trow) => ( - $$render` + BACKTICK + ` - ${Object.values(trow).map((cell, index) => ( - $$render` + BACKTICK + `` + BACKTICK + ` - ))} - ` + BACKTICK + ` - ))} - -
    ${thead}
    - ${cell} -
    -
    - ` + BACKTICK + `,})}` + BACKTICK + ` - )) - } -
    -
    `, - }, }, { name: "table expressions (no implicit tbody)", @@ -2488,24 +1434,14 @@ console.log(tables);`}, const items = ["Dog", "Cat", "Platipus"]; --- {items.map(item => ())}
    {item}
    `, - want: want{ - frontmatter: []string{"", `const items = ["Dog", "Cat", "Platipus"];`}, - code: `${$$maybeRenderHead($$result)}${items.map(item => ($$render` + BACKTICK + `` + BACKTICK + `))}
    ${item}
    `, - }, }, { name: "table caption expression", source: `
    {title}
    Hello
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${title}
    Hello
    `, - }, }, { name: "table expression with trailing div", source: `
    {title}
    Div
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${title}
    Div
    `, - }, }, { name: "tbody expressions", @@ -2513,10 +1449,6 @@ const items = ["Dog", "Cat", "Platipus"]; const items = ["Dog", "Cat", "Platipus"]; --- {items.map(item => ())}
    Name
    {item}
    `, - want: want{ - frontmatter: []string{"", `const items = ["Dog", "Cat", "Platipus"];`}, - code: `${$$maybeRenderHead($$result)}${items.map(item => ($$render` + BACKTICK + `` + BACKTICK + `))}
    Name
    ${item}
    `, - }, }, { name: "tbody expressions 2", @@ -2524,136 +1456,78 @@ const items = ["Dog", "Cat", "Platipus"]; const items = ["Dog", "Cat", "Platipus"]; --- {items.map(item => ())}
    Name
    {item}{item + 's'}
    `, - want: want{ - frontmatter: []string{"", `const items = ["Dog", "Cat", "Platipus"];`}, - code: `${$$maybeRenderHead($$result)}${items.map(item => ($$render` + BACKTICK + `` + BACKTICK + `))}
    Name
    ${item}${item + 's'}
    `, - }, }, { name: "tbody expressions 3", source: `{rows.map(row => ())}
    {row}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}${rows.map(row => ($$render` + BACKTICK + `` + BACKTICK + `))}
    ${row}
    `, - }, }, { name: "td expressions", source: `

    Row 1

    {title}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}

    Row 1

    ${title}
    `, - }, }, { name: "td expressions II", source: `{data.map(row => {row.map(cell => )})}
    {cell}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}${data.map(row => $$render`${row.map(cell => $$render``)}`)}
    ${cell}
    ", - }, }, { name: "self-closing td", source: `{data.map(row => {row.map(cell => )}
    )}
    `, - want: want{ - code: "${$$maybeRenderHead($$result)}${data.map(row => $$render`${row.map(cell => $$render``)}`)}
    ${$$unescapeHTML(cell)}
    ", - }, }, { name: "th expressions", source: `
    {title}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${title}
    `, - }, }, { name: "tr only", source: `col 1col 2{foo}`, - want: want{ - code: `${$$maybeRenderHead($$result)}col 1col 2${foo}`, - }, }, { name: "caption only", source: `Hello world!`, - want: want{ - code: `${$$maybeRenderHead($$result)}Hello world!`, - }, }, { name: "anchor expressions", source: `{expr}`, - want: want{ - code: `${$$maybeRenderHead($$result)}${expr}`, - }, }, { name: "anchor inside expression", source: `{true && expr}`, - want: want{ - code: `${true && $$render` + BACKTICK + `${$$maybeRenderHead($$result)}expr` + BACKTICK + `}`, - }, }, { name: "anchor content", source: `

    • {expr}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}

    • ${expr}
    `, - }, }, { name: "small expression", source: `
    {a}{data.map(a => )}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${a}${data.map(a => $$render` + BACKTICK + `${$$renderComponent($$result,'Component',Component,{"value":(a)})}` + BACKTICK + `)}
    `, - }, }, { name: "division inside expression", source: `
    {16 / 4}
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${16 / 4}
    `, - }, }, { name: "escaped entity", source: `A person saying "hello"`, - want: want{ - code: `${$$maybeRenderHead($$result)}A person saying "hello"`, - }, }, { name: "textarea in form", source: `
    `, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}
    ` + BACKTICK + `,})}`, - }, }, { name: "select in form", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "Expression in form followed by other sibling forms", source: "

    No expression here. So the next form will render.

    {data.formLabelA}

    {data.formLabelB}

    No expression here, but the last form before me had an expression, so my form didn't render.

    {data.formLabelC}

    Here is some in-between content

    {data.formLabelD}

    ", - want: want{ - code: "${$$maybeRenderHead($$result)}

    No expression here. So the next form will render.

    ${data.formLabelA}

    ${data.formLabelB}

    No expression here, but the last form before me had an expression, so my form didn't render.

    ${data.formLabelC}

    Here is some in-between content

    ${data.formLabelD}

    ", - }, }, { name: "slot inside of Base", source: `
    Hello
    `, - want: want{ - code: `${$$renderComponent($$result,'Base',Base,{"title":"Home"},{"default": () => $$render` + BACKTICK + `${$$maybeRenderHead($$result)}
    Hello
    ` + BACKTICK + `,})}`, - }, }, { name: "user-defined `implicit` is printed", source: ``, - want: want{ - code: ``, - }, }, { name: "css comment doesn’t produce semicolon", @@ -2661,10 +1535,6 @@ const items = ["Dog", "Cat", "Platipus"]; padding: 2rem; }
    My Text
    `, - - want: want{ - code: `${$$maybeRenderHead($$result)}
    My Text
    `, - }, }, { name: "sibling expressions", @@ -2675,99 +1545,54 @@ const items = ["Dog", "Cat", "Platipus"]; {true ? (Row 3) : null} `, - want: want{ - code: fmt.Sprintf(`${$$maybeRenderHead($$result)} - - ${true ? ($$render%s%s) : null} - ${true ? ($$render%s%s) : null} - ${true ? ($$render%s%s) : null} -
    Row 1
    Row 2
    Row 3
    -`, BACKTICK, BACKTICK, BACKTICK, BACKTICK, BACKTICK, BACKTICK), - }, }, { name: "table", source: "{[0,1,2].map(x => ())}
    {x}
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${[0,1,2].map(x => ($$render``))}
    ${x}
    ", - }, }, { name: "table II", source: "{['Hey','Ho'].map((item)=> )}
    {item}
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${['Hey','Ho'].map((item)=> $$render``)}
    ${item}
    ", - }, }, { name: "table III", source: "
    Cell
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${$$renderComponent($$result,'Cell',Cell,{})}${$$renderComponent($$result,'Cell',Cell,{})}${$$renderComponent($$result,'Cell',Cell,{})}
    Cell
    ", - }, }, { name: "table IV", source: "
    hello world
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}
    hello world
    ", - }, }, { name: "table slot I", source: "
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${$$renderSlot($$result,$$slots[\"default\"])}
    ", - }, }, { name: "table slot II", source: "
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${$$renderSlot($$result,$$slots[\"default\"])}
    ", - }, }, { name: "table slot III", source: "
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}
    ${$$renderSlot($$result,$$slots[\"default\"])}
    ", - }, }, { name: "table slot IV", source: "
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${$$renderSlot($$result,$$slots[\"default\"])}
    ", - }, }, { name: "table slot V", source: "
    ", - want: want{ - code: "${$$maybeRenderHead($$result)}${$$renderSlot($$result,$$slots[\"default\"])}
    ", - }, }, { name: "XElement", source: `{onLoadString ? : null }`, - want: want{ - code: fmt.Sprintf(`${$$renderComponent($$result,'XElement',XElement,{...(attrs)})}${onLoadString ? $$render%s%s : null }`, BACKTICK, BACKTICK), - }, }, { name: "Empty expression", source: "({})", - want: want{ - code: `${$$maybeRenderHead($$result)}(${(void 0)})`, - }, }, { name: "Empty expression with whitespace", source: "({ })", - want: want{ - code: `${$$maybeRenderHead($$result)}(${(void 0) })`, - }, }, { name: "expression with leading whitespace", @@ -2779,508 +1604,288 @@ const items = ["Dog", "Cat", "Platipus"]; } `, - want: want{ - code: "${$$maybeRenderHead($$result)}
    \n
      \n\t${\n\n\t\t$$render`
    • Build: ${ new Date().toISOString() }
    • \n\t\t
    • NODE_VERSION: ${ process.env.NODE_VERSION }
    • `\n\t}\n
    \n
    ", - }, }, { name: "Empty attribute expression", source: "", - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "is:raw", source: "
    <% awesome %>
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    <% awesome %>
    `, - }, }, { name: "Component is:raw", source: "{<% awesome %>}", - want: want{ - code: "${$$renderComponent($$result,'Component',Component,{},{\"default\": () => $$render`{<% awesome %>}`,})}", - }, }, { name: "set:html", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html with quoted attribute", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html with template literal attribute without variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html with template literal attribute with variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { name: "set:text", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${content}
    `, - }, }, { name: "set:text with quoted attribute", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    content
    `, - }, }, { name: "set:text with template literal attribute without variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:text with template literal attribute with variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }}, + }, { name: "set:html on Component", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + "`${$$unescapeHTML(content)}`," + `})}`, - }, }, { name: "set:html on Component with quoted attribute", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${"content"}` + BACKTICK + `,})}`, - }, }, { name: "set:html on Component with template literal attribute without variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `content` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:html on Component with template literal attribute with variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `${content}` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:text on Component", source: "", - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + "`${content}`," + `})}`, - }, }, { name: "set:text on Component with quoted attribute", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `content` + BACKTICK + `,})}`, - }, }, { name: "set:text on Component with template literal attribute without variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `content` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:text on Component with template literal attribute with variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `${content}` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:html on custom-element", source: "", - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + "`${$$unescapeHTML(content)}`," + `})}`, - }, }, { name: "set:html on custom-element with quoted attribute", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `${"content"}` + BACKTICK + `,})}`, - }, }, { name: "set:html on custom-element with template literal attribute without variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `content` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:html on custom-element with template literal attribute with variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `${content}` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:text on custom-element", source: "", - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + "`${content}`," + `})}`, - }, }, { name: "set:text on custom-element with quoted attribute", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `content` + BACKTICK + `,})}`, - }, }, { name: "set:text on custom-element with template literal attribute without variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `content` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:text on custom-element with template literal attribute with variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'custom-element','custom-element',{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `${content}` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "set:html on self-closing tag", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html on self-closing tag with quoted attribute", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html on self-closing tag with template literal attribute without variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html on self-closing tag with template literal attribute with variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { name: "set:html with other attributes", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html with quoted attribute and other attributes", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html with template literal attribute without variable and other attributes", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html with template literal attribute with variable and other attributes", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { name: "set:html on empty tag", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html on empty tag with quoted attribute", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html on empty tag with template literal attribute without variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html on empty tag with template literal attribute with variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { // If both "set:*" directives are passed, we only respect the first one name: "set:html and set:text", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, // { name: "set:html on tag with children", source: "
    !!!
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html on tag with children and quoted attribute", source: `
    !!!
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html on tag with children and template literal attribute without variable", source: `
    !!!
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html on tag with children and template literal attribute with variable", source: `
    !!!
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { name: "set:html on tag with empty whitespace", source: "
    ", - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${$$unescapeHTML(content)}
    `, - }, }, { name: "set:html on tag with empty whitespace and quoted attribute", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${"content"}
    `, - }, }, { name: "set:html on tag with empty whitespace and template literal attribute without variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `content` + BACKTICK + `}
    `, - }, }, { name: "set:html on tag with empty whitespace and template literal attribute with variable", source: `
    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    ${` + BACKTICK + `${content}` + BACKTICK + `}
    `, - }, }, { name: "set:html on script", source: "`, - }, }, { name: "set:html on script with quoted attribute", source: ``, - }, }, { name: "set:html on script with template literal attribute without variable", source: ``, - }, }, { name: "set:html on script with template literal attribute with variable", source: ``, - }, }, { name: "set:html on style", source: "`, - }, }, { name: "set:html on style with quoted attribute", source: ``, - }, }, { name: "set:html on style with template literal attribute without variable", source: ``, - }, }, { name: "set:html on style with template literal attribute with variable", source: ``, - }, }, { name: "set:html on Fragment", source: "<i>This should NOT be italic</i>

    \"} />", - want: want{ - code: "${$$renderComponent($$result,'Fragment',Fragment,{},{\"default\": () => $$render`${$$unescapeHTML(\"

    <i>This should NOT be italic</i>

    \")}`,})}", - }, }, { name: "set:html on Fragment with quoted attribute", source: "<i>This should NOT be italic</i>

    \" />", - want: want{ - code: "${$$renderComponent($$result,'Fragment',Fragment,{},{\"default\": () => $$render`${\"

    This should NOT be italic

    \"}`,})}", - }, }, { name: "set:html on Fragment with template literal attribute without variable", source: "<i>This should NOT be italic</i>

    ` />", - want: want{ - code: "${$$renderComponent($$result,'Fragment',Fragment,{},{\"default\": () => $$render`${`

    This should NOT be italic

    `}`,})}", - }, }, { name: "set:html on Fragment with template literal attribute with variable", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `${` + BACKTICK + `${content}` + BACKTICK + `}` + BACKTICK + `,})}`, - }, }, { name: "template literal attribute on component", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{"class":` + BACKTICK + `red` + BACKTICK + `})}`, - }, }, { name: "template literal attribute with variable on component", source: ``, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{"class":` + BACKTICK + `${color}` + BACKTICK + `})}`, - }, }, { name: "define:vars on style", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}

    testing

    `, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on style tag with style shorthand attribute on element", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}testing`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on style tag with style expression attribute on element", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}testing`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on style tag with style empty attribute on element", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}testing`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on style tag with style quoted attribute on element", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}testing`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on style tag with style template literal attribute on element", source: "

    testing

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}testing`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "multiple define:vars on style", source: "

    foo

    bar

    ", - want: want{ - code: `${$$maybeRenderHead($$result)}

    foo

    bar

    `, - definedVars: []string{"{color:'red'}", "{color:'green'}"}, - }, }, { name: "define:vars on non-root elements", source: "{true ?

    foo

    :

    bar

    }", - want: want{ - code: `${true ? $$render` + BACKTICK + `${$$maybeRenderHead($$result)}

    foo

    ` + BACKTICK + ` : $$render` + BACKTICK + `

    bar

    ` + BACKTICK + `}`, - definedVars: []string{"{color:'green'}"}, - }, }, { name: "define:vars on script with StaticExpression turned on", @@ -3289,48 +1894,27 @@ const items = ["Dog", "Cat", "Platipus"]; // 3. A define:vars hoisted script // 4. A define:vars inline script source: ``, - want: want{ - code: ``, - metadata: metadata{ - hoisted: []string{"{ type: 'inline', value: `var two = 'two';` }"}, - }, - }, }, { name: "define:vars on a module script with imports", // Should not wrap with { } scope. source: ``, - want: want{ - code: ``, - }, }, { name: "comments removed from attribute list", source: `

    Hello

    `, - want: want{ - code: `${$$maybeRenderHead($$result)}

    Hello

    ${$$renderComponent($$result,'Component',Component,{"value":"1",})}
    `, - }, }, { name: "includes comments for shorthand attribute", source: `

    Hello

    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    Hello${$$renderComponent($$result,'Component',Component,{"id":(/* comment 1 */ id /* comment 2 */)})}
    `, - }, }, { name: "includes comments for expression attribute", source: `

    Hello

    `, - want: want{ - code: `${$$maybeRenderHead($$result)}
    Hello${$$renderComponent($$result,'Component',Component,{"attr":(/* comment 1 */ isTrue ? 1 : 2 /* comment 2 */)})}
    `, - }, }, { name: "comment only expressions are removed I", source: `{/* a comment 1 */}

    {/* a comment 2*/}Hello

    `, - want: want{ - code: `${$$maybeRenderHead($$result)}

    Hello

    `, - }, }, { name: "comment only expressions are removed II", @@ -3343,13 +1927,6 @@ const items = ["Dog", "Cat", "Platipus"];
    )) }`, - want: want{ - code: `${ - list.map((i) => ( - $$render` + BACKTICK + `${$$renderComponent($$result,'Component',Component,{},{})}` + BACKTICK + ` - )) -}`, - }, }, { name: "comment only expressions are removed III", @@ -3362,78 +1939,45 @@ const items = ["Dog", "Cat", "Platipus"];
    )) }`, - want: want{ - code: `${ - list.map((i) => ( - $$render` + BACKTICK + `${$$renderComponent($$result,'Component',Component,{},{})}` + BACKTICK + ` - )) -}`, - }, }, { name: "component with only a script", source: "", - want: want{ - code: ``, - metadata: metadata{hoisted: []string{"{ type: 'inline', value: `console.log('hello world');` }"}}, - }, }, { name: "passes filename into createComponent if passed into the compiler options", source: `
    test
    `, filename: "/projects/app/src/pages/page.astro", - want: want{ - code: `${$$maybeRenderHead($$result)}
    test
    `, - }, }, { name: "passes escaped filename into createComponent if it contains single quotes", source: `
    test
    `, filename: "/projects/app/src/pages/page-with-'-quotes.astro", - want: want{ - code: `${$$maybeRenderHead($$result)}
    test
    `, - }, }, { name: "maybeRenderHead not printed for hoisted scripts", source: ``, filename: "/projects/app/src/pages/page.astro", - want: want{ - code: `${$$renderComponent($$result,'Layout',Layout,{})}`, - }, }, { name: "complex recursive component", source: `{(` + BACKTICK + `} />{Node.children.map((child) => ())}` + BACKTICK + `} />)}`, filename: "/projects/app/src/components/RenderNode.astro", - want: want{ - code: `${($$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `${$$unescapeHTML(` + BACKTICK + `<${Node.tag} ${stringifyAttributes(Node.attributes)}>` + BACKTICK + `)}` + BACKTICK + `,})}${Node.children.map((child) => ($$render` + BACKTICK + `${$$renderComponent($$result,'Astro.self',Astro.self,{"node":(child)})}` + BACKTICK + `))}${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render` + BACKTICK + `${$$unescapeHTML(` + BACKTICK + `` + BACKTICK + `)}` + BACKTICK + `,})}` + BACKTICK + `,})}` + BACKTICK + `)}`, - }, }, { name: "multibyte character + style", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "multibyte characters", source: `--- ---

    こんにちは

    `, - want: want{ - code: `${$$maybeRenderHead($$result)}

    こんにちは

    `, - }, }, { name: "multibyte character + script", source: ``, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - metadata: metadata{hoisted: []string{fmt.Sprintf(`{ type: 'inline', value: %sconsole.log('foo')%s }`, BACKTICK, BACKTICK)}}, - }, }, { @@ -3441,67 +1985,43 @@ const items = ["Dog", "Cat", "Platipus"]; source: `
    `, filename: "/projects/app/src/pages/page.astro", transitions: true, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "transition:name with an template literal", source: "
    ", filename: "/projects/app/src/pages/page.astro", transitions: true, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "transition:animate with an expression", source: "
    ", filename: "/projects/app/src/pages/page.astro", transitions: true, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "transition:animate on Component", source: ``, filename: "/projects/app/src/pages/page.astro", transitions: true, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{"class":"bar","data-astro-transition-scope":($$renderTransition($$result, "wkm5vset", "morph", ""))})}`, - }, }, { name: "transition:persist converted to a data attribute", source: `
    `, transitions: true, - want: want{ - code: `${$$maybeRenderHead($$result)}`, - }, }, { name: "transition:persist uses transition:name if defined", source: `
    `, transitions: true, - want: want{ - code: `${$$maybeRenderHead($$result)}
    `, - }, }, { name: "transition:persist-props converted to a data attribute", source: ``, transitions: true, - want: want{ - code: `${$$renderComponent($$result,'my-island','my-island',{"data-astro-transition-persist-props":"false","data-astro-transition-persist":($$createTransitionScope($$result, "otghnj5u"))})}`, - }, }, { name: "trailing expression", source: `{}`, - want: want{ - code: `${$$renderComponent($$result,'Component',Component,{})}${(void 0)}`, - }, }, { name: "nested head content stays in the head", @@ -3523,13 +2043,8 @@ const meta = { title: 'My App' };

    My App

    `, - want: want{ - frontmatter: []string{"", `const meta = { title: 'My App' };`}, - code: ` ${ meta && $$render` + BACKTICK + `${meta.title}` + BACKTICK + ` } ${$$renderHead($$result)}

    My App

    `, - }, }, } - for _, tt := range tests { if tt.only { tests = make([]testcase, 0) @@ -3568,141 +2083,6 @@ const meta = { title: 'My App' }; }, h) output := string(result.Output) - // The compiler prints Astro global code only if it's loosely used - printAstroGlobal := strings.Contains(tt.source, "Astro") - toMatch := INTERNAL_IMPORTS - if strings.Count(tt.source, "transition:") > 0 { - toMatch += `import "transitions.css";` - } - if len(tt.want.frontmatter) > 0 { - toMatch += test_utils.Dedent(tt.want.frontmatter[0]) - } - moduleSpecRe := regexp.MustCompile(`specifier:\s*('[^']+'),\s*assert:\s*([^}]+\})`) - if len(tt.want.metadata.modules) > 0 { - toMatch += "\n\n" - for i, m := range tt.want.metadata.modules { - spec := moduleSpecRe.FindSubmatch([]byte(m)) // 0: full match, 1: submatch - asrt := "" - if string(spec[2]) != "{}" { - asrt = " assert " + string(spec[2]) - } - toMatch += fmt.Sprintf("import * as $$module%s from %s%s;\n", strconv.Itoa(i+1), string(spec[1]), asrt) - } - } - // build metadata object from provided strings - metadata := "{ " - // metadata.modules - metadata += "modules: [" - if len(tt.want.metadata.modules) > 0 { - for i, m := range tt.want.metadata.modules { - if i > 0 { - metadata += ", " - } - metadata += m - } - } - metadata += "]" - // metadata.hydratedComponents - metadata += ", hydratedComponents: [" - if len(tt.want.metadata.hydratedComponents) > 0 { - for i, c := range tt.want.hydratedComponents { - if i > 0 { - metadata += ", " - } - metadata += c - } - } - metadata += "]" - // metadata.clientOnlyComponents - metadata += ", clientOnlyComponents: [" - if len(tt.want.metadata.clientOnlyComponents) > 0 { - for i, c := range tt.want.clientOnlyComponents { - if i > 0 { - metadata += ", " - } - metadata += fmt.Sprintf("'%s'", c) - } - } - metadata += "]" - // directives - metadata += ", hydrationDirectives: new Set([" - if len(tt.want.hydrationDirectives) > 0 { - for i, c := range tt.want.hydrationDirectives { - if i > 0 { - metadata += ", " - } - metadata += fmt.Sprintf("'%s'", c) - } - } - metadata += "])" - // metadata.hoisted - metadata += ", hoisted: [" - if len(tt.want.metadata.hoisted) > 0 { - for i, h := range tt.want.hoisted { - if i > 0 { - metadata += ", " - } - metadata += h - } - } - metadata += "] }" - - patharg := "import.meta.url" - if tt.filename != "" { - escapedFilename := strings.ReplaceAll(tt.filename, "'", "\\'") - patharg = fmt.Sprintf("\"%s\"", escapedFilename) - } - toMatch += "\n\n" + fmt.Sprintf("export const %s = %s(%s, %s);\n\n", METADATA, CREATE_METADATA, patharg, metadata) - if printAstroGlobal { - toMatch += test_utils.Dedent(CREATE_ASTRO_CALL) + "\n" - } - if len(tt.want.getStaticPaths) > 0 { - toMatch += strings.TrimSpace(test_utils.Dedent(tt.want.getStaticPaths)) + "\n\n" - } - if strings.Contains(tt.source, "await") { - toMatch += test_utils.Dedent(PRELUDE_WITH_ASYNC) - } else { - toMatch += test_utils.Dedent(PRELUDE) - } - if printAstroGlobal { - toMatch += test_utils.Dedent(PRELUDE_ASTRO_GLOBAL) - } - toMatch += "\n" - if len(tt.want.frontmatter) > 1 { - toMatch += strings.TrimSpace(test_utils.Dedent(tt.want.frontmatter[1])) - } - toMatch += "\n" - if len(tt.want.definedVars) > 0 { - toMatch = toMatch + "const $$definedVars = $$defineStyleVars([" - for i, d := range tt.want.definedVars { - if i > 0 { - toMatch += "," - } - toMatch += d - } - toMatch += "]);\n" - } - // code - toMatch += test_utils.Dedent(fmt.Sprintf("%s%s", RETURN, tt.want.code)) - // HACK: add period to end of test to indicate significant preceding whitespace (otherwise stripped by dedent) - if strings.HasSuffix(toMatch, ".") { - toMatch = strings.TrimRight(toMatch, ".") - } - - if len(tt.filename) > 0 { - escapedFilename := strings.ReplaceAll(tt.filename, "'", "\\'") - toMatch += suffixWithFilename(escapedFilename, tt.transitions) - toMatch = strings.Replace(toMatch, "$$Component", getComponentName(tt.filename), -1) - } else if tt.transitions { - toMatch += SUFFIX_EXP_TRANSITIONS - } else { - toMatch += SUFFIX - } - - // compare to expected string, show diff if mismatch - if diff := test_utils.ANSIDiff(test_utils.RemoveNewlines(test_utils.Dedent(toMatch)), test_utils.RemoveNewlines(test_utils.Dedent(output))); diff != "" { - t.Errorf("mismatch (-want +got):\n%s", diff) - } test_utils.MakeSnapshot( &test_utils.SnapshotOptions{ Testing: t, @@ -3722,7 +2102,6 @@ func TestPrintToJSON(t *testing.T) { { name: "basic", source: `

    Hello world!

    `, - want: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello world!"}}}}, }, { name: "expression", @@ -3732,37 +2111,30 @@ func TestPrintToJSON(t *testing.T) { { name: "Component", source: ``, - want: []ASTNode{{Type: "component", Name: "Component"}}, }, { name: "custom-element", source: ``, - want: []ASTNode{{Type: "custom-element", Name: "custom-element"}}, }, { name: "Doctype", source: ``, - want: []ASTNode{{Type: "doctype", Value: "html"}}, }, { name: "Comment", source: ``, - want: []ASTNode{{Type: "comment", Value: "hello"}}, }, { name: "Comment preserves whitespace", source: ``, - want: []ASTNode{{Type: "comment", Value: " hello "}}, }, { name: "Fragment Shorthand", source: `<>Hello`, - want: []ASTNode{{Type: "fragment", Name: "", Children: []ASTNode{{Type: "text", Value: "Hello"}}}}, }, { name: "Fragment Literal", source: `World`, - want: []ASTNode{{Type: "fragment", Name: "Fragment", Children: []ASTNode{{Type: "text", Value: "World"}}}}, }, { name: "Frontmatter", diff --git a/internal/transform/__js_scanner__/component_className_expression.snap b/internal/transform/__js_scanner__/component_className_expression.snap deleted file mode 100755 index b135c4505..000000000 --- a/internal/transform/__js_scanner__/component_className_expression.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_expression - 1] -## Input - -``` - -``` - -## Output - -```js - -``` ---- diff --git a/internal/transform/__js_scanner__/component_className_not_scoped.snap b/internal/transform/__js_scanner__/component_className_not_scoped.snap deleted file mode 100755 index 64969f6e8..000000000 --- a/internal/transform/__js_scanner__/component_className_not_scoped.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_not_scoped - 1] -## Input - -``` - -``` - -## Output - -```js - -``` ---- diff --git a/internal/transform/__js_scanner__/component_className_shorthand.snap b/internal/transform/__js_scanner__/component_className_shorthand.snap deleted file mode 100755 index f2e497e98..000000000 --- a/internal/transform/__js_scanner__/component_className_shorthand.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_shorthand - 1] -## Input - -``` - -``` - -## Output - -```js - -``` ---- diff --git a/internal/transform/__js_scanner__/component_class_list.snap b/internal/transform/__js_scanner__/component_class_list.snap deleted file mode 100755 index 93e3e97ad..000000000 --- a/internal/transform/__js_scanner__/component_class_list.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_class:list - 1] -## Input - -``` - -``` - -## Output - -```js - -``` ---- diff --git a/internal/transform/__js_scanner__/element_class_list.snap b/internal/transform/__js_scanner__/element_class_list.snap deleted file mode 100755 index 82498e205..000000000 --- a/internal/transform/__js_scanner__/element_class_list.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/element_class:list - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/element_class_list_string.snap b/internal/transform/__js_scanner__/element_class_list_string.snap deleted file mode 100755 index 9a24f4c15..000000000 --- a/internal/transform/__js_scanner__/element_class_list_string.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/element_class:list_string - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/empty.snap b/internal/transform/__js_scanner__/empty.snap deleted file mode 100755 index 706f1403f..000000000 --- a/internal/transform/__js_scanner__/empty.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/empty - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/expression_dynamic.snap b/internal/transform/__js_scanner__/expression_dynamic.snap deleted file mode 100755 index cf0983e96..000000000 --- a/internal/transform/__js_scanner__/expression_dynamic.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_dynamic - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/expression_function.snap b/internal/transform/__js_scanner__/expression_function.snap deleted file mode 100755 index 6be68643b..000000000 --- a/internal/transform/__js_scanner__/expression_function.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_function - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/expression_string.snap b/internal/transform/__js_scanner__/expression_string.snap deleted file mode 100755 index 016d77a68..000000000 --- a/internal/transform/__js_scanner__/expression_string.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_string - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/fault_input_currently_accepted.snap b/internal/transform/__js_scanner__/fault_input_currently_accepted.snap deleted file mode 100755 index bd41af054..000000000 --- a/internal/transform/__js_scanner__/fault_input_currently_accepted.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/fault_input_currently_accepted - 1] -## Input - -``` - -``` - -## Output - -```js -={0>} class="astro-xxxxxx"> -``` ---- diff --git a/internal/transform/__js_scanner__/none.snap b/internal/transform/__js_scanner__/none.snap deleted file mode 100755 index 3812b3d00..000000000 --- a/internal/transform/__js_scanner__/none.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/none - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/quoted.snap b/internal/transform/__js_scanner__/quoted.snap deleted file mode 100755 index 198ffb659..000000000 --- a/internal/transform/__js_scanner__/quoted.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/quoted - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/quoted_no_trim.snap b/internal/transform/__js_scanner__/quoted_no_trim.snap deleted file mode 100755 index 19db55e1f..000000000 --- a/internal/transform/__js_scanner__/quoted_no_trim.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/quoted_no_trim - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__js_scanner__/template_literal.snap b/internal/transform/__js_scanner__/template_literal.snap deleted file mode 100755 index e554a5ba6..000000000 --- a/internal/transform/__js_scanner__/template_literal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/template_literal - 1] -## Input - -``` -
    -``` - -## Output - -```js -
    -``` ---- diff --git a/internal/transform/__scope-css__/_container.snap b/internal/transform/__scope-css__/_container.snap deleted file mode 100755 index 0733e8cd5..000000000 --- a/internal/transform/__scope-css__/_container.snap +++ /dev/null @@ -1,18 +0,0 @@ - -[TestScopeStyle/@container - 1] -## Input - -``` -@container (min-width: 200px) and (min-height: 200px) { - h1 { - font-size: 30px; - } - } -``` - -## Output - -```css -@container (min-width: 200px) and (min-height: 200px){h1:where(.astro-xxxxxx){font-size:30px}} -``` ---- diff --git a/internal/transform/__scope-css__/_layer.snap b/internal/transform/__scope-css__/_layer.snap deleted file mode 100755 index 6faa8085a..000000000 --- a/internal/transform/__scope-css__/_layer.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/@layer - 1] -## Input - -``` -@layer theme, layout, utilities; @layer special { .item { color: rebeccapurple; }} -``` - -## Output - -```css -@layer theme,layout,utilities;@layer special{.item:where(.astro-xxxxxx){color:rebeccapurple}} -``` ---- diff --git a/internal/transform/__scope-css__/_root.snap b/internal/transform/__scope-css__/_root.snap deleted file mode 100755 index b022f1f67..000000000 --- a/internal/transform/__scope-css__/_root.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/:root - 1] -## Input - -``` -:root{} -``` - -## Output - -```css -:root{} -``` ---- diff --git a/internal/transform/__scope-css__/_starting-style.snap b/internal/transform/__scope-css__/_starting-style.snap deleted file mode 100755 index cef96b927..000000000 --- a/internal/transform/__scope-css__/_starting-style.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/@starting-style - 1] -## Input - -``` -@starting-style{.class{}} -``` - -## Output - -```css -@starting-style{.class:where(.astro-xxxxxx){}} -``` ---- diff --git a/internal/transform/__scope-css__/adjacent_sibling.snap b/internal/transform/__scope-css__/adjacent_sibling.snap deleted file mode 100755 index 50a413d4c..000000000 --- a/internal/transform/__scope-css__/adjacent_sibling.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/adjacent_sibling - 1] -## Input - -``` -.class+.class{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx)+.class:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/and_selector.snap b/internal/transform/__scope-css__/and_selector.snap deleted file mode 100755 index 28af4d6a0..000000000 --- a/internal/transform/__scope-css__/and_selector.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/and_selector - 1] -## Input - -``` -.class,.class{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx),.class:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/attr.snap b/internal/transform/__scope-css__/attr.snap deleted file mode 100755 index 73a0bf34a..000000000 --- a/internal/transform/__scope-css__/attr.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/attr - 1] -## Input - -``` -a[aria-current=page]{} -``` - -## Output - -```css -a:where(.astro-xxxxxx)[aria-current=page]{} -``` ---- diff --git a/internal/transform/__scope-css__/attr_universal_implied.snap b/internal/transform/__scope-css__/attr_universal_implied.snap deleted file mode 100755 index 67be54c16..000000000 --- a/internal/transform/__scope-css__/attr_universal_implied.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/attr_universal_implied - 1] -## Input - -``` -[aria-visible],[aria-hidden]{} -``` - -## Output - -```css -:where(.astro-xxxxxx)[aria-visible],:where(.astro-xxxxxx)[aria-hidden]{} -``` ---- diff --git a/internal/transform/__scope-css__/attributes.snap b/internal/transform/__scope-css__/attributes.snap deleted file mode 100755 index 756610481..000000000 --- a/internal/transform/__scope-css__/attributes.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/attributes - 1] -## Input - -``` -body{background-image:url('/assets/bg.jpg');clip-path:polygon(0% 0%,100% 0%,100% 100%,0% 100%);} -``` - -## Output - -```css -body{background-image:url(/assets/bg.jpg);clip-path:polygon(0% 0%,100% 0%,100% 100%,0% 100%)} -``` ---- diff --git a/internal/transform/__scope-css__/body.snap b/internal/transform/__scope-css__/body.snap deleted file mode 100755 index d9727659d..000000000 --- a/internal/transform/__scope-css__/body.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/body - 1] -## Input - -``` -body h1{} -``` - -## Output - -```css -body h1:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/body_class.snap b/internal/transform/__scope-css__/body_class.snap deleted file mode 100755 index 5a2f8f288..000000000 --- a/internal/transform/__scope-css__/body_class.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/body_class - 1] -## Input - -``` -body.theme-dark{} -``` - -## Output - -```css -body.theme-dark{} -``` ---- diff --git a/internal/transform/__scope-css__/calc.snap b/internal/transform/__scope-css__/calc.snap deleted file mode 100755 index 3cae72639..000000000 --- a/internal/transform/__scope-css__/calc.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/calc - 1] -## Input - -``` -:root{padding:calc(var(--space) * 2);} -``` - -## Output - -```css -:root{padding:calc(var(--space) * 2)} -``` ---- diff --git a/internal/transform/__scope-css__/chained__not__.snap b/internal/transform/__scope-css__/chained__not__.snap deleted file mode 100755 index 445b321a7..000000000 --- a/internal/transform/__scope-css__/chained__not__.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/chained_:not() - 1] -## Input - -``` -.class:not(.is-active):not(.is-disabled){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx):not(.is-active):not(.is-disabled){} -``` ---- diff --git a/internal/transform/__scope-css__/charset.snap b/internal/transform/__scope-css__/charset.snap deleted file mode 100755 index e77587e76..000000000 --- a/internal/transform/__scope-css__/charset.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/charset - 1] -## Input - -``` -@charset "utf-8"; -``` - -## Output - -```css -@charset "utf-8"; -``` ---- diff --git a/internal/transform/__scope-css__/children_universal.snap b/internal/transform/__scope-css__/children_universal.snap deleted file mode 100755 index 89998fe39..000000000 --- a/internal/transform/__scope-css__/children_universal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/children_universal - 1] -## Input - -``` -.class *{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) :where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/class.snap b/internal/transform/__scope-css__/class.snap deleted file mode 100755 index 74ad92e3e..000000000 --- a/internal/transform/__scope-css__/class.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/class - 1] -## Input - -``` -.class{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/class_chained_global.snap b/internal/transform/__scope-css__/class_chained_global.snap deleted file mode 100755 index 9da2dd9db..000000000 --- a/internal/transform/__scope-css__/class_chained_global.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/class_chained_global - 1] -## Input - -``` -.class:global(.bar){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx).bar{} -``` ---- diff --git a/internal/transform/__scope-css__/element.snap b/internal/transform/__scope-css__/element.snap deleted file mode 100755 index 9d25795b1..000000000 --- a/internal/transform/__scope-css__/element.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/element - 1] -## Input - -``` -h1{} -``` - -## Output - -```css -h1:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/element___pseudo_element.snap b/internal/transform/__scope-css__/element___pseudo_element.snap deleted file mode 100755 index 5ed70d1e5..000000000 --- a/internal/transform/__scope-css__/element___pseudo_element.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/element_+_pseudo_element - 1] -## Input - -``` -.class h3::before{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) h3:where(.astro-xxxxxx)::before{} -``` ---- diff --git a/internal/transform/__scope-css__/element___pseudo_state.snap b/internal/transform/__scope-css__/element___pseudo_state.snap deleted file mode 100755 index fc4765ef0..000000000 --- a/internal/transform/__scope-css__/element___pseudo_state.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/element_+_pseudo_state - 1] -## Input - -``` -.class button:focus{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) button:where(.astro-xxxxxx):focus{} -``` ---- diff --git a/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap b/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap deleted file mode 100755 index ceb0e4a11..000000000 --- a/internal/transform/__scope-css__/element___pseudo_state___pseudo_element.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/element_+_pseudo_state_+_pseudo_element - 1] -## Input - -``` -button:focus::before{} -``` - -## Output - -```css -button:where(.astro-xxxxxx):focus::before{} -``` ---- diff --git a/internal/transform/__scope-css__/escaped_characters.snap b/internal/transform/__scope-css__/escaped_characters.snap deleted file mode 100755 index 92cf80a75..000000000 --- a/internal/transform/__scope-css__/escaped_characters.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/escaped_characters - 1] -## Input - -``` -.class\:class:focus{} -``` - -## Output - -```css -.class\:class:where(.astro-xxxxxx):focus{} -``` ---- diff --git a/internal/transform/__scope-css__/global_chaining_global.snap b/internal/transform/__scope-css__/global_chaining_global.snap deleted file mode 100755 index 8c6c95719..000000000 --- a/internal/transform/__scope-css__/global_chaining_global.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_chaining_global - 1] -## Input - -``` -:global(.foo):global(.bar){} -``` - -## Output - -```css -.foo.bar{} -``` ---- diff --git a/internal/transform/__scope-css__/global_children.snap b/internal/transform/__scope-css__/global_children.snap deleted file mode 100755 index df3f2f1da..000000000 --- a/internal/transform/__scope-css__/global_children.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_children - 1] -## Input - -``` -.class :global(ul li){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) ul li{} -``` ---- diff --git a/internal/transform/__scope-css__/global_nested_parens.snap b/internal/transform/__scope-css__/global_nested_parens.snap deleted file mode 100755 index 7a67fb484..000000000 --- a/internal/transform/__scope-css__/global_nested_parens.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_nested_parens - 1] -## Input - -``` -.class :global(.nav:not(.is-active)){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) .nav:not(.is-active){} -``` ---- diff --git a/internal/transform/__scope-css__/global_nested_parens___chained_class.snap b/internal/transform/__scope-css__/global_nested_parens___chained_class.snap deleted file mode 100755 index bee113787..000000000 --- a/internal/transform/__scope-css__/global_nested_parens___chained_class.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_nested_parens_+_chained_class - 1] -## Input - -``` -:global(body:not(.is-light)).is-dark,:global(body:not(.is-dark)).is-light{} -``` - -## Output - -```css -body:not(.is-light).is-dark,body:not(.is-dark).is-light{} -``` ---- diff --git a/internal/transform/__scope-css__/global_universal.snap b/internal/transform/__scope-css__/global_universal.snap deleted file mode 100755 index 5ca5d7b30..000000000 --- a/internal/transform/__scope-css__/global_universal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_universal - 1] -## Input - -``` -.class :global(*){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx) *{} -``` ---- diff --git a/internal/transform/__scope-css__/global_with_scoped_children.snap b/internal/transform/__scope-css__/global_with_scoped_children.snap deleted file mode 100755 index 892294403..000000000 --- a/internal/transform/__scope-css__/global_with_scoped_children.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/global_with_scoped_children - 1] -## Input - -``` -:global(section) .class{} -``` - -## Output - -```css -section .class:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/grid-template-columns.snap b/internal/transform/__scope-css__/grid-template-columns.snap deleted file mode 100755 index d1e5f31c9..000000000 --- a/internal/transform/__scope-css__/grid-template-columns.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/grid-template-columns - 1] -## Input - -``` -div{grid-template-columns: [content-start] 1fr [content-end];} -``` - -## Output - -```css -div:where(.astro-xxxxxx){grid-template-columns:[content-start] 1fr [content-end]} -``` ---- diff --git a/internal/transform/__scope-css__/html_and_body.snap b/internal/transform/__scope-css__/html_and_body.snap deleted file mode 100755 index 691ab0c86..000000000 --- a/internal/transform/__scope-css__/html_and_body.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/html_and_body - 1] -## Input - -``` -html,body{} -``` - -## Output - -```css -html,body{} -``` ---- diff --git a/internal/transform/__scope-css__/id.snap b/internal/transform/__scope-css__/id.snap deleted file mode 100755 index 32f5667f9..000000000 --- a/internal/transform/__scope-css__/id.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/id - 1] -## Input - -``` -#class{} -``` - -## Output - -```css -#class:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/immediate_child_universal.snap b/internal/transform/__scope-css__/immediate_child_universal.snap deleted file mode 100755 index cba3336c5..000000000 --- a/internal/transform/__scope-css__/immediate_child_universal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/immediate_child_universal - 1] -## Input - -``` -.class>*{} -``` - -## Output - -```css -.class:where(.astro-xxxxxx)>:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/import__plain_.snap b/internal/transform/__scope-css__/import__plain_.snap deleted file mode 100755 index 94a506142..000000000 --- a/internal/transform/__scope-css__/import__plain_.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/import_(plain) - 1] -## Input - -``` -@import "./my-file.css"; -``` - -## Output - -```css -@import"./my-file.css"; -``` ---- diff --git a/internal/transform/__scope-css__/import__url_.snap b/internal/transform/__scope-css__/import__url_.snap deleted file mode 100755 index 52271b50c..000000000 --- a/internal/transform/__scope-css__/import__url_.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/import_(url) - 1] -## Input - -``` -@import url("./my-file.css"); -``` - -## Output - -```css -@import"./my-file.css"; -``` ---- diff --git a/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap b/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap deleted file mode 100755 index 74ecf4ec9..000000000 --- a/internal/transform/__scope-css__/invalid_CSS___missing_semi__.snap +++ /dev/null @@ -1,17 +0,0 @@ - -[TestScopeStyle/invalid_CSS_(`missing_semi`) - 1] -## Input - -``` -.foo { - color: blue - font-size: 18px; -} -``` - -## Output - -```css -.foo:where(.astro-xxxxxx){color:blue font-size: 18px} -``` ---- diff --git a/internal/transform/__scope-css__/keyframes.snap b/internal/transform/__scope-css__/keyframes.snap deleted file mode 100755 index aa7973367..000000000 --- a/internal/transform/__scope-css__/keyframes.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/keyframes - 1] -## Input - -``` -@keyframes shuffle{from{transform:rotate(0deg);}to{transform:rotate(360deg);}} -``` - -## Output - -```css -@keyframes shuffle{from{transform:rotate(0deg)}to{transform:rotate(360deg)}} -``` ---- diff --git a/internal/transform/__scope-css__/keyframes_2.snap b/internal/transform/__scope-css__/keyframes_2.snap deleted file mode 100755 index 47ed1f970..000000000 --- a/internal/transform/__scope-css__/keyframes_2.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/keyframes_2 - 1] -## Input - -``` -@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} -``` - -## Output - -```css -@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} -``` ---- diff --git a/internal/transform/__scope-css__/keyframes_end.snap b/internal/transform/__scope-css__/keyframes_end.snap deleted file mode 100755 index 227024fa1..000000000 --- a/internal/transform/__scope-css__/keyframes_end.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/keyframes_end - 1] -## Input - -``` -h1{} h2{} @keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} -``` - -## Output - -```css -h1:where(.astro-xxxxxx){}h2:where(.astro-xxxxxx){}@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} -``` ---- diff --git a/internal/transform/__scope-css__/keyframes_middle.snap b/internal/transform/__scope-css__/keyframes_middle.snap deleted file mode 100755 index b602c81b0..000000000 --- a/internal/transform/__scope-css__/keyframes_middle.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/keyframes_middle - 1] -## Input - -``` -h1{} @keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} h2{} -``` - -## Output - -```css -h1:where(.astro-xxxxxx){}@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}}h2:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/keyframes_start.snap b/internal/transform/__scope-css__/keyframes_start.snap deleted file mode 100755 index edd58c861..000000000 --- a/internal/transform/__scope-css__/keyframes_start.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/keyframes_start - 1] -## Input - -``` -@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}} h1{} h2{} -``` - -## Output - -```css -@keyframes shuffle{0%{transform:rotate(0deg);color:blue}100%{transform:rotate(360deg)}}h1:where(.astro-xxxxxx){}h2:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/media_query.snap b/internal/transform/__scope-css__/media_query.snap deleted file mode 100755 index 1676c66d4..000000000 --- a/internal/transform/__scope-css__/media_query.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/media_query - 1] -## Input - -``` -@media screen and (min-width:640px){.class{}} -``` - -## Output - -```css -@media screen and (min-width:640px){.class:where(.astro-xxxxxx){}} -``` ---- diff --git a/internal/transform/__scope-css__/more_weird_chaining.snap b/internal/transform/__scope-css__/more_weird_chaining.snap deleted file mode 100755 index a6ab26452..000000000 --- a/internal/transform/__scope-css__/more_weird_chaining.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/more_weird_chaining - 1] -## Input - -``` -:not(.is-disabled).a{} -``` - -## Output - -```css -:not(.is-disabled).a:where(.astro-xxxxxx){} -``` ---- diff --git a/internal/transform/__scope-css__/nesting_combinator.snap b/internal/transform/__scope-css__/nesting_combinator.snap deleted file mode 100755 index 63c3719ed..000000000 --- a/internal/transform/__scope-css__/nesting_combinator.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/nesting_combinator - 1] -## Input - -``` -div { & span { color: blue } } -``` - -## Output - -```css -div:where(.astro-xxxxxx){& span:where(.astro-xxxxxx){color:blue}} -``` ---- diff --git a/internal/transform/__scope-css__/nesting_media.snap b/internal/transform/__scope-css__/nesting_media.snap deleted file mode 100755 index 81e7e9528..000000000 --- a/internal/transform/__scope-css__/nesting_media.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/nesting_media - 1] -## Input - -``` -:global(html) { @media (min-width: 640px) { color: blue } }html { background-color: lime } -``` - -## Output - -```css -html{@media (min-width: 640px){color:blue}}html{background-color:lime} -``` ---- diff --git a/internal/transform/__scope-css__/nesting_modifier.snap b/internal/transform/__scope-css__/nesting_modifier.snap deleted file mode 100755 index 0300c1f37..000000000 --- a/internal/transform/__scope-css__/nesting_modifier.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/nesting_modifier - 1] -## Input - -``` -.header { background-color: white; &.dark { background-color: blue; }} -``` - -## Output - -```css -.header:where(.astro-xxxxxx){background-color:white;&.dark{background-color:blue}} -``` ---- diff --git a/internal/transform/__scope-css__/subsequent_siblings___global.snap b/internal/transform/__scope-css__/subsequent_siblings___global.snap deleted file mode 100755 index 19e1e7d87..000000000 --- a/internal/transform/__scope-css__/subsequent_siblings___global.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/subsequent_siblings_+_global - 1] -## Input - -``` -.class~:global(a){} -``` - -## Output - -```css -.class:where(.astro-xxxxxx)~a{} -``` ---- diff --git a/internal/transform/__scope-css__/universal_pseudo_state.snap b/internal/transform/__scope-css__/universal_pseudo_state.snap deleted file mode 100755 index c65de1e8d..000000000 --- a/internal/transform/__scope-css__/universal_pseudo_state.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/universal_pseudo_state - 1] -## Input - -``` -*:hover{} -``` - -## Output - -```css -:where(.astro-xxxxxx):hover{} -``` ---- diff --git a/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap b/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap deleted file mode 100755 index 5d89b219c..000000000 --- a/internal/transform/__scope-css__/valid_CSS,_madeup_syntax.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/valid_CSS,_madeup_syntax - 1] -## Input - -``` -@tailwind base; -``` - -## Output - -```css -@tailwind base; -``` ---- diff --git a/internal/transform/__scope-css__/variables.snap b/internal/transform/__scope-css__/variables.snap deleted file mode 100755 index 45aad6de6..000000000 --- a/internal/transform/__scope-css__/variables.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/variables - 1] -## Input - -``` -body{--bg:red;background:var(--bg);color:black;} -``` - -## Output - -```css -body{--bg:red;background:var(--bg);color:black} -``` ---- diff --git a/internal/transform/__scope-css__/weird_chaining.snap b/internal/transform/__scope-css__/weird_chaining.snap deleted file mode 100755 index 557c80d56..000000000 --- a/internal/transform/__scope-css__/weird_chaining.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeStyle/weird_chaining - 1] -## Input - -``` -:hover.a:focus{} -``` - -## Output - -```css -:hover.a:where(.astro-xxxxxx):focus{} -``` ---- diff --git a/internal/transform/__scope_html__/component_className_expression.snap b/internal/transform/__scope_html__/component_className_expression.snap deleted file mode 100755 index af3a7c552..000000000 --- a/internal/transform/__scope_html__/component_className_expression.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_expression - 1] -## Input - -``` - -``` - -## Output - -```jsx - -``` ---- diff --git a/internal/transform/__scope_html__/component_className_not_scoped.snap b/internal/transform/__scope_html__/component_className_not_scoped.snap deleted file mode 100755 index 3d3810612..000000000 --- a/internal/transform/__scope_html__/component_className_not_scoped.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_not_scoped - 1] -## Input - -``` - -``` - -## Output - -```jsx - -``` ---- diff --git a/internal/transform/__scope_html__/component_className_shorthand.snap b/internal/transform/__scope_html__/component_className_shorthand.snap deleted file mode 100755 index 9675a0839..000000000 --- a/internal/transform/__scope_html__/component_className_shorthand.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_className_shorthand - 1] -## Input - -``` - -``` - -## Output - -```jsx - -``` ---- diff --git a/internal/transform/__scope_html__/component_class_list.snap b/internal/transform/__scope_html__/component_class_list.snap deleted file mode 100755 index 99ecb087d..000000000 --- a/internal/transform/__scope_html__/component_class_list.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/component_class:list - 1] -## Input - -``` - -``` - -## Output - -```jsx - -``` ---- diff --git a/internal/transform/__scope_html__/element_class_list.snap b/internal/transform/__scope_html__/element_class_list.snap deleted file mode 100755 index 187da645c..000000000 --- a/internal/transform/__scope_html__/element_class_list.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/element_class:list - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/element_class_list_string.snap b/internal/transform/__scope_html__/element_class_list_string.snap deleted file mode 100755 index 74ff57709..000000000 --- a/internal/transform/__scope_html__/element_class_list_string.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/element_class:list_string - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/empty.snap b/internal/transform/__scope_html__/empty.snap deleted file mode 100755 index 7c9036a1c..000000000 --- a/internal/transform/__scope_html__/empty.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/empty - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/expression_dynamic.snap b/internal/transform/__scope_html__/expression_dynamic.snap deleted file mode 100755 index 6fb8042f5..000000000 --- a/internal/transform/__scope_html__/expression_dynamic.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_dynamic - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/expression_function.snap b/internal/transform/__scope_html__/expression_function.snap deleted file mode 100755 index ba8f51c97..000000000 --- a/internal/transform/__scope_html__/expression_function.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_function - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/expression_string.snap b/internal/transform/__scope_html__/expression_string.snap deleted file mode 100755 index a4da718d9..000000000 --- a/internal/transform/__scope_html__/expression_string.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/expression_string - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/fault_input_currently_accepted.snap b/internal/transform/__scope_html__/fault_input_currently_accepted.snap deleted file mode 100755 index 4059ef05b..000000000 --- a/internal/transform/__scope_html__/fault_input_currently_accepted.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/fault_input_currently_accepted - 1] -## Input - -``` - -``` - -## Output - -```jsx -={0>} class="astro-xxxxxx"> -``` ---- diff --git a/internal/transform/__scope_html__/none.snap b/internal/transform/__scope_html__/none.snap deleted file mode 100755 index 14a5f1a90..000000000 --- a/internal/transform/__scope_html__/none.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/none - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/quoted.snap b/internal/transform/__scope_html__/quoted.snap deleted file mode 100755 index 1abcb1338..000000000 --- a/internal/transform/__scope_html__/quoted.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/quoted - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/quoted_no_trim.snap b/internal/transform/__scope_html__/quoted_no_trim.snap deleted file mode 100755 index c70d3cb9b..000000000 --- a/internal/transform/__scope_html__/quoted_no_trim.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/quoted_no_trim - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__scope_html__/template_literal.snap b/internal/transform/__scope_html__/template_literal.snap deleted file mode 100755 index 712da2a8f..000000000 --- a/internal/transform/__scope_html__/template_literal.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestScopeHTML/template_literal - 1] -## Input - -``` -
    -``` - -## Output - -```jsx -
    -``` ---- diff --git a/internal/transform/__transform__/basic.snap b/internal/transform/__transform__/basic.snap deleted file mode 100755 index 83a592bdc..000000000 --- a/internal/transform/__transform__/basic.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestAnnotation/basic - 1] -## Input - -``` -
    Hello world!
    -``` - -## Output - -```jsx -
    Hello world!
    -``` ---- diff --git a/internal/transform/__transform__/injects_root.snap b/internal/transform/__transform__/injects_root.snap deleted file mode 100755 index 20ae559a0..000000000 --- a/internal/transform/__transform__/injects_root.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestAnnotation/injects_root - 1] -## Input - -``` - -``` - -## Output - -```jsx - -``` ---- diff --git a/internal/transform/__transform__/no_components.snap b/internal/transform/__transform__/no_components.snap deleted file mode 100755 index b53eaf4d6..000000000 --- a/internal/transform/__transform__/no_components.snap +++ /dev/null @@ -1,14 +0,0 @@ - -[TestAnnotation/no_components - 1] -## Input - -``` -Hello world! -``` - -## Output - -```jsx -Hello world! -``` ---- diff --git a/internal/transform/scope-css_test.go b/internal/transform/scope-css_test.go index e327c9ae9..9510b841b 100644 --- a/internal/transform/scope-css_test.go +++ b/internal/transform/scope-css_test.go @@ -290,14 +290,6 @@ func TestScopeStyle(t *testing.T) { if tt.want != got { t.Errorf("\nFAIL: %s\n want: %s\n got: %s", tt.name, tt.want, got) } - test_utils.MakeSnapshot(&test_utils.SnapshotOptions{ - Testing: t, - TestCaseName: tt.name, - Input: tt.source, - Output: got, - Kind: test_utils.CssOutput, - FolderName: "__scope-css__", - }) }) } } diff --git a/internal/transform/scope-html_test.go b/internal/transform/scope-html_test.go index 792bc7378..d4d234fe6 100644 --- a/internal/transform/scope-html_test.go +++ b/internal/transform/scope-html_test.go @@ -7,7 +7,6 @@ import ( astro "github.com/withastro/compiler/internal" "github.com/withastro/compiler/internal/handler" - "github.com/withastro/compiler/internal/test_utils" "golang.org/x/net/html/atom" ) @@ -121,15 +120,7 @@ func TestScopeHTML(t *testing.T) { if err != nil { t.Error(err) } - test_utils.MakeSnapshot( - &test_utils.SnapshotOptions{ - Testing: t, - TestCaseName: tt.name, - Input: tt.source, - Output: string(got), - Kind: test_utils.JsxOutput, - FolderName: "__scope_html__", - }) + ScopeElement(nodes[0], TransformOptions{Scope: "xxxxxx"}) astro.PrintToSource(&b, nodes[0]) }) diff --git a/internal/transform/transform_test.go b/internal/transform/transform_test.go index ae3b9e1f7..4f3e4b8d7 100644 --- a/internal/transform/transform_test.go +++ b/internal/transform/transform_test.go @@ -8,7 +8,6 @@ import ( astro "github.com/withastro/compiler/internal" "github.com/withastro/compiler/internal/handler" - "github.com/withastro/compiler/internal/test_utils" ) func transformScopingFixtures() []struct { @@ -530,15 +529,6 @@ func TestAnnotation(t *testing.T) { t.Errorf("\nFAIL: %s\n want: %s\n got: %s", tt.name, tt.want, got) } - test_utils.MakeSnapshot( - &test_utils.SnapshotOptions{ - Testing: t, - TestCaseName: tt.name, - Input: tt.source, - Output: string(got), - Kind: test_utils.JsxOutput, - FolderName: "__transform__", - }) }) } } From 7019221f7d1c53df776e2dfee4bac1bce38112c9 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 30 Jul 2024 11:19:05 +0100 Subject: [PATCH 7/9] do the same for json printer --- internal/printer/printer_test.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index a32cd6d99..8731e27c1 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -84,7 +84,6 @@ type testcase struct { type jsonTestcase struct { name string source string - want []ASTNode } func TestPrinter(t *testing.T) { @@ -2106,7 +2105,6 @@ func TestPrintToJSON(t *testing.T) { { name: "expression", source: `

    Hello {world}

    `, - want: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello "}, {Type: "expression", Children: []ASTNode{{Type: "text", Value: "world"}}}}}}, }, { name: "Component", @@ -2142,7 +2140,6 @@ func TestPrintToJSON(t *testing.T) { const a = "hey" ---
    {a}
    `, - want: []ASTNode{{Type: "frontmatter", Value: "\nconst a = \"hey\"\n"}, {Type: "element", Name: "div", Children: []ASTNode{{Type: "expression", Children: []ASTNode{{Type: "text", Value: "a"}}}}}}, }, { name: "JSON escape", @@ -2152,47 +2149,38 @@ const b = "\"" const c = '\'' --- {a + b + c}`, - want: []ASTNode{{Type: "frontmatter", Value: "\nconst a = \"\\n\"\nconst b = \"\\\"\"\nconst c = '\\''\n"}, {Type: "expression", Children: []ASTNode{{Type: "text", Value: "a + b + c"}}}}, }, { name: "Preserve namespaces", source: ``, - want: []ASTNode{{Type: "element", Name: "svg", Attributes: []ASTNode{{Type: "attribute", Kind: "quoted", Name: "xmlns", Value: "http://www.w3.org/2000/svg", Raw: `"http://www.w3.org/2000/svg"`}, {Type: "attribute", Kind: "quoted", Name: "xmlns:xlink", Value: "http://www.w3.org/1999/xlink", Raw: `"http://www.w3.org/1999/xlink"`}}, Children: []ASTNode{{Type: "element", Name: "rect", Attributes: []ASTNode{{Type: "attribute", Kind: "quoted", Name: "xlink:href", Value: "#id", Raw: `"#id"`}}}}}}, }, { name: "style before html", source: `

    Hello world!

    `, - want: []ASTNode{{Type: "element", Name: "style"}, {Type: "element", Name: "html", Children: []ASTNode{{Type: "element", Name: "body", Children: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello world!"}}}}}}}}, }, { name: "style after html", source: `

    Hello world!

    `, - want: []ASTNode{{Type: "element", Name: "html", Children: []ASTNode{{Type: "element", Name: "body", Children: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello world!"}}}}}}}, {Type: "element", Name: "style"}}, }, { name: "style in html", source: `

    Hello world!

    `, - want: []ASTNode{{Type: "element", Name: "html", Children: []ASTNode{{Type: "element", Name: "body", Children: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello world!"}}}}}, {Type: "element", Name: "style"}}}}, }, { name: "style in body", source: `

    Hello world!

    `, - want: []ASTNode{{Type: "element", Name: "html", Children: []ASTNode{{Type: "element", Name: "body", Children: []ASTNode{{Type: "element", Name: "h1", Children: []ASTNode{{Type: "text", Value: "Hello world!"}}}, {Type: "element", Name: "style"}}}}}}, }, { name: "element with unterminated double quote attribute", source: `
    `, - want: []ASTNode{{Type: "element", Name: "main", Attributes: []ASTNode{{Type: "attribute", Kind: "template-literal", Name: "id", Value: "gotcha", Raw: "`gotcha"}}}}, }, } @@ -2207,15 +2195,8 @@ const c = '\'' t.Error(err) } - root := ASTNode{Type: "root", Children: tt.want} - toMatch := root.String() - result := PrintToJSON(code, doc, types.ParseOptions{Position: false}) - if diff := test_utils.ANSIDiff(test_utils.Dedent(string(toMatch)), test_utils.Dedent(string(result.Output))); diff != "" { - t.Errorf("mismatch (-want +got):\n%s", diff) - } - test_utils.MakeSnapshot( &test_utils.SnapshotOptions{ Testing: t, From 037482d117c52db47a3e1c5882a2e564bfcf64d4 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 30 Jul 2024 11:40:21 +0100 Subject: [PATCH 8/9] better explanation --- CONTRIBUTING.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e345734b..8e2b1530c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,9 +91,37 @@ UPDATE_SNAPS=clean go test -v ./internal/... ``` -### Adding new tests +### Adding new test cases + +The printer tests emit only snapshots. Go to `printer_test.go` and add a new test case: + +```go +{ + name: "New name for this test" + code: "
    " +} +``` + +Then run the below command, and a new snapshot named `new_name_for_this_test.snap` should appear in the snapshot folder. + +```shell +go test -v ./internal/printer/printer_test.go +``` + +Other tests, like tokenizer and scanner be found in `internal/token_test.go`, `internal/js_scanner_test.go` and respectively. + +Those tests don't emit any snapshot, and you'll have to add a `want` field: + +```go +{ + name: "New name for this test" + code: "
    ", + want: want{ + code: "
    " + } +} +``` -Adding tests for the tokenizer, scanner, and printer can be found in `internal/token_test.go`, `internal/js_scanner_test.go`, and `internal/printer/printer_test.go`, respectively. [homebrew]: https://brew.sh/ [go]: https://golang.org/ From 0ce3b62867c54c21384ae93659f0cd11bcf4921a Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 30 Jul 2024 11:43:41 +0100 Subject: [PATCH 9/9] fix mergef --- ...after_body_with_component_in_head_and_body.snap | 14 ++++++++++++++ .../__printer_json__/style_after_empty_html.snap | 14 ++++++++++++++ .../style_after_html_with_component_in_head.snap | 14 ++++++++++++++ ...after_html_with_component_in_head_and_body.snap | 14 ++++++++++++++ internal/printer/printer_test.go | 4 ---- 5 files changed, 56 insertions(+), 4 deletions(-) create mode 100755 internal/printer/__printer_json__/style_after_body_with_component_in_head_and_body.snap create mode 100755 internal/printer/__printer_json__/style_after_empty_html.snap create mode 100755 internal/printer/__printer_json__/style_after_html_with_component_in_head.snap create mode 100755 internal/printer/__printer_json__/style_after_html_with_component_in_head_and_body.snap diff --git a/internal/printer/__printer_json__/style_after_body_with_component_in_head_and_body.snap b/internal/printer/__printer_json__/style_after_body_with_component_in_head_and_body.snap new file mode 100755 index 000000000..53a5ce900 --- /dev/null +++ b/internal/printer/__printer_json__/style_after_body_with_component_in_head_and_body.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_after_body_with_component_in_head_and_body - 1] +## Input + +``` +
    +``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[{"type":"attribute","kind":"quoted","name":"lang","value":"en","raw":"\"en\""}],"children":[{"type":"element","name":"head","attributes":[],"children":[{"type":"component","name":"BaseHead","attributes":[],"children":[]}]},{"type":"element","name":"body","attributes":[],"children":[{"type":"component","name":"Header","attributes":[],"children":[]}]},{"type":"element","name":"style","attributes":[],"children":[{"type":"text","value":"@use \"../styles/global.scss\";"}]}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_after_empty_html.snap b/internal/printer/__printer_json__/style_after_empty_html.snap new file mode 100755 index 000000000..f7345940e --- /dev/null +++ b/internal/printer/__printer_json__/style_after_empty_html.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_after_empty_html - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[],"children":[]},{"type":"element","name":"style","attributes":[],"children":[]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_after_html_with_component_in_head.snap b/internal/printer/__printer_json__/style_after_html_with_component_in_head.snap new file mode 100755 index 000000000..41fd3c33b --- /dev/null +++ b/internal/printer/__printer_json__/style_after_html_with_component_in_head.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_after_html_with_component_in_head - 1] +## Input + +``` + +``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[{"type":"attribute","kind":"quoted","name":"lang","value":"en","raw":"\"en\""}],"children":[{"type":"element","name":"head","attributes":[],"children":[{"type":"component","name":"BaseHead","attributes":[],"children":[]}]}]},{"type":"element","name":"style","attributes":[],"children":[{"type":"text","value":"@use \"../styles/global.scss\";"}]}]} +``` +--- diff --git a/internal/printer/__printer_json__/style_after_html_with_component_in_head_and_body.snap b/internal/printer/__printer_json__/style_after_html_with_component_in_head_and_body.snap new file mode 100755 index 000000000..4feedcbdc --- /dev/null +++ b/internal/printer/__printer_json__/style_after_html_with_component_in_head_and_body.snap @@ -0,0 +1,14 @@ + +[TestPrintToJSON/style_after_html_with_component_in_head_and_body - 1] +## Input + +``` +
    +``` + +## Output + +```json +{"type":"root","children":[{"type":"element","name":"html","attributes":[{"type":"attribute","kind":"quoted","name":"lang","value":"en","raw":"\"en\""}],"children":[{"type":"element","name":"head","attributes":[],"children":[{"type":"component","name":"BaseHead","attributes":[],"children":[]}]},{"type":"element","name":"body","attributes":[],"children":[{"type":"component","name":"Header","attributes":[],"children":[]}]}]},{"type":"element","name":"style","attributes":[],"children":[{"type":"text","value":"@use \"../styles/global.scss\";"}]}]} +``` +--- diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index 33511b3c9..0089ea34f 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -2166,22 +2166,18 @@ const c = '\'' { name: "style after empty html", source: ``, - want: []ASTNode{{Type: "element", Name: "html"}, {Type: "element", Name: "style"}}, }, { name: "style after html with component in head", source: ``, - want: []ASTNode{{Type: "element", Name: "html", Attributes: []ASTNode{{Type: "attribute", Kind: "quoted", Name: "lang", Value: "en", Raw: "\"en\""}}, Children: []ASTNode{{Type: "element", Name: "head", Children: []ASTNode{{Type: "component", Name: "BaseHead"}}}}}, {Type: "element", Name: "style", Children: []ASTNode{{Type: "text", Value: "@use \"../styles/global.scss\";"}}}}, }, { name: "style after html with component in head and body", source: `
    `, - want: []ASTNode{{Type: "element", Name: "html", Attributes: []ASTNode{{Type: "attribute", Kind: "quoted", Name: "lang", Value: "en", Raw: "\"en\""}}, Children: []ASTNode{{Type: "element", Name: "head", Children: []ASTNode{{Type: "component", Name: "BaseHead"}}}, {Type: "element", Name: "body", Children: []ASTNode{{Type: "component", Name: "Header"}}}}}, {Type: "element", Name: "style", Children: []ASTNode{{Type: "text", Value: "@use \"../styles/global.scss\";"}}}}, }, { name: "style after body with component in head and body", source: `
    `, - want: []ASTNode{{Type: "element", Name: "html", Attributes: []ASTNode{{Type: "attribute", Kind: "quoted", Name: "lang", Value: "en", Raw: "\"en\""}}, Children: []ASTNode{{Type: "element", Name: "head", Children: []ASTNode{{Type: "component", Name: "BaseHead"}}}, {Type: "element", Name: "body", Children: []ASTNode{{Type: "component", Name: "Header"}}}, {Type: "element", Name: "style", Children: []ASTNode{{Type: "text", Value: "@use \"../styles/global.scss\";"}}}}}}, }, { name: "style in html",