revert: SSR asset flag babel changes
This commit is contained in:
parent
4b1ad3c635
commit
92e641b849
3 changed files with 4 additions and 12 deletions
|
@ -4,7 +4,6 @@ import npath from 'path';
|
|||
import { normalizePath } from 'vite';
|
||||
import { resolveJsToTs } from '../core/util.js';
|
||||
import { HydrationDirectiveProps } from '../runtime/server/hydration.js';
|
||||
import { FLAG } from '../vite-plugin-asset-ssr/index.js';
|
||||
import type { PluginMetadata } from '../vite-plugin-astro/types';
|
||||
|
||||
const ClientOnlyPlaceholder = 'astro-client-only';
|
||||
|
@ -185,7 +184,7 @@ export default function astroJSX(): PluginObj {
|
|||
const node = path.node;
|
||||
// Skip automatic `_components` in MDX files
|
||||
if (
|
||||
(state.filename?.endsWith('.mdx') || state.filename?.endsWith('.mdx' + FLAG)) &&
|
||||
state.filename?.endsWith('.mdx') &&
|
||||
t.isJSXIdentifier(node.object) &&
|
||||
node.object.name === '_components'
|
||||
) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import path from 'path';
|
|||
import { error } from '../core/logger/core.js';
|
||||
import { parseNpmName } from '../core/util.js';
|
||||
import tagExportsPlugin from './tag.js';
|
||||
import { FLAG } from '../vite-plugin-asset-ssr/index.js';
|
||||
|
||||
type FixedCompilerOptions = TsConfigJson.CompilerOptions & {
|
||||
jsxImportSource?: string;
|
||||
|
@ -187,7 +186,7 @@ export default function jsx({ settings, logging }: AstroPluginJSXOptions): Plugi
|
|||
defaultJSXRendererEntry = [...jsxRenderersIntegrationOnly.entries()][0];
|
||||
},
|
||||
async transform(code, unresolvedId, opts) {
|
||||
let id = unresolvedId.endsWith(`.mdx${FLAG}`) ? unresolvedId.replace(FLAG, '') : unresolvedId;
|
||||
let id = unresolvedId;
|
||||
|
||||
const ssr = Boolean(opts?.ssr);
|
||||
if (!JSX_EXTENSIONS.has(path.extname(id))) {
|
||||
|
|
|
@ -15,8 +15,6 @@ import {
|
|||
} from './plugins.js';
|
||||
import { getFileInfo, handleExtendsNotSupported, parseFrontmatter } from './utils.js';
|
||||
|
||||
const FLAG = '?astro-asset-ssr';
|
||||
|
||||
const RAW_CONTENT_ERROR =
|
||||
'MDX does not support rawContent()! If you need to read the Markdown contents to calculate values (ex. reading time), we suggest injecting frontmatter via remark plugins. Learn more on our docs: https://docs.astro.build/en/guides/integrations-guide/mdx/#inject-frontmatter-via-remark-or-rehype-plugins';
|
||||
|
||||
|
@ -89,9 +87,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration {
|
|||
// Override transform to alter code before MDX compilation
|
||||
// ex. inject layouts
|
||||
async transform(_, unresolvedId) {
|
||||
let id = unresolvedId.endsWith(`.mdx${FLAG}`)
|
||||
? unresolvedId.replace(FLAG, '')
|
||||
: unresolvedId;
|
||||
let id = unresolvedId;
|
||||
if (!id.endsWith('mdx')) return;
|
||||
|
||||
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
|
||||
|
@ -118,9 +114,7 @@ export default function mdx(mdxOptions: MdxOptions = {}): AstroIntegration {
|
|||
name: '@astrojs/mdx-postprocess',
|
||||
// These transforms must happen *after* JSX runtime transformations
|
||||
transform(code, unresolvedId) {
|
||||
let id = unresolvedId.endsWith(`.mdx${FLAG}`)
|
||||
? unresolvedId.replace(FLAG, '')
|
||||
: unresolvedId;
|
||||
let id = unresolvedId;
|
||||
if (!id.endsWith('.mdx')) return;
|
||||
|
||||
// Ensures styles and scripts are injected into a `<head>`
|
||||
|
|
Loading…
Reference in a new issue