deprecate the markdown component in SSR (#3240)
This commit is contained in:
parent
78855ce892
commit
224c181cbd
2 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,13 @@ export interface Props {
|
|||
content?: string;
|
||||
}
|
||||
|
||||
// NOTE(fks): We are most likely moving this component out of Astro core
|
||||
// in a few weeks. Checking the name like this is a bit of a hack, but we
|
||||
// intentionally don't want to add an SSR flag for others to read from, just yet.
|
||||
if (Astro.redirect.name !== '_onlyAvailableInSSR') {
|
||||
console.error(`\x1B[31mThe <Markdown> component is not available in SSR. See https://github.com/withastro/rfcs/discussions/179 for more info.\x1B[39m`);
|
||||
}
|
||||
|
||||
const dedent = (str: string) => {
|
||||
const _str = str.split('\n').filter(s => s.trimStart().length > 0);
|
||||
if (_str.length === 0) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { createCanonicalURL, isCSSRequest } from './util.js';
|
|||
import { isScriptRequest } from './script.js';
|
||||
|
||||
function onlyAvailableInSSR(name: string) {
|
||||
return function () {
|
||||
return function _onlyAvailableInSSR() {
|
||||
// TODO add more guidance when we have docs and adapters.
|
||||
throw new Error(`Oops, you are trying to use ${name}, which is only available with SSR.`);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue