From 35c70fe9fef9095a779897090949998f4b85e732 Mon Sep 17 00:00:00 2001 From: Moustapha HappyDev Date: Mon, 9 Jun 2025 23:52:27 +0000 Subject: [PATCH 01/13] test: correct wrong test inputs --- internal/printer/__printer_js__/slot_with_fallback.snap | 2 +- internal/printer/printer_test.go | 2 +- internal/transform/transform_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/printer/__printer_js__/slot_with_fallback.snap b/internal/printer/__printer_js__/slot_with_fallback.snap index 45e425c8c..dcbf747a0 100755 --- a/internal/printer/__printer_js__/slot_with_fallback.snap +++ b/internal/printer/__printer_js__/slot_with_fallback.snap @@ -3,7 +3,7 @@ ## Input ``` -

Hello world!

+

Hello world!

``` ## Output diff --git a/internal/printer/printer_test.go b/internal/printer/printer_test.go index fedea94a3..ef736f3d1 100644 --- a/internal/printer/printer_test.go +++ b/internal/printer/printer_test.go @@ -185,7 +185,7 @@ func TestPrinter(t *testing.T) { }, { name: "slot with fallback", - source: `

Hello world!

`, + source: `

Hello world!

`, }, { name: "slot with fallback II", diff --git a/internal/transform/transform_test.go b/internal/transform/transform_test.go index 1da0cbe2b..961be6353 100644 --- a/internal/transform/transform_test.go +++ b/internal/transform/transform_test.go @@ -390,7 +390,7 @@ func TestCompactTransform(t *testing.T) { }, { name: "remove whitespace only", - source: ` `, + source: ` `, want: ``, }, { From 7efdc94ffbf84754e5ae41e3faa80adfecb2c068 Mon Sep 17 00:00:00 2001 From: Moustapha HappyDev Date: Mon, 9 Jun 2025 23:59:17 +0000 Subject: [PATCH 02/13] test: fix incorrectly closed tags in inputs --- .../Self-closing_components_in_head_can_have_siblings.snap | 2 +- .../__printer_js__/Self-closing_script_in_head_works.snap | 2 +- internal/printer/printer_test.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap b/internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap index e11dfd4ed..1624a4796 100755 --- a/internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap +++ b/internal/printer/__printer_js__/Self-closing_components_in_head_can_have_siblings.snap @@ -3,7 +3,7 @@ ## Input ``` - + ``` ## Output diff --git a/internal/printer/__printer_js__/Self-closing_script_in_head_works.snap b/internal/printer/__printer_js__/Self-closing_script_in_head_works.snap index ec156d5ec..bb6a9de31 100755 --- a/internal/printer/__printer_js__/Self-closing_script_in_head_works.snap +++ b/internal/printer/__printer_js__/Self-closing_script_in_head_works.snap @@ -3,7 +3,7 @@ ## 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` + + + + + + + A Basic HTML5 Template + + + + + + + + + + + + + + + +${$$renderHead($$result)} + + + + + +`; +}, undefined, undefined); +export default $$Component; +``` +--- diff --git a/internal/printer/__printer_js__/import.meta.env_-_with_exact_parsing.snap b/internal/printer/__printer_js__/import.meta.env_-_with_exact_parsing.snap new file mode 100755 index 000000000..97f0026f2 --- /dev/null +++ b/internal/printer/__printer_js__/import.meta.env_-_with_exact_parsing.snap @@ -0,0 +1,131 @@ + +[TestPrinter/import.meta.env_-_with_exact_parsing - 1] +## Input + +``` +/-/-/-/ +import Header from '../../components/Header.jsx' +import Footer from '../../components/Footer.astro' +import ProductPageContent from '../../components/ProductPageContent.jsx'; + +export async function getStaticPaths() { + let products = await fetch(`${import.meta.env.PUBLIC_NETLIFY_URL}/.netlify/functions/get-product-list`) + .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}, + }; + }); +} + +const { product } = Astro.props; +/-/-/-/ + + + + + + + Shoperoni | Buy {product.node.title} + + + + + +
+
+
+ +
+
+