diff options
author | 2022-05-03 17:08:53 -0700 | |
---|---|---|
committer | 2022-05-03 17:08:53 -0700 | |
commit | 224c181cbdce101f14c6335377300bc7174ba23f (patch) | |
tree | ce826d231d21b78d5a752b3e74752d75284e0769 | |
parent | 78855ce8922a5649813a750bc9fa65aa1112f173 (diff) | |
download | astro-224c181cbdce101f14c6335377300bc7174ba23f.tar.gz astro-224c181cbdce101f14c6335377300bc7174ba23f.tar.zst astro-224c181cbdce101f14c6335377300bc7174ba23f.zip |
deprecate the markdown component in SSR (#3240)
-rw-r--r-- | packages/astro/components/Markdown.astro | 7 | ||||
-rw-r--r-- | packages/astro/src/core/render/result.ts | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/packages/astro/components/Markdown.astro b/packages/astro/components/Markdown.astro index b7fbdf3cb..a88fdbf34 100644 --- a/packages/astro/components/Markdown.astro +++ b/packages/astro/components/Markdown.astro @@ -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) { diff --git a/packages/astro/src/core/render/result.ts b/packages/astro/src/core/render/result.ts index 3a8a71235..358bef7e0 100644 --- a/packages/astro/src/core/render/result.ts +++ b/packages/astro/src/core/render/result.ts @@ -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.`); }; |