fix: ensure jsx does not reference server entrypoint (#4203)

Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
Nate Moore 2022-08-08 16:26:36 -05:00 committed by GitHub
parent 6c9736cbc9
commit ec376369a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Ensure JSX does not reference server entrypoint

View file

@ -1,9 +1,10 @@
import type { PluginObj } from '@babel/core';
import * as t from '@babel/types';
import { pathToFileURL } from 'node:url';
import { ClientOnlyPlaceholder } from '../runtime/server/index.js';
import type { PluginMetadata } from '../vite-plugin-astro/types';
const ClientOnlyPlaceholder = 'astro-client-only';
function isComponent(tagName: string) {
return (
(tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||

View file

@ -34,8 +34,6 @@ import { Renderer } 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.
export function createComponent(cb: AstroComponentFactory) {
// Add a flag to this callback to mark it as an Astro component

View file

@ -2,7 +2,6 @@
import { SSRResult } from '../../@types/astro.js';
import { AstroJSX, isVNode } from '../../jsx-runtime/index.js';
import {
ClientOnlyPlaceholder,
escapeHTML,
HTMLString,
markHTMLString,
@ -14,6 +13,8 @@ import {
voidElementNames,
} from './index.js';
const ClientOnlyPlaceholder = 'astro-client-only';
const skipAstroJSXCheck = new WeakSet();
let originalConsoleError: any;
let consoleFilterRefs = 0;