diff --git a/packages/astro/src/jsx/babel.ts b/packages/astro/src/jsx/babel.ts index a9f91f973..925e26380 100644 --- a/packages/astro/src/jsx/babel.ts +++ b/packages/astro/src/jsx/babel.ts @@ -180,7 +180,11 @@ export default function astroJSX(): PluginObj { JSXMemberExpression(path, state) { const node = path.node; // Skip automatic `_components` in MDX files - if (state.filename?.endsWith('.mdx') && t.isJSXIdentifier(node.object) && node.object.name === '_components') { + if ( + state.filename?.endsWith('.mdx') && + t.isJSXIdentifier(node.object) && + node.object.name === '_components' + ) { return; } const parent = path.findParent((n) => t.isJSXElement(n))!; @@ -190,7 +194,7 @@ export default function astroJSX(): PluginObj { if (!hasClientDirective(parentNode)) return; const isClientOnly = isClientOnlyComponent(parentNode); if (tagName === ClientOnlyPlaceholder) return; - + const imports = state.get('imports') ?? new Map(); const namespace = tagName.split('.'); for (const [source, specs] of imports) { diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts index dd25c0593..96b1b8b6e 100644 --- a/packages/astro/src/runtime/server/astro-island.ts +++ b/packages/astro/src/runtime/server/astro-island.ts @@ -71,7 +71,7 @@ declare const Astro: { } else { this.Component = componentModule; for (const part of componentExport.split('.')) { - this.Component = this.Component[part] + this.Component = this.Component[part]; } } this.hydrator = hydrator; diff --git a/packages/integrations/mdx/test/mdx-namespace.test.js b/packages/integrations/mdx/test/mdx-namespace.test.js index ad9587640..486910ca2 100644 --- a/packages/integrations/mdx/test/mdx-namespace.test.js +++ b/packages/integrations/mdx/test/mdx-namespace.test.js @@ -24,7 +24,7 @@ describe('MDX Namespace', () => { const component = document.querySelector('#component'); expect(island).not.undefined; - expect(component.textContent).equal('Hello world') + expect(component.textContent).equal('Hello world'); }); it('works for star', async () => { @@ -35,7 +35,7 @@ describe('MDX Namespace', () => { const component = document.querySelector('#component'); expect(island).not.undefined; - expect(component.textContent).equal('Hello world') + expect(component.textContent).equal('Hello world'); }); }); @@ -62,7 +62,7 @@ describe('MDX Namespace', () => { const component = document.querySelector('#component'); expect(island).not.undefined; - expect(component.textContent).equal('Hello world') + expect(component.textContent).equal('Hello world'); }); it('works for star', async () => { @@ -77,7 +77,7 @@ describe('MDX Namespace', () => { const component = document.querySelector('#component'); expect(island).not.undefined; - expect(component.textContent).equal('Hello world') + expect(component.textContent).equal('Hello world'); }); }); });