fix: ensure jsx does not reference server entrypoint (#4203)
Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
parent
6c9736cbc9
commit
ec376369a8
4 changed files with 9 additions and 4 deletions
5
.changeset/slimy-parrots-exist.md
Normal file
5
.changeset/slimy-parrots-exist.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Ensure JSX does not reference server entrypoint
|
|
@ -1,9 +1,10 @@
|
||||||
import type { PluginObj } from '@babel/core';
|
import type { PluginObj } from '@babel/core';
|
||||||
import * as t from '@babel/types';
|
import * as t from '@babel/types';
|
||||||
import { pathToFileURL } from 'node:url';
|
import { pathToFileURL } from 'node:url';
|
||||||
import { ClientOnlyPlaceholder } from '../runtime/server/index.js';
|
|
||||||
import type { PluginMetadata } from '../vite-plugin-astro/types';
|
import type { PluginMetadata } from '../vite-plugin-astro/types';
|
||||||
|
|
||||||
|
const ClientOnlyPlaceholder = 'astro-client-only';
|
||||||
|
|
||||||
function isComponent(tagName: string) {
|
function isComponent(tagName: string) {
|
||||||
return (
|
return (
|
||||||
(tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||
|
(tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||
|
||||||
|
|
|
@ -34,8 +34,6 @@ import { Renderer } from './render/index.js';
|
||||||
|
|
||||||
import { addAttribute } from './render/index.js';
|
import { addAttribute } from './render/index.js';
|
||||||
|
|
||||||
export const ClientOnlyPlaceholder = 'astro-client-only';
|
|
||||||
|
|
||||||
// Used in creating the component. aka the main export.
|
// Used in creating the component. aka the main export.
|
||||||
export function createComponent(cb: AstroComponentFactory) {
|
export function createComponent(cb: AstroComponentFactory) {
|
||||||
// Add a flag to this callback to mark it as an Astro component
|
// Add a flag to this callback to mark it as an Astro component
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { SSRResult } from '../../@types/astro.js';
|
import { SSRResult } from '../../@types/astro.js';
|
||||||
import { AstroJSX, isVNode } from '../../jsx-runtime/index.js';
|
import { AstroJSX, isVNode } from '../../jsx-runtime/index.js';
|
||||||
import {
|
import {
|
||||||
ClientOnlyPlaceholder,
|
|
||||||
escapeHTML,
|
escapeHTML,
|
||||||
HTMLString,
|
HTMLString,
|
||||||
markHTMLString,
|
markHTMLString,
|
||||||
|
@ -14,6 +13,8 @@ import {
|
||||||
voidElementNames,
|
voidElementNames,
|
||||||
} from './index.js';
|
} from './index.js';
|
||||||
|
|
||||||
|
const ClientOnlyPlaceholder = 'astro-client-only';
|
||||||
|
|
||||||
const skipAstroJSXCheck = new WeakSet();
|
const skipAstroJSXCheck = new WeakSet();
|
||||||
let originalConsoleError: any;
|
let originalConsoleError: any;
|
||||||
let consoleFilterRefs = 0;
|
let consoleFilterRefs = 0;
|
||||||
|
|
Loading…
Reference in a new issue