diff --git a/.changeset/grumpy-days-yell.md b/.changeset/grumpy-days-yell.md new file mode 100644 index 0000000000000..5cc00ff54b7ec --- /dev/null +++ b/.changeset/grumpy-days-yell.md @@ -0,0 +1,9 @@ +--- +'astro': major +--- + +Removes support for astroFlavoredMarkdown + +In 1.0 Astro moved the old Astro Flavored Markdown (also sometimes called Components in Markdown) to a legacy feature. This change removes the `legacy.astroFlavoredMarkdown` option completely. + +In 2.0 this feature will not be available in Astro at all. We recommend migration to MDX for those were still using this feature in 1.x. diff --git a/.changeset/lovely-worms-invite.md b/.changeset/lovely-worms-invite.md new file mode 100644 index 0000000000000..d081d2b799339 --- /dev/null +++ b/.changeset/lovely-worms-invite.md @@ -0,0 +1,8 @@ +--- +'@astrojs/deno': major +'@astrojs/netlify': major +'@astrojs/image': minor +'astro': major +--- + +Builds chunks into the `assets` folder. This simplifies configuring immutable caching with your adapter provider as all files are now in the same `assets` folder. diff --git a/.changeset/thick-walls-smell.md b/.changeset/thick-walls-smell.md new file mode 100644 index 0000000000000..d343fe7efee3e --- /dev/null +++ b/.changeset/thick-walls-smell.md @@ -0,0 +1,6 @@ +--- +'astro': major +'@astrojs/tailwind': major +--- + +Remove `style.postcss` Astro config. Refactor tailwind integration to configure through `vite` instead. Also disables `autoprefixer` in dev. diff --git a/packages/astro/e2e/fixtures/preact-compat-component/astro.config.mjs b/packages/astro/e2e/fixtures/preact-compat-component/astro.config.mjs index 2cd3777637531..7d2c8a855d1d5 100644 --- a/packages/astro/e2e/fixtures/preact-compat-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/preact-compat-component/astro.config.mjs @@ -3,8 +3,5 @@ import preact from '@astrojs/preact'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [preact({ compat: true })], }); diff --git a/packages/astro/e2e/fixtures/preact-compat-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/preact-compat-component/src/pages/markdown.md deleted file mode 100644 index 7c521de772fbb..0000000000000 --- a/packages/astro/e2e/fixtures/preact-compat-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.jsx'; - import PreactComponent from '../components/JSXComponent.jsx'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/fixtures/preact-component/astro.config.mjs b/packages/astro/e2e/fixtures/preact-component/astro.config.mjs index bcaa451eb910b..7a8aef52144b0 100644 --- a/packages/astro/e2e/fixtures/preact-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/preact-component/astro.config.mjs @@ -4,8 +4,5 @@ import mdx from '@astrojs/mdx'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [preact(), mdx()], }); diff --git a/packages/astro/e2e/fixtures/preact-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/preact-component/src/pages/markdown.md deleted file mode 100644 index 7c521de772fbb..0000000000000 --- a/packages/astro/e2e/fixtures/preact-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.jsx'; - import PreactComponent from '../components/JSXComponent.jsx'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/fixtures/react-component/astro.config.mjs b/packages/astro/e2e/fixtures/react-component/astro.config.mjs index badddf1d39226..5c044b69d5521 100644 --- a/packages/astro/e2e/fixtures/react-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/react-component/astro.config.mjs @@ -4,8 +4,5 @@ import mdx from '@astrojs/mdx'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [react(), mdx()], }); diff --git a/packages/astro/e2e/fixtures/react-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/react-component/src/pages/markdown.md deleted file mode 100644 index fbc685a5befda..0000000000000 --- a/packages/astro/e2e/fixtures/react-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.jsx'; - import ReactComponent from '../components/JSXComponent.jsx'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/fixtures/solid-component/astro.config.mjs b/packages/astro/e2e/fixtures/solid-component/astro.config.mjs index 35d38c8f1566d..f527c69b4ab3b 100644 --- a/packages/astro/e2e/fixtures/solid-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/solid-component/astro.config.mjs @@ -4,8 +4,5 @@ import solid from '@astrojs/solid-js'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [solid(), mdx()], }); diff --git a/packages/astro/e2e/fixtures/solid-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/solid-component/src/pages/markdown.md deleted file mode 100644 index 21a779c9d8172..0000000000000 --- a/packages/astro/e2e/fixtures/solid-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.jsx'; - import SolidComponent from '../components/SolidComponent.jsx'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/fixtures/svelte-component/astro.config.mjs b/packages/astro/e2e/fixtures/svelte-component/astro.config.mjs index 99f557d4373b8..bc5c6c9bb9a7e 100644 --- a/packages/astro/e2e/fixtures/svelte-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/svelte-component/astro.config.mjs @@ -4,8 +4,5 @@ import mdx from '@astrojs/mdx'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [svelte(), mdx()], }); diff --git a/packages/astro/e2e/fixtures/svelte-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/svelte-component/src/pages/markdown.md deleted file mode 100644 index ebc4d87955ec1..0000000000000 --- a/packages/astro/e2e/fixtures/svelte-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.svelte'; - import SvelteComponent from '../components/SvelteComponent.svelte'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/fixtures/vue-component/astro.config.mjs b/packages/astro/e2e/fixtures/vue-component/astro.config.mjs index 84c024e68fe9e..9a3f1272790c5 100644 --- a/packages/astro/e2e/fixtures/vue-component/astro.config.mjs +++ b/packages/astro/e2e/fixtures/vue-component/astro.config.mjs @@ -4,9 +4,6 @@ import mdx from '@astrojs/mdx'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [ mdx(), vue({ diff --git a/packages/astro/e2e/fixtures/vue-component/src/pages/markdown.md b/packages/astro/e2e/fixtures/vue-component/src/pages/markdown.md deleted file mode 100644 index 3ae0470aff4cc..0000000000000 --- a/packages/astro/e2e/fixtures/vue-component/src/pages/markdown.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: ../components/Layout.astro -setup: | - import Counter from '../components/Counter.vue'; - import VueComponent from '../components/VueComponent.vue'; - - const someProps = { - count: 0, - }; ---- - - - # Hello, server! - - - - # Hello, client:idle! - - - - # Hello, client:load! - - - - # Hello, client:visible! - - - - # Hello, client:media! - - - diff --git a/packages/astro/e2e/preact-compat-component.test.js b/packages/astro/e2e/preact-compat-component.test.js index 0798a30edfd27..e1b603e7fb39c 100644 --- a/packages/astro/e2e/preact-compat-component.test.js +++ b/packages/astro/e2e/preact-compat-component.test.js @@ -14,11 +14,3 @@ test.describe('preact/compat components in Astro files', () => { pageSourceFilePath: './src/pages/index.astro', }); }); - -test.describe('preact/compat components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); diff --git a/packages/astro/e2e/preact-component.test.js b/packages/astro/e2e/preact-component.test.js index dfd4993da78cb..d808b489003c7 100644 --- a/packages/astro/e2e/preact-component.test.js +++ b/packages/astro/e2e/preact-component.test.js @@ -15,14 +15,6 @@ test.describe('Preact components in Astro files', () => { }); }); -test.describe('Preact components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); - test.describe('Preact components in MDX files', () => { createTests({ ...config, diff --git a/packages/astro/e2e/react-component.test.js b/packages/astro/e2e/react-component.test.js index 8eb10a7edb92c..00d747079a711 100644 --- a/packages/astro/e2e/react-component.test.js +++ b/packages/astro/e2e/react-component.test.js @@ -16,14 +16,6 @@ test.describe('React components in Astro files', () => { }); }); -test.describe('React components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); - test.describe('React components in MDX files', () => { createTests({ ...config, diff --git a/packages/astro/e2e/solid-component.test.js b/packages/astro/e2e/solid-component.test.js index aa8d356cd4408..7a195c9b12671 100644 --- a/packages/astro/e2e/solid-component.test.js +++ b/packages/astro/e2e/solid-component.test.js @@ -15,14 +15,6 @@ test.describe('Solid components in Astro files', () => { }); }); -test.describe('Solid components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); - test.describe('Solid components in MDX files', () => { createTests({ ...config, diff --git a/packages/astro/e2e/svelte-component.test.js b/packages/astro/e2e/svelte-component.test.js index 260c8e83dfad6..d267aeafea132 100644 --- a/packages/astro/e2e/svelte-component.test.js +++ b/packages/astro/e2e/svelte-component.test.js @@ -16,14 +16,6 @@ test.describe('Svelte components in Astro files', () => { }); }); -test.describe('Svelte components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); - test.describe('Svelte components in MDX files', () => { createTests({ ...config, diff --git a/packages/astro/e2e/vue-component.test.js b/packages/astro/e2e/vue-component.test.js index 55221878049ac..0cc41c74eb2b4 100644 --- a/packages/astro/e2e/vue-component.test.js +++ b/packages/astro/e2e/vue-component.test.js @@ -16,14 +16,6 @@ test.describe('Vue components in Astro files', () => { }); }); -test.describe('Vue components in Markdown files', () => { - createTests({ - ...config, - pageUrl: '/markdown/', - pageSourceFilePath: './src/pages/markdown.md', - }); -}); - test.describe('Vue components in MDX files', () => { createTests({ ...config, diff --git a/packages/astro/package.json b/packages/astro/package.json index a087d6cf280da..8f30610828e0b 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -109,7 +109,7 @@ "test:e2e:match": "playwright test -g" }, "dependencies": { - "@astrojs/compiler": "^0.31.0", + "@astrojs/compiler": "^0.31.4", "@astrojs/language-server": "^0.28.3", "@astrojs/markdown-remark": "^2.0.0-beta.0", "@astrojs/telemetry": "^1.0.1", diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 8a8c87c4f4710..7b8968f93c3ba 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -870,30 +870,7 @@ export interface AstroUserConfig { * These flags allow you to opt in to some deprecated or otherwise outdated behavior of Astro * in the latest version, so that you can continue to upgrade and take advantage of new Astro releases. */ - legacy?: { - /** - * @docs - * @name legacy.astroFlavoredMarkdown - * @type {boolean} - * @default `false` - * @version 1.0.0-rc.1 - * @description - * Enable Astro's pre-v1.0 support for components and JSX expressions in `.md` (and alternative extensions for markdown files like ".markdown") Markdown files. - * In Astro `1.0.0-rc`, this original behavior was removed as the default, in favor of our new [MDX integration](https://docs.astro.build/en/guides/integrations-guide/mdx/). - * - * To enable this behavior, set `legacy.astroFlavoredMarkdown` to `true` in your [`astro.config.mjs` configuration file](https://docs.astro.build/en/guides/configuring-astro/#the-astro-config-file). - * - * ```js - * { - * legacy: { - * // Example: Add support for legacy Markdown features - * astroFlavoredMarkdown: true, - * }, - * } - * ``` - */ - astroFlavoredMarkdown?: boolean; - }; + legacy?: object; /** * @docs diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 0dd1a1bbac99e..047831860a05e 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -349,7 +349,6 @@ async function generatePath( logging, markdown: { ...settings.config.markdown, - isAstroFlavoredMd: settings.config.legacy.astroFlavoredMarkdown, isExperimentalContentCollections: settings.config.experimental.contentCollections, contentDir: getContentPaths(settings.config).contentDir, }, diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index cfb447eb92b58..25ff1f5f63cd0 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -212,8 +212,8 @@ async function clientBuild( input: Array.from(input), output: { format: 'esm', - entryFileNames: '[name].[hash].js', - chunkFileNames: 'chunks/[name].[hash].js', + entryFileNames: 'assets/[name].[hash].js', + chunkFileNames: 'assets/chunks/[name].[hash].js', assetFileNames: 'assets/[name].[hash][extname]', ...viteConfig.build?.rollupOptions?.output, }, diff --git a/packages/astro/src/core/build/vite-plugin-ssr.ts b/packages/astro/src/core/build/vite-plugin-ssr.ts index be8280f385f69..d9df28af227e0 100644 --- a/packages/astro/src/core/build/vite-plugin-ssr.ts +++ b/packages/astro/src/core/build/vite-plugin-ssr.ts @@ -210,7 +210,6 @@ function buildManifest( base: settings.config.base, markdown: { ...settings.config.markdown, - isAstroFlavoredMd: settings.config.legacy.astroFlavoredMarkdown, isExperimentalContentCollections: settings.config.experimental.contentCollections, contentDir: getContentPaths(settings.config).contentDir, }, diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index e0fa3df3cb7c1..a4dccb9940ae1 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -30,16 +30,13 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = { port: 3000, streaming: true, }, - style: { postcss: { options: {}, plugins: [] } }, integrations: [], markdown: { drafts: false, ...markdownConfigDefaults, }, vite: {}, - legacy: { - astroFlavoredMarkdown: false, - }, + legacy: {}, experimental: { contentCollections: false, }, @@ -127,18 +124,6 @@ export const AstroConfigSchema = z.object({ .optional() .default({}) ), - style: z - .object({ - postcss: z - .object({ - options: z.any(), - plugins: z.array(z.any()), - }) - .optional() - .default(ASTRO_CONFIG_DEFAULTS.style.postcss), - }) - .optional() - .default({}), markdown: z .object({ drafts: z.boolean().default(false), @@ -192,15 +177,7 @@ export const AstroConfigSchema = z.object({ }) .optional() .default({}), - legacy: z - .object({ - astroFlavoredMarkdown: z - .boolean() - .optional() - .default(ASTRO_CONFIG_DEFAULTS.legacy.astroFlavoredMarkdown), - }) - .optional() - .default({}), + legacy: z.object({}).optional().default({}), }); interface PostCSSConfigResult { @@ -300,21 +277,6 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: URL) { .optional() .default({}) ), - style: z - .object({ - postcss: z.preprocess( - (val) => resolvePostcssConfig(val, fileProtocolRoot), - z - .object({ - options: z.any(), - plugins: z.array(z.any()), - }) - .optional() - .default(ASTRO_CONFIG_DEFAULTS.style.postcss) - ), - }) - .optional() - .default({}), }).transform((config) => { // If the user changed outDir but not build.server, build.config, adjust so those // are relative to the outDir, as is the expected default. diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 0e1b48e2dd99e..351ea631815fe 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -20,7 +20,6 @@ import htmlVitePlugin from '../vite-plugin-html/index.js'; import astroIntegrationsContainerPlugin from '../vite-plugin-integrations-container/index.js'; import jsxVitePlugin from '../vite-plugin-jsx/index.js'; import astroLoadFallbackPlugin from '../vite-plugin-load-fallback/index.js'; -import legacyMarkdownVitePlugin from '../vite-plugin-markdown-legacy/index.js'; import markdownVitePlugin from '../vite-plugin-markdown/index.js'; import astroScannerPlugin from '../vite-plugin-scanner/index.js'; import astroScriptsPlugin from '../vite-plugin-scripts/index.js'; @@ -110,9 +109,7 @@ export async function createVite( // the build to run very slow as the filewatcher is triggered often. mode !== 'build' && vitePluginAstroServer({ settings, logging, fs }), envVitePlugin({ settings }), - settings.config.legacy.astroFlavoredMarkdown - ? legacyMarkdownVitePlugin({ settings, logging }) - : markdownVitePlugin({ settings, logging }), + markdownVitePlugin({ settings, logging }), htmlVitePlugin(), jsxVitePlugin({ settings, logging }), astroPostprocessVitePlugin({ settings }), @@ -150,9 +147,6 @@ export async function createVite( ignored: mode === 'build' ? ['**'] : undefined, }, }, - css: { - postcss: settings.config.style.postcss || {}, - }, resolve: { alias: [ { diff --git a/packages/astro/src/core/errors/README.md b/packages/astro/src/core/errors/README.md index af2c05b9ef7b3..2e6ffb3ae8268 100644 --- a/packages/astro/src/core/errors/README.md +++ b/packages/astro/src/core/errors/README.md @@ -5,7 +5,7 @@ ## Writing error messages for Astro ### Tips - + **Error Format** Name (key of the object definition): @@ -56,6 +56,17 @@ If you are unsure about which error code to choose, ask [Erika](https://github.c - **Error codes and names are permanent**, and should never be changed, nor deleted. Users should always be able to find an error by searching, and this ensures a matching result. When an error is no longer relevant, it should be deprecated, not removed. - Contextual information may be used to enhance the message or the hint. However, the code that caused the error or the position of the error should not be included in the message as they will already be shown as part of the error. - Do not prefix `title`, `message` and `hint` with descriptive words such as "Error:" or "Hint:" as it may lead to duplicated labels in the UI / CLI. +- Dynamic error messages must use the following shape: + +```js +message: (arguments) => `text ${substitute}` +``` + +Please avoid including too much logic inside the errors if you can. The last thing you want is for a bug to happen inside what's already an error! + +If the different arguments needs processing before being shown (ex: `toString`, `JSON.stringify`), the processing should happen where the error is thrown and not inside the message itself. + +Using light logic to add / remove different parts of the message is okay, however make sure to include a `@message` tag in the JSDoc comment for the auto-generated documentation. See below for more information. ### Documentation support through JSDoc @@ -89,7 +100,7 @@ The `@message` property is intended to provide slightly more context when it is Error are a reactive strategy. They are the last line of defense against a mistake. -While adding a new error message, ask yourself, "Was there a way this situation could've been avoided in the first place?" (docs, editor tooling etc). +While adding a new error message, ask yourself, "Was there a way this situation could've been avoided in the first place?" (docs, editor tooling etc). **If you can prevent the error, you don't need an error message!** diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index e75985651db80..57aad4e8ae20b 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -70,7 +70,7 @@ export function enhanceViteSSRError({ ) { safeError = new AstroError({ ...AstroErrorData.MdxIntegrationMissingError, - message: AstroErrorData.MdxIntegrationMissingError.message(fileId), + message: AstroErrorData.MdxIntegrationMissingError.message(JSON.stringify(fileId)), location: safeError.loc, stack: safeError.stack, }) as ErrorWithMetadata; diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index 333134c2d1278..d33690ff8172f 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -544,11 +544,8 @@ See https://docs.astro.build/en/guides/server-side-rendering/ for more informati MdxIntegrationMissingError: { title: 'MDX integration missing.', code: 6004, - message: (id: string) => { - return `Unable to render ${JSON.stringify( - id - )}. Ensure that the \`@astrojs/mdx\` integration is installed.`; - }, + message: (file: string) => + `Unable to render ${file}. Ensure that the \`@astrojs/mdx\` integration is installed.`, hint: 'See the MDX integration docs for installation and usage instructions: https://docs.astro.build/en/guides/integrations-guide/mdx/', }, // Config Errors - 7xxx diff --git a/packages/astro/src/core/render/dev/environment.ts b/packages/astro/src/core/render/dev/environment.ts index 58a126b023603..c12495bf5c0ae 100644 --- a/packages/astro/src/core/render/dev/environment.ts +++ b/packages/astro/src/core/render/dev/environment.ts @@ -24,7 +24,6 @@ export function createDevelopmentEnvironment( logging, markdown: { ...settings.config.markdown, - isAstroFlavoredMd: settings.config.legacy.astroFlavoredMarkdown, isExperimentalContentCollections: settings.config.experimental.contentCollections, contentDir: getContentPaths(settings.config).contentDir, }, diff --git a/packages/astro/src/vite-plugin-markdown-legacy/README.md b/packages/astro/src/vite-plugin-markdown-legacy/README.md deleted file mode 100644 index ee7fd0e54793a..0000000000000 --- a/packages/astro/src/vite-plugin-markdown-legacy/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# vite-plugin-markdown-legacy - -Adds Markdown support to Vite, both at the top level as well as within `.astro` files. diff --git a/packages/astro/src/vite-plugin-markdown-legacy/index.ts b/packages/astro/src/vite-plugin-markdown-legacy/index.ts deleted file mode 100644 index 4691957f5fcbc..0000000000000 --- a/packages/astro/src/vite-plugin-markdown-legacy/index.ts +++ /dev/null @@ -1,265 +0,0 @@ -import { renderMarkdown } from '@astrojs/markdown-remark'; -import fs from 'fs'; -import matter from 'gray-matter'; -import { fileURLToPath } from 'url'; -import { Plugin, ResolvedConfig, transformWithEsbuild } from 'vite'; -import type { AstroSettings } from '../@types/astro'; -import { getContentPaths } from '../content/index.js'; -import { pagesVirtualModuleId } from '../core/app/index.js'; -import { cachedCompilation, CompileProps } from '../core/compile/index.js'; -import { AstroErrorData, MarkdownError } from '../core/errors/index.js'; -import type { LogOptions } from '../core/logger/core.js'; -import { isMarkdownFile } from '../core/util.js'; -import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types'; -import { getFileInfo, normalizeFilename } from '../vite-plugin-utils/index.js'; - -interface AstroPluginOptions { - settings: AstroSettings; - logging: LogOptions; -} - -const MARKDOWN_IMPORT_FLAG = '?mdImport'; -const MARKDOWN_CONTENT_FLAG = '?content'; - -function safeMatter(source: string, id: string) { - try { - return matter(source); - } catch (err: any) { - const markdownError = new MarkdownError({ - code: AstroErrorData.UnknownMarkdownError.code, - message: err.message, - stack: err.stack, - location: { - file: id, - }, - }); - - if (err.name === 'YAMLException') { - markdownError.setErrorCode(AstroErrorData.MarkdownFrontmatterParseError.code); - markdownError.setLocation({ - file: id, - line: err.mark.line, - column: err.mark.column, - }); - - markdownError.setMessage(err.reason); - } - - throw markdownError; - } -} - -// Both end up connecting a `load()` hook to the Astro compiler, and share some copy-paste -// logic in how that is done. -export default function markdown({ settings }: AstroPluginOptions): Plugin { - const { config } = settings; - - // Weird Vite behavior: Vite seems to use a fake "index.html" importer when you - // have `enforce: pre`. This can probably be removed once the vite issue is fixed. - // see: https://github.com/vitejs/vite/issues/5981 - const fakeRootImporter = fileURLToPath(new URL('index.html', config.root)); - function isRootImport(importer: string | undefined) { - if (!importer) { - return true; - } - if (importer === fakeRootImporter) { - return true; - } - if (importer === '\0' + pagesVirtualModuleId) { - return true; - } - return false; - } - - let resolvedConfig: ResolvedConfig; - - return { - name: 'astro:markdown', - enforce: 'pre', - async resolveId(id, importer, options) { - // Resolve any .md (or alternative extensions of markdown files like .markdown) files with the `?content` cache buster. This should only come from - // an already-resolved JS module wrapper. Needed to prevent infinite loops in Vite. - // Unclear if this is expected or if cache busting is just working around a Vite bug. - if (isMarkdownFile(id, { suffix: MARKDOWN_CONTENT_FLAG })) { - const resolvedId = await this.resolve(id, importer, { skipSelf: true, ...options }); - return resolvedId?.id.replace(MARKDOWN_CONTENT_FLAG, ''); - } - // If the markdown file is imported from another file via ESM, resolve a JS representation - // that defers the markdown -> HTML rendering until it is needed. This is especially useful - // when fetching and then filtering many markdown files, like with import.meta.glob() or Astro.glob(). - // Otherwise, resolve directly to the actual component. - if (isMarkdownFile(id) && !isRootImport(importer)) { - const resolvedId = await this.resolve(id, importer, { skipSelf: true, ...options }); - if (resolvedId) { - return resolvedId.id + MARKDOWN_IMPORT_FLAG; - } - } - // In all other cases, we do nothing and rely on normal Vite resolution. - return undefined; - }, - async load(id, opts) { - // A markdown file has been imported via ESM! - // Return the file's JS representation, including all Markdown - // frontmatter and a deferred `import() of the compiled markdown content. - if (isMarkdownFile(id, { suffix: MARKDOWN_IMPORT_FLAG })) { - const { fileId, fileUrl } = getFileInfo(id, config); - - const source = await fs.promises.readFile(fileId, 'utf8'); - const { data: frontmatter, content: rawContent } = safeMatter(source, fileId); - return { - code: ` - // Static - export const frontmatter = ${escapeViteEnvReferences(JSON.stringify(frontmatter))}; - export const file = ${JSON.stringify(fileId)}; - export const url = ${JSON.stringify(fileUrl)}; - export function rawContent() { - return ${escapeViteEnvReferences(JSON.stringify(rawContent))}; - } - export async function compiledContent() { - return load().then((m) => m.compiledContent()); - } - - // Deferred - export default async function load() { - return (await import(${JSON.stringify(fileId + MARKDOWN_CONTENT_FLAG)})); - } - export function Content(...args) { - return load().then((m) => m.default(...args)); - } - Content.isAstroComponentFactory = true; - export function getHeadings() { - return load().then((m) => m.metadata.headings); - } - export function getHeaders() { - console.warn('getHeaders() have been deprecated. Use getHeadings() function instead.'); - return load().then((m) => m.metadata.headings); - };`, - map: null, - }; - } - - // A markdown file is being rendered! This markdown file was either imported - // directly as a page in Vite, or it was a deferred render from a JS module. - // This returns the compiled markdown -> astro component that renders to HTML. - if (isMarkdownFile(id)) { - const filename = normalizeFilename(id, config); - const source = await fs.promises.readFile(filename, 'utf8'); - const renderOpts = config.markdown; - - const fileUrl = new URL(`file://${filename}`); - - // Extract special frontmatter keys - let { data: frontmatter, content: markdownContent } = safeMatter(source, filename); - - // Turn HTML comments into JS comments while preventing nested `*/` sequences - // from ending the JS comment by injecting a zero-width space - // Inside code blocks, this is removed during renderMarkdown by the remark-escape plugin. - markdownContent = markdownContent.replace( - /<\s*!--([^-->]*)(.*?)-->/gs, - (whole) => `{/*${whole.replace(/\*\//g, '*\u200b/')}*/}` - ); - - let renderResult = await renderMarkdown(markdownContent, { - ...renderOpts, - fileURL: fileUrl, - isAstroFlavoredMd: true, - isExperimentalContentCollections: settings.config.experimental.contentCollections, - contentDir: getContentPaths(settings.config).contentDir, - } as any); - let { code: astroResult, metadata } = renderResult; - const { layout = '', components = '', setup = '', ...content } = frontmatter; - content.astro = metadata; - content.url = getFileInfo(id, config).fileUrl; - content.file = filename; - - const prelude = `--- -import Slugger from 'github-slugger'; -${layout ? `import Layout from ${JSON.stringify(layout)};` : ''} -${components ? `import * from ${JSON.stringify(components)};` : ''} -${setup} - -const slugger = new Slugger(); -function $$slug(value) { - return slugger.slug(value); -} - -const $$content = ${JSON.stringify(content)}; - -Object.defineProperty($$content.astro, 'headers', { - get() { - console.warn('[${JSON.stringify(id)}] content.astro.headers is now content.astro.headings.'); - return this.headings; - } -}); ----`; - - const imports = `${layout ? `import Layout from ${JSON.stringify(layout)};` : ''} -${setup}`.trim(); - - // If the user imported "Layout", wrap the content in a Layout - if (/\bLayout\b/.test(imports)) { - astroResult = `${prelude}\n\n\n${astroResult}\n\n`; - } else { - // Note: without a Layout, we need to inject `head` manually so `maybeRenderHead` runs - astroResult = `${prelude}\n${astroResult}`; - } - - // Transform from `.astro` to valid `.ts` - const compileProps: CompileProps = { - astroConfig: config, - viteConfig: resolvedConfig, - filename, - source: astroResult, - id, - }; - - let transformResult = await cachedCompilation(compileProps); - let { code: tsResult } = transformResult; - - tsResult = `\nexport const metadata = ${JSON.stringify(metadata)}; -export const frontmatter = ${JSON.stringify(content)}; -export function rawContent() { - return ${JSON.stringify(markdownContent)}; -} -export function compiledContent() { - return ${JSON.stringify(renderResult.metadata.html)}; -} -${tsResult}`; - - // Compile from `.ts` to `.js` - const { code } = await transformWithEsbuild(tsResult, id, { - loader: 'ts', - sourcemap: false, - }); - - const astroMetadata: AstroPluginMetadata['astro'] = { - clientOnlyComponents: transformResult.clientOnlyComponents, - hydratedComponents: transformResult.hydratedComponents, - scripts: transformResult.scripts, - propagation: 'none', - pageOptions: {}, - }; - - return { - code: escapeViteEnvReferences(code), - map: null, - meta: { - astro: astroMetadata, - vite: { - lang: 'ts', - }, - }, - }; - } - - return null; - }, - }; -} - -// Converts the first dot in `import.meta.env` to its Unicode escape sequence, -// which prevents Vite from replacing strings like `import.meta.env.SITE` -// in our JS representation of loaded Markdown files -function escapeViteEnvReferences(code: string) { - return code.replace(/import\.meta\.env/g, 'import\\u002Emeta.env'); -} diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts index fb2725763005e..10e4cb8c0743c 100644 --- a/packages/astro/src/vite-plugin-markdown/index.ts +++ b/packages/astro/src/vite-plugin-markdown/index.ts @@ -91,7 +91,7 @@ export default function markdown({ settings, logging }: AstroPluginOptions): Plu warn( logging, 'markdown', - `[${id}] Astro now supports MDX! Support for components in ".md" (or alternative extensions like ".markdown") files using the "setup" frontmatter is no longer enabled by default. Migrate this file to MDX or add the "legacy.astroFlavoredMarkdown" config flag to re-enable support.` + `[${id}] Astro now supports MDX! Support for components in ".md" (or alternative extensions like ".markdown") files using the "setup" frontmatter is no longer enabled by default. Migrate this file to MDX.` ); } diff --git a/packages/astro/test/astro-dynamic.test.js b/packages/astro/test/astro-dynamic.test.js index 6f3c321984afd..78c5679a2bd61 100644 --- a/packages/astro/test/astro-dynamic.test.js +++ b/packages/astro/test/astro-dynamic.test.js @@ -75,6 +75,6 @@ describe('Dynamic components subpath', () => { expect($('astro-island').html()).to.equal(''); // test 2: has component url const attr = $('astro-island').attr('component-url'); - expect(attr).to.include(`blog/PersistentCounter`); + expect(attr).to.include(`blog/assets/PersistentCounter`); }); }); diff --git a/packages/astro/test/astro-envs.test.js b/packages/astro/test/astro-envs.test.js index bb73542049cee..534604f704bd6 100644 --- a/packages/astro/test/astro-envs.test.js +++ b/packages/astro/test/astro-envs.test.js @@ -52,7 +52,8 @@ describe('Environment Variables', () => { }); it('includes public env in client-side JS', async () => { - let dirs = await fixture.readdir('/'); + let dirs = await fixture.readdir('/assets'); + console.log(dirs); let found = false; // Look in all of the .js files to see if the public env is inlined. @@ -61,7 +62,7 @@ describe('Environment Variables', () => { await Promise.all( dirs.map(async (path) => { if (path.endsWith('.js')) { - let js = await fixture.readFile(`/${path}`); + let js = await fixture.readFile(`/assets/${path}`); if (js.includes('BLUE_BAYOU')) { found = true; } diff --git a/packages/astro/test/astro-markdown-css.test.js b/packages/astro/test/astro-markdown-css.test.js deleted file mode 100644 index c6d8bc71ae874..0000000000000 --- a/packages/astro/test/astro-markdown-css.test.js +++ /dev/null @@ -1,59 +0,0 @@ -import { expect } from 'chai'; -import * as cheerio from 'cheerio'; -import { loadFixture } from './test-utils.js'; - -let fixture; -const IMPORTED_ASTRO_COMPONENT_ID = 'imported-astro-component'; - -describe('Imported markdown CSS', function () { - before(async () => { - fixture = await loadFixture({ root: './fixtures/astro-markdown-css/' }); - }); - describe('build', () => { - let $; - let bundledCSS; - - before(async () => { - this.timeout(45000); // test needs a little more time in CI - await fixture.build(); - - // get bundled CSS (will be hashed, hence DOM query) - const html = await fixture.readFile('/index.html'); - $ = cheerio.load(html); - const bundledCSSHREF = $('link[rel=stylesheet][href^=/assets/]').attr('href'); - bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/')); - }); - - it('Compiles styles for Astro components within imported markdown', () => { - const importedAstroComponent = $(`#${IMPORTED_ASTRO_COMPONENT_ID}`)?.[0]; - expect(importedAstroComponent?.name).to.equal('h2'); - const cssClass = $(importedAstroComponent).attr('class')?.split(/\s+/)?.[0]; - - expect(bundledCSS).to.include(`h2:where(.${cssClass}){color:#00f}`); - }); - }); - describe('dev', () => { - let devServer; - let html; - let $; - - before(async () => { - devServer = await fixture.startDevServer(); - html = await fixture.fetch('/').then((res) => res.text()); - $ = cheerio.load(html); - }); - - after(async () => { - await devServer.stop(); - }); - - it('Compiles styles for Astro components within imported markdown', async () => { - const importedAstroComponent = $(`#${IMPORTED_ASTRO_COMPONENT_ID}`)?.[0]; - expect(importedAstroComponent?.name).to.equal('h2'); - const cssClass = $(importedAstroComponent).attr('class')?.split(/\s+/)?.[0]; - - const allInjectedStyles = $('style').text().replace(/\s*/g, ''); - expect(allInjectedStyles).to.include(`h2:where(.${cssClass}){color:#00f}`); - }); - }); -}); diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js index 59eb07822d9c4..ca0fcad385b60 100644 --- a/packages/astro/test/astro-markdown.test.js +++ b/packages/astro/test/astro-markdown.test.js @@ -14,19 +14,6 @@ describe('Astro Markdown', () => { await fixture.build(); }); - it('Leaves JSX expressions unprocessed', async () => { - const html = await fixture.readFile('/jsx-expressions/index.html'); - const $ = cheerio.load(html); - - expect($('h2').html()).to.equal('{frontmatter.title}'); - }); - - it('Leaves JSX components un-transformed', async () => { - const html = await fixture.readFile('/components/index.html'); - - expect(html).to.include(''); - }); - it('Exposes raw markdown content', async () => { const { raw } = JSON.parse(await fixture.readFile('/raw-content.json')); diff --git a/packages/astro/test/fixtures/astro-markdown-css/astro.config.mjs b/packages/astro/test/fixtures/astro-markdown-css/astro.config.mjs deleted file mode 100644 index 410c204086983..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/astro.config.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'astro/config'; - -// https://astro.build/config -export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, - integrations: [] -}); diff --git a/packages/astro/test/fixtures/astro-markdown-css/package.json b/packages/astro/test/fixtures/astro-markdown-css/package.json deleted file mode 100644 index 9e566688f5854..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@test/astro-markdown-css", - "version": "0.0.0", - "private": true, - "scripts": { - "build": "astro build", - "dev": "astro dev" - }, - "dependencies": { - "astro": "workspace:*" - } -} diff --git a/packages/astro/test/fixtures/astro-markdown-css/src/components/Visual.astro b/packages/astro/test/fixtures/astro-markdown-css/src/components/Visual.astro deleted file mode 100644 index 001bc83bf82a0..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/src/components/Visual.astro +++ /dev/null @@ -1,7 +0,0 @@ -

I'm a visual!

- - diff --git a/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article.md b/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article.md deleted file mode 100644 index 17267e9b89fe9..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Visual from '../components/Visual.astro' ---- - -# Example markdown document, with a Visual - - - - diff --git a/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article2.md b/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article2.md deleted file mode 100644 index e0d484d3f29b7..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/src/markdown/article2.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Visual from '../components/Visual.astro' ---- - -# Example markdown document, with a more Visuals - - - - diff --git a/packages/astro/test/fixtures/astro-markdown-css/src/pages/index.astro b/packages/astro/test/fixtures/astro-markdown-css/src/pages/index.astro deleted file mode 100644 index 204f236f45290..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown-css/src/pages/index.astro +++ /dev/null @@ -1,15 +0,0 @@ ---- -const markdownDocs = await Astro.glob('../markdown/*.md') -const article2 = await import('../markdown/article2.md') ---- - - - - - Astro - - - {markdownDocs.map(markdownDoc => <>

{markdownDoc.url}

)} - - - diff --git a/packages/astro/test/fixtures/astro-markdown/src/pages/components.md b/packages/astro/test/fixtures/astro-markdown/src/pages/components.md deleted file mode 100644 index cd27bc09fff26..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown/src/pages/components.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -setup: import Counter from '../components/Counter.svelte' ---- - - diff --git a/packages/astro/test/fixtures/astro-markdown/src/pages/jsx-expressions.md b/packages/astro/test/fixtures/astro-markdown/src/pages/jsx-expressions.md deleted file mode 100644 index b87efbb2d8895..0000000000000 --- a/packages/astro/test/fixtures/astro-markdown/src/pages/jsx-expressions.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Blog Post with JSX expressions -paragraph: JSX at the start of the line! -list: ['test-1', 'test-2', 'test-3'] ---- - -## {frontmatter.title} - -{frontmatter.paragraph} - -
    - {frontmatter.list.map(item =>
  • {item}
  • )} -
diff --git a/packages/astro/test/fixtures/import-ts-with-js/astro.config.mjs b/packages/astro/test/fixtures/import-ts-with-js/astro.config.mjs index 410c204086983..50eaa792c79b7 100644 --- a/packages/astro/test/fixtures/import-ts-with-js/astro.config.mjs +++ b/packages/astro/test/fixtures/import-ts-with-js/astro.config.mjs @@ -2,8 +2,5 @@ import { defineConfig } from 'astro/config'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [] }); diff --git a/packages/astro/test/fixtures/import-ts-with-js/src/pages/post.md b/packages/astro/test/fixtures/import-ts-with-js/src/pages/post.md deleted file mode 100644 index f2b81e6057983..0000000000000 --- a/packages/astro/test/fixtures/import-ts-with-js/src/pages/post.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -setup: | - import foo from '../foo.js' ---- - -# Testing - -## { foo() } diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/astro.config.mjs b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/astro.config.mjs deleted file mode 100644 index baefed8cc2c66..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/astro.config.mjs +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from 'astro/config'; -import preact from '@astrojs/preact'; -import svelte from "@astrojs/svelte"; - -// https://astro.build/config -export default defineConfig({ - integrations: [preact(), svelte()], - site: 'https://astro.build/', - legacy: { - astroFlavoredMarkdown: true, - } -}); diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/package.json b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/package.json deleted file mode 100644 index ba6bd41cfbf64..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@test/astro-markdown", - "version": "0.0.0", - "private": true, - "dependencies": { - "@astrojs/preact": "workspace:*", - "@astrojs/svelte": "workspace:*", - "astro": "workspace:*", - "preact": "^10.11.0", - "svelte": "^3.48.0" - } -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Counter.jsx b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Counter.jsx deleted file mode 100644 index a75f858b518b6..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Counter.jsx +++ /dev/null @@ -1,7 +0,0 @@ -import { h } from 'preact'; -import { useState } from 'preact/hooks'; - -export default function () { - const [count, setCount] = useState(0); - return ; -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Example.jsx b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Example.jsx deleted file mode 100644 index e1f67ee506f4d..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Example.jsx +++ /dev/null @@ -1,5 +0,0 @@ -import { h } from 'preact'; - -export default function () { - return
Testing
; -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Hello.jsx b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Hello.jsx deleted file mode 100644 index d30dec516e9e1..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/Hello.jsx +++ /dev/null @@ -1,5 +0,0 @@ -import { h } from 'preact'; - -export default function ({ name }) { - return
Hello {name}
; -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SlotComponent.astro b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SlotComponent.astro deleted file mode 100644 index f0aa9fc1c457e..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SlotComponent.astro +++ /dev/null @@ -1,13 +0,0 @@ -
-
- ❌ Missing content for slot "fragmentSlot" -
- -
- ❌ Missing content for slot "pSlot" -
- -
- ❌ Missing content for default slot -
-
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SvelteButton.svelte b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SvelteButton.svelte deleted file mode 100644 index 74f3ff6a9c750..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/SvelteButton.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/TextBlock.jsx b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/TextBlock.jsx deleted file mode 100644 index d9ea2534fec24..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/TextBlock.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import { h } from 'preact'; - -const TextBlock = ({ - title, - children, - noPadding = false, -}) => { - return ( -
-

{title}

-

{children}

-
- ); -}; - -export default TextBlock; diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/index.js b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/index.js deleted file mode 100644 index e7cc94c588f25..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/components/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Counter from './Counter'; - -export default { - Counter -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/content/code-element.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/content/code-element.md deleted file mode 100644 index b091decc0ffc9..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/content/code-element.md +++ /dev/null @@ -1,3 +0,0 @@ -This should have `nospace` around it. - -This should have nospace around it. diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/plain.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/plain.md deleted file mode 100644 index d548b3356b650..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/plain.md +++ /dev/null @@ -1,6 +0,0 @@ ---- ---- - -## Plain jane - -I am plain markdown! diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/with-components.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/with-components.md deleted file mode 100644 index dc6c23bf9c198..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/imported-md/with-components.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -setup: | - import Counter from '../components/Counter.jsx' - import Hello from '../components/Hello.jsx' - import SvelteButton from '../components/SvelteButton.svelte' ---- - -## With components - -### Non-hydrated - - - -### Hydrated - - - diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/content.astro b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/content.astro deleted file mode 100644 index 925a243a9368a..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/content.astro +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -
- -
- - diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/layout-props.astro b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/layout-props.astro deleted file mode 100644 index a11abb8fb5d15..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/layouts/layout-props.astro +++ /dev/null @@ -1,17 +0,0 @@ ---- - interface Props { - url: string; - file: string; - title: string; - } - - const { title, url, file } = Astro.props.content as Props; ---- - - - -
{title}
-
{url}
-
{file}
- - \ No newline at end of file diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/children.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/children.md deleted file mode 100644 index a22ee5f961486..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/children.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -setup: import TextBlock from '../components/TextBlock' ---- -{/* https://github.com/withastro/astro/issues/3319 */} - - -
    -
  • A
  • -
  • B
  • -
  • C
  • -
-
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-element.astro b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-element.astro deleted file mode 100644 index 43ca0bfc5a0ef..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-element.astro +++ /dev/null @@ -1,7 +0,0 @@ ---- -const content = await Astro.glob('../content/*.md'); ---- - -
- {content.map(({ Content }) => )} -
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-in-md.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-in-md.md deleted file mode 100644 index 52a799ab1d077..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/code-in-md.md +++ /dev/null @@ -1,16 +0,0 @@ -# Inline code blocks - -`` tags without any problems. - -# Fenced code blocks - -```html - -
This should also work without any problems.
- -``` diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment-with-js.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment-with-js.md deleted file mode 100644 index 374463d2db117..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment-with-js.md +++ /dev/null @@ -1,23 +0,0 @@ - - - - -``` - -``` - -`` - -# It still works! diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment.md deleted file mode 100644 index 39a916351829b..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/comment.md +++ /dev/null @@ -1,2 +0,0 @@ - -# It works! diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/dash.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/dash.md deleted file mode 100644 index 269a774f5a6df..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/dash.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: My Blog Post -layout: ../layouts/content.astro ---- - -## Title - -Hello world - -With this in the body --- - -## Another - -more content \ No newline at end of file diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/empty-code.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/empty-code.md deleted file mode 100644 index 93cb4eedb8a9b..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/empty-code.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: My Blog Post -layout: ../layouts/content.astro ---- - -## Title - -Hello world - -With this in the body --- - -## Another - -more content - -``` - -``` - -

\ No newline at end of file
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/imported-md/with-components.astro b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/imported-md/with-components.astro
deleted file mode 100644
index 97cd8f211249a..0000000000000
--- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/imported-md/with-components.astro
+++ /dev/null
@@ -1,9 +0,0 @@
----
-import Layout from '../../layouts/content.astro'
-
-const posts = await Astro.glob('../../imported-md/*.md')
----
-
-
-	{posts.map(({ Content }) => )}
-
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/jsx-expressions.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/jsx-expressions.md
deleted file mode 100644
index b87efbb2d8895..0000000000000
--- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/jsx-expressions.md
+++ /dev/null
@@ -1,13 +0,0 @@
----
-title: Blog Post with JSX expressions
-paragraph: JSX at the start of the line!
-list: ['test-1', 'test-2', 'test-3']
----
-
-## {frontmatter.title}
-
-{frontmatter.paragraph}
-
-
    - {frontmatter.list.map(item =>
  • {item}
  • )} -
diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/layout-props.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/layout-props.md deleted file mode 100644 index 0f87c1bd0aef6..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/layout-props.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: 'Hello world!' -layout: '../layouts/layout-props.astro' ---- \ No newline at end of file diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/namespace.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/namespace.md deleted file mode 100644 index abbe26a3b0275..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/namespace.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -setup: import ns from '../components/index.js'; ---- - -# Hello Namespace! - -Click me! diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/raw-content.json.js b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/raw-content.json.js deleted file mode 100644 index 21be533e10208..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/raw-content.json.js +++ /dev/null @@ -1,10 +0,0 @@ -import { rawContent, compiledContent } from '../imported-md/with-components.md'; - -export async function get() { - return { - body: JSON.stringify({ - raw: rawContent(), - compiled: await compiledContent(), - }), - } -} diff --git a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/script.md b/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/script.md deleted file mode 100644 index f2b8bca882930..0000000000000 --- a/packages/astro/test/fixtures/legacy-astro-flavored-markdown/src/pages/script.md +++ /dev/null @@ -1,7 +0,0 @@ -# Test - -## Let's try a script... - -This should work! - - diff --git a/packages/astro/test/fixtures/legacy-build/src/components/Greeting.vue b/packages/astro/test/fixtures/legacy-build/src/components/Greeting.vue deleted file mode 100644 index a94f586bf8fb5..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/components/Greeting.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/packages/astro/test/fixtures/legacy-build/src/components/InlineHoisted.astro b/packages/astro/test/fixtures/legacy-build/src/components/InlineHoisted.astro deleted file mode 100644 index ba6c0ab4d4e0b..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/components/InlineHoisted.astro +++ /dev/null @@ -1,13 +0,0 @@ - -
diff --git a/packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro b/packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro deleted file mode 100644 index bb3372123533b..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/pages/[pokemon].astro +++ /dev/null @@ -1,18 +0,0 @@ ---- -import Greeting from '../components/Greeting.vue'; - -export async function getStaticPaths() { - const allPokemon = [{name: 'Charmander'}, {name: 'Charmander'}, {name: 'Charizard'}]; - return allPokemon.map(pokemon => ({params: {pokemon: pokemon.name}, props: {pokemon}})); -} ---- - - - Hello - - - -

{Astro.props.pokemon.name}

- - - \ No newline at end of file diff --git a/packages/astro/test/fixtures/legacy-build/src/pages/index.astro b/packages/astro/test/fixtures/legacy-build/src/pages/index.astro deleted file mode 100644 index ef93bf5535d04..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/pages/index.astro +++ /dev/null @@ -1,60 +0,0 @@ ---- -import Greeting from '../components/Greeting.vue'; -import Counter from '../components/Counter.vue'; -import InlineHoisted from '../components/InlineHoisted.astro'; ---- - - - - Demo app - - - - - - -
-

Component CSS

- -
- -
-

ImageTools

-
- -
-

Astro components

-
- -
-

Hydrated component

- -
- -
-

Hoisted scripts

- -
- -
-

define:vars

-

- -
- - diff --git a/packages/astro/test/fixtures/legacy-build/src/scripts/external-hoist.ts b/packages/astro/test/fixtures/legacy-build/src/scripts/external-hoist.ts deleted file mode 100644 index ff7ee0bcfd190..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/scripts/external-hoist.ts +++ /dev/null @@ -1,2 +0,0 @@ -const el = document.querySelector('#external-hoist'); -el.textContent = `This was loaded externally`; diff --git a/packages/astro/test/fixtures/legacy-build/src/styles/_global.scss b/packages/astro/test/fixtures/legacy-build/src/styles/_global.scss deleted file mode 100644 index 27620a7460f26..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/styles/_global.scss +++ /dev/null @@ -1 +0,0 @@ -$color: tan; diff --git a/packages/astro/test/fixtures/legacy-build/src/styles/global.css b/packages/astro/test/fixtures/legacy-build/src/styles/global.css deleted file mode 100644 index ab5ca9bfe44e2..0000000000000 --- a/packages/astro/test/fixtures/legacy-build/src/styles/global.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: lightcoral; -} diff --git a/packages/astro/test/fixtures/slots-preact/astro.config.mjs b/packages/astro/test/fixtures/slots-preact/astro.config.mjs index 01ce725cc2611..db84c5f33f56b 100644 --- a/packages/astro/test/fixtures/slots-preact/astro.config.mjs +++ b/packages/astro/test/fixtures/slots-preact/astro.config.mjs @@ -4,8 +4,5 @@ import preact from '@astrojs/preact'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [preact(), mdx()], }); diff --git a/packages/astro/test/fixtures/slots-preact/src/pages/markdown.md b/packages/astro/test/fixtures/slots-preact/src/pages/markdown.md deleted file mode 100644 index f86720fea9e08..0000000000000 --- a/packages/astro/test/fixtures/slots-preact/src/pages/markdown.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Counter from '../components/Counter.jsx' ---- - -# Slots: Preact - -

Hello world!

-

/ Named

-

/ Dash Case

diff --git a/packages/astro/test/fixtures/slots-react/astro.config.mjs b/packages/astro/test/fixtures/slots-react/astro.config.mjs index 20fa1428ec0eb..5d0c06b6dec40 100644 --- a/packages/astro/test/fixtures/slots-react/astro.config.mjs +++ b/packages/astro/test/fixtures/slots-react/astro.config.mjs @@ -4,8 +4,5 @@ import react from '@astrojs/react'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [react(), mdx()], }); diff --git a/packages/astro/test/fixtures/slots-react/src/pages/markdown.md b/packages/astro/test/fixtures/slots-react/src/pages/markdown.md deleted file mode 100644 index 3084505061641..0000000000000 --- a/packages/astro/test/fixtures/slots-react/src/pages/markdown.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Counter from '../components/Counter.jsx' ---- - -# Slots: React - -

Hello world!

-

/ Named

-

/ Dash Case

diff --git a/packages/astro/test/fixtures/slots-solid/astro.config.mjs b/packages/astro/test/fixtures/slots-solid/astro.config.mjs index 35d38c8f1566d..f527c69b4ab3b 100644 --- a/packages/astro/test/fixtures/slots-solid/astro.config.mjs +++ b/packages/astro/test/fixtures/slots-solid/astro.config.mjs @@ -4,8 +4,5 @@ import solid from '@astrojs/solid-js'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [solid(), mdx()], }); diff --git a/packages/astro/test/fixtures/slots-solid/src/pages/markdown.md b/packages/astro/test/fixtures/slots-solid/src/pages/markdown.md deleted file mode 100644 index d9bc2dabd07ad..0000000000000 --- a/packages/astro/test/fixtures/slots-solid/src/pages/markdown.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Counter from '../components/Counter.jsx' ---- - -# Slots: Solid - -

Hello world!

-

/ Named

-

/ Dash Case

diff --git a/packages/astro/test/fixtures/slots-svelte/astro.config.mjs b/packages/astro/test/fixtures/slots-svelte/astro.config.mjs index afd7dd326797e..19aeea56ab093 100644 --- a/packages/astro/test/fixtures/slots-svelte/astro.config.mjs +++ b/packages/astro/test/fixtures/slots-svelte/astro.config.mjs @@ -4,8 +4,5 @@ import svelte from '@astrojs/svelte'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [svelte(), mdx()], }); diff --git a/packages/astro/test/fixtures/slots-svelte/src/pages/markdown.md b/packages/astro/test/fixtures/slots-svelte/src/pages/markdown.md deleted file mode 100644 index e5e415921166a..0000000000000 --- a/packages/astro/test/fixtures/slots-svelte/src/pages/markdown.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Counter from '../components/Counter.svelte' ---- - -# Slots: Svelte - -

Hello world!

-

/ Named

-

/ Dash Case

diff --git a/packages/astro/test/fixtures/slots-vue/astro.config.mjs b/packages/astro/test/fixtures/slots-vue/astro.config.mjs index 1fbe9ba8e23b2..d8d0c7130a659 100644 --- a/packages/astro/test/fixtures/slots-vue/astro.config.mjs +++ b/packages/astro/test/fixtures/slots-vue/astro.config.mjs @@ -4,8 +4,5 @@ import vue from '@astrojs/vue'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [vue(), mdx()], }); diff --git a/packages/astro/test/fixtures/slots-vue/src/pages/markdown.md b/packages/astro/test/fixtures/slots-vue/src/pages/markdown.md deleted file mode 100644 index 6a08515f273d2..0000000000000 --- a/packages/astro/test/fixtures/slots-vue/src/pages/markdown.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -setup: import Counter from '../components/Counter.vue' ---- - -# Slots: Vue - -

Hello world!

-

/ Named

-

/ Dash Case

diff --git a/packages/astro/test/fixtures/tailwindcss/astro.config.mjs b/packages/astro/test/fixtures/tailwindcss/astro.config.mjs index 31f537fd004b2..8274fd3b9e581 100644 --- a/packages/astro/test/fixtures/tailwindcss/astro.config.mjs +++ b/packages/astro/test/fixtures/tailwindcss/astro.config.mjs @@ -4,9 +4,6 @@ import mdx from '@astrojs/mdx'; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [tailwind(), mdx()], vite: { build: { diff --git a/packages/astro/test/import-ts-with-js.test.js b/packages/astro/test/import-ts-with-js.test.js index d3882ae8f2cd3..afe4a1618b00c 100644 --- a/packages/astro/test/import-ts-with-js.test.js +++ b/packages/astro/test/import-ts-with-js.test.js @@ -16,10 +16,4 @@ describe('Using .js extension on .ts file', () => { const $ = cheerio.load(html); expect($('h1').text()).to.equal('bar'); }); - - it('works in .md files', async () => { - const html = await fixture.readFile('/post/index.html'); - const $ = cheerio.load(html); - expect($('h2').text()).to.equal('bar'); - }); }); diff --git a/packages/astro/test/legacy-astro-flavored-markdown.test.js b/packages/astro/test/legacy-astro-flavored-markdown.test.js deleted file mode 100644 index e9199d1a2618e..0000000000000 --- a/packages/astro/test/legacy-astro-flavored-markdown.test.js +++ /dev/null @@ -1,200 +0,0 @@ -import { expect } from 'chai'; -import * as cheerio from 'cheerio'; -import { loadFixture, fixLineEndings } from './test-utils.js'; - -describe('Legacy Astro-flavored Markdown', () => { - let fixture; - - before(async () => { - fixture = await loadFixture({ - root: './fixtures/legacy-astro-flavored-markdown/', - }); - await fixture.build(); - }); - - it('Can parse JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/jsx-expressions/index.html'); - const $ = cheerio.load(html); - - expect($('h2').html()).to.equal('Blog Post with JSX expressions'); - - expect(html).to.contain('JSX at the start of the line!'); - for (let listItem of ['test-1', 'test-2', 'test-3']) { - expect($(`#${listItem}`).html()).to.equal(`${listItem}`); - } - }); - - it('Can handle slugs with JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/slug/index.html'); - const $ = cheerio.load(html); - - expect($('h1').attr('id')).to.equal('my-blog-post'); - }); - - it('Can handle code elements without extra spacing', async () => { - const html = await fixture.readFile('/code-element/index.html'); - const $ = cheerio.load(html); - - $('code').each((_, el) => { - expect($(el).html()).to.equal($(el).html().trim()); - }); - }); - - it('Can handle namespaced components in markdown', async () => { - const html = await fixture.readFile('/namespace/index.html'); - const $ = cheerio.load(html); - - expect($('h1').text()).to.equal('Hello Namespace!'); - expect($('button').length).to.equal(1); - }); - - it('Correctly handles component children in markdown pages (#3319)', async () => { - const html = await fixture.readFile('/children/index.html'); - - expect(html).not.to.contain('

'); - }); - - it('Can handle HTML comments in markdown pages', async () => { - const html = await fixture.readFile('/comment/index.html'); - const $ = cheerio.load(html); - - expect($('h1').text()).to.equal('It works!'); - }); - - it('Prevents `*/` sequences from breaking HTML comments (#3476)', async () => { - const html = await fixture.readFile('/comment-with-js/index.html'); - const $ = cheerio.load(html); - - expect($('h1').text()).to.equal('It still works!'); - }); - - it('Can handle HTML comments in inline code', async () => { - const html = await fixture.readFile('/comment-with-js/index.html'); - const $ = cheerio.load(html); - - expect($('p code').text()).to.equal(''); - }); - - it('Can handle HTML comments in code fences', async () => { - const html = await fixture.readFile('/comment-with-js/index.html'); - const $ = cheerio.load(html); - - expect($('pre > code').text()).to.equal(''); - }); - - // https://github.com/withastro/astro/issues/3254 - it('Can handle scripts in markdown pages', async () => { - const html = await fixture.readFile('/script/index.html'); - expect(html).not.to.match(new RegExp('/src/scripts/test.js')); - }); - - it('Empty code blocks do not fail', async () => { - const html = await fixture.readFile('/empty-code/index.html'); - const $ = cheerio.load(html); - - // test 1: There is not a `` in the codeblock - expect($('pre')[0].children).to.have.lengthOf(1); - - // test 2: The empty `
` failed to render
-		expect($('pre')[1].children).to.have.lengthOf(0);
-	});
-
-	it('Can render markdown with --- for horizontal rule', async () => {
-		const html = await fixture.readFile('/dash/index.html');
-		expect(!!html).to.equal(true);
-	});
-
-	it('Exposes raw markdown content', async () => {
-		const { raw } = JSON.parse(await fixture.readFile('/raw-content.json'));
-
-		expect(fixLineEndings(raw)).to.equal(
-			`\n## With components\n\n### Non-hydrated\n\n\n\n### Hydrated\n\n\n\n`
-		);
-	});
-
-	it('Exposes compiled HTML content', async () => {
-		const { compiled } = JSON.parse(await fixture.readFile('/raw-content.json'));
-
-		expect(fixLineEndings(compiled)).to.equal(
-			`

With components

\n

Non-hydrated

\n\n

Hydrated

\n\n` - ); - }); - - it('Allows referencing Vite env var names in markdown (#3412)', async () => { - const html = await fixture.readFile('/vite-env-vars/index.html'); - const $ = cheerio.load(html); - - // test 1: referencing an existing var name - expect($('code').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('li').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('code').eq(3).text()).to.contain('site: import.meta.env.SITE'); - expect($('blockquote').text()).to.contain('import.meta.env.SITE'); - - // test 2: referencing a non-existing var name - expect($('code').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('li').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('code').eq(3).text()).to.contain('title: import.meta.env.TITLE'); - expect($('blockquote').text()).to.contain('import.meta.env.TITLE'); - - // test 3: referencing `import.meta.env` itself (without any var name) - expect($('code').eq(2).text()).to.equal('import.meta.env'); - expect($('li').eq(2).text()).to.equal('import.meta.env'); - expect($('code').eq(3).text()).to.contain('// Use Vite env vars with import.meta.env'); - expect($('blockquote').text()).to.match(/import\.meta\.env\s*$/); - }); - - it('Escapes HTML tags in code blocks', async () => { - const html = await fixture.readFile('/code-in-md/index.html'); - const $ = cheerio.load(html); - - expect($('code').eq(0).html()).to.equal('<script>'); - expect($('blockquote').length).to.equal(1); - expect($('code').eq(1).html()).to.equal('</script>'); - expect($('pre').html()).to.contain('>This should also work without any problems.<'); - }); - - it('Allows defining slot contents in component children', async () => { - const html = await fixture.readFile('/slots/index.html'); - const $ = cheerio.load(html); - - const slots = $('article').eq(0); - expect(slots.find('> .fragmentSlot > div').text()).to.contain('1:'); - expect(slots.find('> .fragmentSlot > div + p').text()).to.contain('2:'); - expect(slots.find('> .pSlot > p[title="hello"]').text()).to.contain('3:'); - expect(slots.find('> .defaultSlot').html()).to.match( - new RegExp( - `
4: Div in default slot
` + - // Optional extra paragraph due to the line breaks between components - `(

)?` + - `

5: Paragraph in fragment in default slot

` + - // Optional whitespace due to the line breaks between components - `[\s\n]*` + - `6: Regular text in default slot` - ) - ); - - const nestedSlots = $('article').eq(1); - expect(nestedSlots.find('> .fragmentSlot').html()).to.contain('1:'); - expect(nestedSlots.find('> .pSlot > p').text()).to.contain('2:'); - expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal( - ` - 3: nested fragmentSlot - 4: nested pSlot - 5: nested text in default slot - `.replace(/\s+/g, ' ') - ); - - expect($('article').eq(3).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - - expect($('article').eq(4).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - }); - - it('Generate the right props for the layout', async () => { - const html = await fixture.readFile('/layout-props/index.html'); - const $ = cheerio.load(html); - - expect($('#title').text()).to.equal('Hello world!'); - expect($('#url').text()).to.equal('/layout-props'); - expect($('#file').text()).to.match(/.*\/layout-props.md$/); - }); -}); diff --git a/packages/astro/test/slots-preact.test.js b/packages/astro/test/slots-preact.test.js index b7330a18242d1..893c2dd8a9803 100644 --- a/packages/astro/test/slots-preact.test.js +++ b/packages/astro/test/slots-preact.test.js @@ -34,26 +34,6 @@ describe('Slots: Preact', () => { expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); - describe('For Markdown Pages', () => { - it('Renders default slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#content').text().trim()).to.equal('Hello world!'); - }); - - it('Renders named slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#named').text().trim()).to.equal('Fallback / Named'); - }); - - it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); - }); - }); - describe('For MDX Pages', () => { it('Renders default slot', async () => { const html = await fixture.readFile('/mdx/index.html'); diff --git a/packages/astro/test/slots-react.test.js b/packages/astro/test/slots-react.test.js index a5ac46ab30345..64644515720be 100644 --- a/packages/astro/test/slots-react.test.js +++ b/packages/astro/test/slots-react.test.js @@ -34,26 +34,6 @@ describe('Slots: React', () => { expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); - describe('For Markdown Pages', () => { - it('Renders default slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#content').text().trim()).to.equal('Hello world!'); - }); - - it('Renders named slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#named').text().trim()).to.equal('Fallback / Named'); - }); - - it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); - }); - }); - describe('For MDX Pages', () => { it('Renders default slot', async () => { const html = await fixture.readFile('/mdx/index.html'); diff --git a/packages/astro/test/slots-solid.test.js b/packages/astro/test/slots-solid.test.js index 60e3231c9fa0b..c7bbda434beba 100644 --- a/packages/astro/test/slots-solid.test.js +++ b/packages/astro/test/slots-solid.test.js @@ -34,26 +34,6 @@ describe('Slots: Solid', () => { expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); - describe('For Markdown Pages', () => { - it('Renders default slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#content').text().trim()).to.equal('Hello world!'); - }); - - it('Renders named slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#named').text().trim()).to.equal('Fallback / Named'); - }); - - it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); - }); - }); - describe('For MDX Pages', () => { it('Renders default slot', async () => { const html = await fixture.readFile('/mdx/index.html'); diff --git a/packages/astro/test/slots-svelte.test.js b/packages/astro/test/slots-svelte.test.js index a96a397e3e5d3..9aeb4c106a8a5 100644 --- a/packages/astro/test/slots-svelte.test.js +++ b/packages/astro/test/slots-svelte.test.js @@ -34,26 +34,6 @@ describe('Slots: Svelte', () => { expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); - describe('For Markdown Pages', () => { - it('Renders default slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#content').text().trim()).to.equal('Hello world!'); - }); - - it('Renders named slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#named').text().trim()).to.equal('Fallback / Named'); - }); - - it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); - }); - }); - describe('For MDX Pages', () => { it('Renders default slot', async () => { const html = await fixture.readFile('/mdx/index.html'); diff --git a/packages/astro/test/slots-vue.test.js b/packages/astro/test/slots-vue.test.js index 2999904b75550..2193c77726740 100644 --- a/packages/astro/test/slots-vue.test.js +++ b/packages/astro/test/slots-vue.test.js @@ -34,26 +34,6 @@ describe('Slots: Vue', () => { expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); - describe('For Markdown Pages', () => { - it('Renders default slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#content').text().trim()).to.equal('Hello world!'); - }); - - it('Renders named slot', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#named').text().trim()).to.equal('Fallback / Named'); - }); - - it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); - const $ = cheerio.load(html); - expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); - }); - }); - describe('For MDX Pages', () => { it('Renders default slot', async () => { const html = await fixture.readFile('/mdx/index.html'); @@ -68,7 +48,7 @@ describe('Slots: Vue', () => { }); it('Converts dash-case slot to camelCase', async () => { - const html = await fixture.readFile('/markdown/index.html'); + const html = await fixture.readFile('/mdx/index.html'); const $ = cheerio.load(html); expect($('#dash-case').text().trim()).to.equal('Fallback / Dash Case'); }); diff --git a/packages/astro/test/sourcemap.test.js b/packages/astro/test/sourcemap.test.js index c24d7f3f0d25b..4937e22364486 100644 --- a/packages/astro/test/sourcemap.test.js +++ b/packages/astro/test/sourcemap.test.js @@ -10,7 +10,7 @@ describe('Sourcemap', async () => { }); it('Builds sourcemap', async () => { - const dir = await fixture.readdir('.'); + const dir = await fixture.readdir('./assets'); const counterMap = dir.find((file) => file.match(/^Counter\.\w+\.js\.map$/)); expect(counterMap).to.be.ok; }); diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index 8907c489da019..68452be94a33e 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -86,7 +86,7 @@ export default function createIntegration(args?: Options): AstroIntegration { // Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash. try { const chunkFileNames = - _vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'chunks/chunk.[hash].mjs'; + _vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'assets/chunks/chunk.[hash].mjs'; const chunkPath = npath.dirname(chunkFileNames); const chunksDirUrl = new URL(chunkPath + '/', _buildConfig.server); await fs.promises.rm(chunksDirUrl, { recursive: true, force: true }); diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index c30ee31ede4b7..cc8093981d24c 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -146,7 +146,7 @@ export default function integration(options: IntegrationOptions = {}): AstroInte // For the Squoosh service, copy all wasm files to dist/chunks. // Because the default loader is dynamically imported (above), // Vite will bundle squoosh to dist/chunks and expect to find the wasm files there - await copyWasmFiles(new URL('./chunks', dir)); + await copyWasmFiles(new URL('./assets/chunks', dir)); } if (loader && 'transform' in loader && staticImages.size > 0) { @@ -166,7 +166,7 @@ export default function integration(options: IntegrationOptions = {}): AstroInte }, 'astro:build:ssr': async () => { if (resolvedOptions.serviceEntryPoint === '@astrojs/image/squoosh') { - await copyWasmFiles(new URL('./chunks/', _buildConfig.server)); + await copyWasmFiles(new URL('./assets/chunks/', _buildConfig.server)); } }, }, diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index 35b660e2cdd2f..48be316d9d188 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -100,7 +100,7 @@ async function bundleServerEntry({ serverEntry, server }: BuildConfig, vite: any // Remove chunks, if they exist. Since we have bundled via esbuild these chunks are trash. try { const chunkFileNames = - vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'chunks/chunk.[hash].mjs'; + vite?.build?.rollupOptions?.output?.chunkFileNames ?? 'assets/chunks/chunk.[hash].mjs'; const chunkPath = npath.dirname(chunkFileNames); const chunksDirUrl = new URL(chunkPath + '/', server); await fs.promises.rm(chunksDirUrl, { recursive: true, force: true }); diff --git a/packages/integrations/tailwind/README.md b/packages/integrations/tailwind/README.md index fa5532b854b9c..3d333a95f66a5 100644 --- a/packages/integrations/tailwind/README.md +++ b/packages/integrations/tailwind/README.md @@ -68,6 +68,8 @@ export default defineConfig({ When you install the integration, Tailwind's utility classes should be ready to go right away. Head to the [Tailwind docs](https://tailwindcss.com/docs/utility-first) to learn how to use Tailwind, and if you see a utility class you want to try, add it to any HTML element to your project! +[Autoprefixer](https://github.com/postcss/autoprefixer) is also setup automatically for production builds so Tailwind classes will work in older browsers. + https://user-images.githubusercontent.com/4033662/169918388-8ed153b2-0ba0-4b24-b861-d6e1cc800b6c.mp4 ## Configuration diff --git a/packages/integrations/tailwind/src/index.ts b/packages/integrations/tailwind/src/index.ts index 28def50c757fa..951868e9f2f7b 100644 --- a/packages/integrations/tailwind/src/index.ts +++ b/packages/integrations/tailwind/src/index.ts @@ -66,6 +66,20 @@ async function getUserConfig(root: URL, configPath?: string, isRestart = false) } } +function getViteConfiguration(isBuild: boolean, tailwindConfig: TailwindConfig) { + const postcssPlugins = [tailwindPlugin(tailwindConfig)]; + if (isBuild) { + postcssPlugins.push(autoprefixerPlugin()); + } + return { + css: { + postcss: { + plugins: postcssPlugins, + }, + }, + }; +} + type TailwindOptions = | { config?: { @@ -92,7 +106,14 @@ export default function tailwindIntegration(options?: TailwindOptions): AstroInt return { name: '@astrojs/tailwind', hooks: { - 'astro:config:setup': async ({ config, injectScript, addWatchFile, isRestart }) => { + 'astro:config:setup': async ({ + command, + config, + updateConfig, + injectScript, + addWatchFile, + isRestart, + }) => { // Inject the Tailwind postcss plugin const userConfig = await getUserConfig(config.root, customConfigPath, isRestart); @@ -108,10 +129,9 @@ export default function tailwindIntegration(options?: TailwindOptions): AstroInt addWatchFile(userConfig.filePath); } - const tailwindConfig: TailwindConfig = + const tailwindConfig = (userConfig?.value as TailwindConfig) ?? getDefaultTailwindConfig(config.srcDir); - config.style.postcss.plugins.push(tailwindPlugin(tailwindConfig)); - config.style.postcss.plugins.push(autoprefixerPlugin); + updateConfig({ vite: getViteConfiguration(command === 'build', tailwindConfig) }); if (applyBaseStyles) { // Inject the Tailwind base import diff --git a/packages/markdown/component/test/astro-markdown.test.js b/packages/markdown/component/test/astro-markdown.test.js index e5a1382a59c60..d2b156334535e 100644 --- a/packages/markdown/component/test/astro-markdown.test.js +++ b/packages/markdown/component/test/astro-markdown.test.js @@ -25,25 +25,6 @@ describe('Astro Markdown', () => { expect($('#test').length).to.be.ok; }); - it('Can parse JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/jsx-expressions/index.html'); - const $ = cheerio.load(html); - - expect($('h2').html()).to.equal('Blog Post with JSX expressions'); - - expect(html).to.contain('JSX at the start of the line!'); - for (let listItem of ['test-1', 'test-2', 'test-3']) { - expect($(`#${listItem}`).html()).to.equal(`${listItem}`); - } - }); - - it('Can handle slugs with JSX expressions in markdown pages', async () => { - const html = await fixture.readFile('/slug/index.html'); - const $ = cheerio.load(html); - - expect($('h1').attr('id')).to.equal('my-blog-post'); - }); - it('Can handle code elements without extra spacing', async () => { const html = await fixture.readFile('/code-element/index.html'); const $ = cheerio.load(html); @@ -53,14 +34,6 @@ describe('Astro Markdown', () => { }); }); - it('Can handle namespaced components in markdown', async () => { - const html = await fixture.readFile('/namespace/index.html'); - const $ = cheerio.load(html); - - expect($('h1').text()).to.equal('Hello Namespace!'); - expect($('button').length).to.equal(1); - }); - it('Correctly handles component children in markdown pages (#3319)', async () => { const html = await fixture.readFile('/children/index.html'); @@ -95,12 +68,6 @@ describe('Astro Markdown', () => { expect($('pre > code').text()).to.equal(''); }); - // https://github.com/withastro/astro/issues/3254 - it('Can handle scripts in markdown pages', async () => { - const html = await fixture.readFile('/script/index.html'); - expect(html).not.to.match(new RegExp('/src/scripts/test.js')); - }); - it('Can load more complex jsxy stuff', async () => { const html = await fixture.readFile('/complex/index.html'); const $ = cheerio.load(html); @@ -256,45 +223,6 @@ describe('Astro Markdown', () => { expect($('#target > ol > li > ol > li').text()).to.equal('nested hello'); }); - it('Exposes raw markdown content', async () => { - const { raw } = JSON.parse(await fixture.readFile('/raw-content.json')); - - expect(fixLineEndings(raw)).to.equal( - `\n## With components\n\n### Non-hydrated\n\n\n\n### Hydrated\n\n\n\n` - ); - }); - - it('Exposes HTML parser for raw markdown content', async () => { - const { compiled } = JSON.parse(await fixture.readFile('/raw-content.json')); - - expect(fixLineEndings(compiled)).to.equal( - `

With components

\n

Non-hydrated

\n\n

Hydrated

\n\n` - ); - }); - - it('Allows referencing Vite env var names in markdown (#3412)', async () => { - const html = await fixture.readFile('/vite-env-vars/index.html'); - const $ = cheerio.load(html); - - // test 1: referencing an existing var name - expect($('code').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('li').eq(0).text()).to.equal('import.meta.env.SITE'); - expect($('code').eq(3).text()).to.contain('site: import.meta.env.SITE'); - expect($('blockquote').text()).to.contain('import.meta.env.SITE'); - - // test 2: referencing a non-existing var name - expect($('code').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('li').eq(1).text()).to.equal('import.meta.env.TITLE'); - expect($('code').eq(3).text()).to.contain('title: import.meta.env.TITLE'); - expect($('blockquote').text()).to.contain('import.meta.env.TITLE'); - - // test 3: referencing `import.meta.env` itself (without any var name) - expect($('code').eq(2).text()).to.equal('import.meta.env'); - expect($('li').eq(2).text()).to.equal('import.meta.env'); - expect($('code').eq(3).text()).to.contain('// Use Vite env vars with import.meta.env'); - expect($('blockquote').text()).to.match(/import\.meta\.env\s*$/); - }); - it('Escapes HTML tags in code blocks', async () => { const html = await fixture.readFile('/code-in-md/index.html'); const $ = cheerio.load(html); @@ -305,42 +233,6 @@ describe('Astro Markdown', () => { expect($('pre').html()).to.contain('>This should also work without any problems.<'); }); - it('Allows defining slot contents in component children', async () => { - const html = await fixture.readFile('/slots/index.html'); - const $ = cheerio.load(html); - - const slots = $('article').eq(0); - expect(slots.find('> .fragmentSlot > div').text()).to.contain('1:'); - expect(slots.find('> .fragmentSlot > div + p').text()).to.contain('2:'); - expect(slots.find('> .pSlot > p[title="hello"]').text()).to.contain('3:'); - expect(slots.find('> .defaultSlot').html()).to.match( - new RegExp( - `
4: Div in default slot
` + - // Optional extra paragraph due to the line breaks between components - `(

)?` + - `

5: Paragraph in fragment in default slot

` + - // Optional whitespace due to the line breaks between components - `[\s\n]*` + - `6: Regular text in default slot` - ) - ); - - const nestedSlots = $('article').eq(1); - expect(nestedSlots.find('> .fragmentSlot').html()).to.contain('1:'); - expect(nestedSlots.find('> .pSlot > p').text()).to.contain('2:'); - expect(nestedSlots.find('> .defaultSlot > article').text().replace(/\s+/g, ' ')).to.equal( - ` - 3: nested fragmentSlot - 4: nested pSlot - 5: nested text in default slot - `.replace(/\s+/g, ' ') - ); - - expect($('article').eq(3).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - - expect($('article').eq(4).text().replace(/[^❌]/g, '')).to.equal('❌❌❌'); - }); - it('Generate the right props for the layout', async () => { const html = await fixture.readFile('/layout-props/index.html'); const $ = cheerio.load(html); diff --git a/packages/markdown/component/test/fixtures/astro-markdown/astro.config.mjs b/packages/markdown/component/test/fixtures/astro-markdown/astro.config.mjs index 405776c2bf0e8..be33a26cced0a 100644 --- a/packages/markdown/component/test/fixtures/astro-markdown/astro.config.mjs +++ b/packages/markdown/component/test/fixtures/astro-markdown/astro.config.mjs @@ -4,9 +4,6 @@ import svelte from "@astrojs/svelte"; // https://astro.build/config export default defineConfig({ - legacy: { - astroFlavoredMarkdown: true, - }, integrations: [preact(), svelte()], site: 'https://astro.build/', }); diff --git a/packages/markdown/component/test/fixtures/astro-markdown/src/imported-md/with-components.md b/packages/markdown/component/test/fixtures/astro-markdown/src/imported-md/with-components.md deleted file mode 100644 index dc6c23bf9c198..0000000000000 --- a/packages/markdown/component/test/fixtures/astro-markdown/src/imported-md/with-components.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -setup: | - import Counter from '../components/Counter.jsx' - import Hello from '../components/Hello.jsx' - import SvelteButton from '../components/SvelteButton.svelte' ---- - -## With components - -### Non-hydrated - - - -### Hydrated - - - diff --git a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/jsx-expressions.md b/packages/markdown/component/test/fixtures/astro-markdown/src/pages/jsx-expressions.md deleted file mode 100644 index b87efbb2d8895..0000000000000 --- a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/jsx-expressions.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Blog Post with JSX expressions -paragraph: JSX at the start of the line! -list: ['test-1', 'test-2', 'test-3'] ---- - -## {frontmatter.title} - -{frontmatter.paragraph} - -
    - {frontmatter.list.map(item =>
  • {item}
  • )} -
diff --git a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/namespace.md b/packages/markdown/component/test/fixtures/astro-markdown/src/pages/namespace.md deleted file mode 100644 index abbe26a3b0275..0000000000000 --- a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/namespace.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -setup: import ns from '../components/index.js'; ---- - -# Hello Namespace! - -Click me! diff --git a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/raw-content.json.js b/packages/markdown/component/test/fixtures/astro-markdown/src/pages/raw-content.json.js deleted file mode 100644 index 21be533e10208..0000000000000 --- a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/raw-content.json.js +++ /dev/null @@ -1,10 +0,0 @@ -import { rawContent, compiledContent } from '../imported-md/with-components.md'; - -export async function get() { - return { - body: JSON.stringify({ - raw: rawContent(), - compiled: await compiledContent(), - }), - } -} diff --git a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/script.md b/packages/markdown/component/test/fixtures/astro-markdown/src/pages/script.md deleted file mode 100644 index f2b8bca882930..0000000000000 --- a/packages/markdown/component/test/fixtures/astro-markdown/src/pages/script.md +++ /dev/null @@ -1,7 +0,0 @@ -# Test - -## Let's try a script... - -This should work! - -