Skip to content

Commit ec37636

Browse files
authored
fix: ensure jsx does not reference server entrypoint (#4203)
Co-authored-by: Nate Moore <[email protected]>
1 parent 6c9736c commit ec37636

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.changeset/slimy-parrots-exist.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Ensure JSX does not reference server entrypoint

packages/astro/src/jsx/babel.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type { PluginObj } from '@babel/core';
22
import * as t from '@babel/types';
33
import { pathToFileURL } from 'node:url';
4-
import { ClientOnlyPlaceholder } from '../runtime/server/index.js';
54
import type { PluginMetadata } from '../vite-plugin-astro/types';
65

6+
const ClientOnlyPlaceholder = 'astro-client-only';
7+
78
function isComponent(tagName: string) {
89
return (
910
(tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||

packages/astro/src/runtime/server/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ import { Renderer } from './render/index.js';
3434

3535
import { addAttribute } from './render/index.js';
3636

37-
export const ClientOnlyPlaceholder = 'astro-client-only';
38-
3937
// Used in creating the component. aka the main export.
4038
export function createComponent(cb: AstroComponentFactory) {
4139
// Add a flag to this callback to mark it as an Astro component

packages/astro/src/runtime/server/jsx.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { SSRResult } from '../../@types/astro.js';
33
import { AstroJSX, isVNode } from '../../jsx-runtime/index.js';
44
import {
5-
ClientOnlyPlaceholder,
65
escapeHTML,
76
HTMLString,
87
markHTMLString,
@@ -14,6 +13,8 @@ import {
1413
voidElementNames,
1514
} from './index.js';
1615

16+
const ClientOnlyPlaceholder = 'astro-client-only';
17+
1718
const skipAstroJSXCheck = new WeakSet();
1819
let originalConsoleError: any;
1920
let consoleFilterRefs = 0;

0 commit comments

Comments
 (0)