diff --git a/.changeset/cool-feet-rest.md b/.changeset/cool-feet-rest.md
new file mode 100644
index 000000000000..c2e724d8002c
--- /dev/null
+++ b/.changeset/cool-feet-rest.md
@@ -0,0 +1,7 @@
+---
+'@astrojs/solid-js': major
+---
+
+New `include` and `exclude` config options
+
+The Solid integration now has new `include` and `exclude` config options. Use these if you want to use Solid alongside another JSX framework; include specifies files to be compiled for Solid and `exclude` does the opposite.
diff --git a/.changeset/large-countries-share.md b/.changeset/large-countries-share.md
new file mode 100644
index 000000000000..b3101d2f2225
--- /dev/null
+++ b/.changeset/large-countries-share.md
@@ -0,0 +1,7 @@
+---
+'@astrojs/preact': major
+---
+
+New `include` and `exclude` config options
+
+The Preact integration now has new `include` and `exclude` config options. Use these if you want to use Preact alongside another JSX framework; include specifies files to be compiled for Preact and `exclude` does the opposite.
diff --git a/.changeset/perfect-horses-tell.md b/.changeset/perfect-horses-tell.md
new file mode 100644
index 000000000000..7723c665f4c2
--- /dev/null
+++ b/.changeset/perfect-horses-tell.md
@@ -0,0 +1,27 @@
+---
+'astro': major
+---
+
+Astro's JSX handling has been refactored with better support for each framework.
+
+Previously, Astro automatically scanned your components to determine which framework-specific transformations should be used. In practice, supporting advanced features like Fast Refresh with this approach proved difficult.
+
+Now, Astro determines which framework to use with `include` and `exclude` config options where you can specify files and folders on a per-framework basis. When using multiple JSX frameworks in the same project, users should manually control which files belong to each framework using the `include` and `exclude` options.
+
+```js
+export default defineConfig({
+ // The `include` config is only needed in projects that use multiple JSX frameworks;
+ // if only using one no extra config is needed.
+ integrations: [
+ preact({
+ include: ['**/preact/*']
+ }),
+ react({
+ include: ['**/react/*']
+ }),
+ solid({
+ include: ['**/solid/*'],
+ }),
+ ]
+});
+```
diff --git a/.changeset/slimy-carrots-sell.md b/.changeset/slimy-carrots-sell.md
new file mode 100644
index 000000000000..c1c9e694f56f
--- /dev/null
+++ b/.changeset/slimy-carrots-sell.md
@@ -0,0 +1,9 @@
+---
+'@astrojs/react': major
+---
+
+Support for React Refresh
+
+The React integration now fully supports React Refresh and is backed by `@vitejs/plugin-react`.
+
+Also included in this change are new `include` and `exclude` config options. Use these if you want to use React alongside another JSX framework; include specifies files to be compiled for React and `exclude` does the opposite.
diff --git a/examples/framework-multiple/astro.config.mjs b/examples/framework-multiple/astro.config.mjs
index 4b50887cd70c..36f75aec2610 100644
--- a/examples/framework-multiple/astro.config.mjs
+++ b/examples/framework-multiple/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ react({ include: ['**/react/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/examples/framework-multiple/src/components/PreactCounter.tsx b/examples/framework-multiple/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from examples/framework-multiple/src/components/PreactCounter.tsx
rename to examples/framework-multiple/src/components/preact/PreactCounter.tsx
diff --git a/examples/framework-multiple/src/components/ReactCounter.tsx b/examples/framework-multiple/src/components/react/ReactCounter.tsx
similarity index 100%
rename from examples/framework-multiple/src/components/ReactCounter.tsx
rename to examples/framework-multiple/src/components/react/ReactCounter.tsx
diff --git a/examples/framework-multiple/src/components/SolidCounter.tsx b/examples/framework-multiple/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from examples/framework-multiple/src/components/SolidCounter.tsx
rename to examples/framework-multiple/src/components/solid/SolidCounter.tsx
diff --git a/examples/framework-multiple/src/components/SvelteCounter.svelte b/examples/framework-multiple/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from examples/framework-multiple/src/components/SvelteCounter.svelte
rename to examples/framework-multiple/src/components/svelte/SvelteCounter.svelte
diff --git a/examples/framework-multiple/src/components/VueCounter.vue b/examples/framework-multiple/src/components/vue/VueCounter.vue
similarity index 100%
rename from examples/framework-multiple/src/components/VueCounter.vue
rename to examples/framework-multiple/src/components/vue/VueCounter.vue
diff --git a/examples/framework-multiple/src/pages/index.astro b/examples/framework-multiple/src/pages/index.astro
index 94630aa1ebfb..ccf5aaa715af 100644
--- a/examples/framework-multiple/src/pages/index.astro
+++ b/examples/framework-multiple/src/pages/index.astro
@@ -4,12 +4,12 @@ import '../styles/global.css';
// Component Imports
// For JSX components, all the common ways of exporting (under a namespace, specific export, default export etc) are supported!
-import * as react from '../components/ReactCounter';
-import { PreactCounter } from '../components/PreactCounter';
-import SolidCounter from '../components/SolidCounter';
+import * as react from '../components/react/ReactCounter';
+import { PreactCounter } from '../components/preact/PreactCounter';
+import SolidCounter from '../components/solid/SolidCounter';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/errors.test.js b/packages/astro/e2e/errors.test.js
index e23b22c654cb..2a5a83acecc4 100644
--- a/packages/astro/e2e/errors.test.js
+++ b/packages/astro/e2e/errors.test.js
@@ -75,7 +75,7 @@ test.describe('Error display', () => {
const fileExists = astro.pathExists(absoluteFileUrl);
expect(fileExists).toBeTruthy();
- expect(fileLocation).toMatch(/^components\/PreactRuntimeError.jsx/);
+ expect(fileLocation).toMatch(/^preact\/PreactRuntimeError.jsx/);
});
test('shows correct line when a style preprocess has an error', async ({ page, astro }) => {
@@ -105,7 +105,7 @@ test.describe('Error display', () => {
// Wait for page reload
page.waitForNavigation(),
// Edit the component file
- astro.editFile('./src/components/SvelteSyntaxError.svelte', () => `
`),
]);
expect(await page.locator('vite-error-overlay').count()).toEqual(0);
diff --git a/packages/astro/e2e/fixtures/client-only/astro.config.mjs b/packages/astro/e2e/fixtures/client-only/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/client-only/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/client-only/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/client-only/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/client-only/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/client-only/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/client-only/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/client-only/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/client-only/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/client-only/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/client-only/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/client-only/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/client-only/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/client-only/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/client-only/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/client-only/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/client-only/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/client-only/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/client-only/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/client-only/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/client-only/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/client-only/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/client-only/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/client-only/src/pages/index.astro b/packages/astro/e2e/fixtures/client-only/src/pages/index.astro
index 708ba1582dc9..0b4299600881 100644
--- a/packages/astro/e2e/fixtures/client-only/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/client-only/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import * as react from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import * as react from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.jsx';
+import SolidCounter from '../components/solid/SolidCounter.jsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/errors/astro.config.mjs b/packages/astro/e2e/fixtures/errors/astro.config.mjs
index 8f27d8fabf35..48e8736bdba7 100644
--- a/packages/astro/e2e/fixtures/errors/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/errors/astro.config.mjs
@@ -7,5 +7,11 @@ import vue from '@astrojs/vue';
// https://astro.build/config
export default defineConfig({
- integrations: [react(), preact(), solid(), svelte(), vue()],
-});
\ No newline at end of file
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
+});
diff --git a/packages/astro/e2e/fixtures/errors/src/components/PreactRuntimeError.jsx b/packages/astro/e2e/fixtures/errors/src/components/preact/PreactRuntimeError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/PreactRuntimeError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/preact/PreactRuntimeError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/PreactSyntaxError.jsx b/packages/astro/e2e/fixtures/errors/src/components/preact/PreactSyntaxError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/PreactSyntaxError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/preact/PreactSyntaxError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/ReactRuntimeError.jsx b/packages/astro/e2e/fixtures/errors/src/components/react/ReactRuntimeError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/ReactRuntimeError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/react/ReactRuntimeError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/ReactSyntaxError.jsx b/packages/astro/e2e/fixtures/errors/src/components/react/ReactSyntaxError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/ReactSyntaxError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/react/ReactSyntaxError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/SolidRuntimeError.jsx b/packages/astro/e2e/fixtures/errors/src/components/solid/SolidRuntimeError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/SolidRuntimeError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/solid/SolidRuntimeError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/SolidSyntaxError.jsx b/packages/astro/e2e/fixtures/errors/src/components/solid/SolidSyntaxError.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/SolidSyntaxError.jsx
rename to packages/astro/e2e/fixtures/errors/src/components/solid/SolidSyntaxError.jsx
diff --git a/packages/astro/e2e/fixtures/errors/src/components/SvelteDirectiveError.svelte b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteDirectiveError.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/SvelteDirectiveError.svelte
rename to packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteDirectiveError.svelte
diff --git a/packages/astro/e2e/fixtures/errors/src/components/SvelteRuntimeError.svelte b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/SvelteRuntimeError.svelte
rename to packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteRuntimeError.svelte
diff --git a/packages/astro/e2e/fixtures/errors/src/components/SvelteSyntaxError.svelte b/packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteSyntaxError.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/SvelteSyntaxError.svelte
rename to packages/astro/e2e/fixtures/errors/src/components/svelte/SvelteSyntaxError.svelte
diff --git a/packages/astro/e2e/fixtures/errors/src/components/VueRuntimeError.vue b/packages/astro/e2e/fixtures/errors/src/components/vue/VueRuntimeError.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/VueRuntimeError.vue
rename to packages/astro/e2e/fixtures/errors/src/components/vue/VueRuntimeError.vue
diff --git a/packages/astro/e2e/fixtures/errors/src/components/VueSyntaxError.vue b/packages/astro/e2e/fixtures/errors/src/components/vue/VueSyntaxError.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/errors/src/components/VueSyntaxError.vue
rename to packages/astro/e2e/fixtures/errors/src/components/vue/VueSyntaxError.vue
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/astro-client-media-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/astro-client-media-error.astro
index 46bb9a2c459f..94e124c9a475 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/astro-client-media-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/astro-client-media-error.astro
@@ -1,7 +1,7 @@
---
-import SvelteDirectiveError from '../components/SvelteDirectiveError.svelte';
+import SvelteDirectiveError from '../components/svelte/SvelteDirectiveError.svelte';
---
-
\ No newline at end of file
+
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/astro-hydration-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/astro-hydration-error.astro
index 1852539eb0c7..8fcd56bd41cf 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/astro-hydration-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/astro-hydration-error.astro
@@ -1,7 +1,7 @@
---
-import SvelteDirectiveError from '../components/SvelteDirectiveError.svelte';
+import SvelteDirectiveError from '../components/svelte/SvelteDirectiveError.svelte';
---
-
\ No newline at end of file
+
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/preact-runtime-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/preact-runtime-error.astro
index 5c0aa2526b7e..17ad92808a97 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/preact-runtime-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/preact-runtime-error.astro
@@ -1,5 +1,5 @@
---
-import PreactRuntimeError from '../components/PreactRuntimeError.jsx';
+import PreactRuntimeError from '../components/preact/PreactRuntimeError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/preact-syntax-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/preact-syntax-error.astro
index 6748b0366931..b0f709b9d1ff 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/preact-syntax-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/preact-syntax-error.astro
@@ -1,5 +1,5 @@
---
-import PreactSyntaxError from '../components/PreactSyntaxError.jsx';
+import PreactSyntaxError from '../components/preact/PreactSyntaxError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/react-runtime-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/react-runtime-error.astro
index f1df8ec992e2..18490518e8f8 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/react-runtime-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/react-runtime-error.astro
@@ -1,5 +1,5 @@
---
-import ReactRuntimeError from '../components/ReactRuntimeError.jsx';
+import ReactRuntimeError from '../components/react/ReactRuntimeError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/react-syntax-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/react-syntax-error.astro
index 6e61ae31db33..c11b49ae0726 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/react-syntax-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/react-syntax-error.astro
@@ -1,5 +1,5 @@
---
-import ReactSyntaxError from '../components/ReactSyntaxError.jsx';
+import ReactSyntaxError from '../components/react/ReactSyntaxError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/solid-runtime-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/solid-runtime-error.astro
index 51a2608bd76d..7d4160126d61 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/solid-runtime-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/solid-runtime-error.astro
@@ -1,5 +1,5 @@
---
-import SolidRuntimeError from '../components/SolidRuntimeError.jsx';
+import SolidRuntimeError from '../components/solid/SolidRuntimeError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/solid-syntax-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/solid-syntax-error.astro
index 0fdbad25b9c9..028ab9ede91c 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/solid-syntax-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/solid-syntax-error.astro
@@ -1,5 +1,5 @@
---
-import SolidSyntaxError from '../components/SolidSyntaxError.jsx';
+import SolidSyntaxError from '../components/solid/SolidSyntaxError.jsx';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/svelte-runtime-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/svelte-runtime-error.astro
index ec499f6db552..662a48f0e6f8 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/svelte-runtime-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/svelte-runtime-error.astro
@@ -1,5 +1,5 @@
---
-import SvelteRuntimeError from '../components/SvelteRuntimeError.svelte';
+import SvelteRuntimeError from '../components/svelte/SvelteRuntimeError.svelte';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/svelte-syntax-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/svelte-syntax-error.astro
index 26c14c15ea61..e275251a4757 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/svelte-syntax-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/svelte-syntax-error.astro
@@ -1,5 +1,5 @@
---
-import SvelteSyntaxError from '../components/SvelteSyntaxError.svelte';
+import SvelteSyntaxError from '../components/svelte/SvelteSyntaxError.svelte';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/vue-runtime-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/vue-runtime-error.astro
index b63f85e63309..698da561f364 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/vue-runtime-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/vue-runtime-error.astro
@@ -1,5 +1,5 @@
---
-import VueRuntimeError from '../components/VueRuntimeError.vue';
+import VueRuntimeError from '../components/vue/VueRuntimeError.vue';
---
diff --git a/packages/astro/e2e/fixtures/errors/src/pages/vue-syntax-error.astro b/packages/astro/e2e/fixtures/errors/src/pages/vue-syntax-error.astro
index 8db897fe1197..c76ed16fe66a 100644
--- a/packages/astro/e2e/fixtures/errors/src/pages/vue-syntax-error.astro
+++ b/packages/astro/e2e/fixtures/errors/src/pages/vue-syntax-error.astro
@@ -1,5 +1,5 @@
---
-import VueSyntaxError from '../components/VueSyntaxError.vue';
+import VueSyntaxError from '../components/vue/VueSyntaxError.vue';
---
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/astro.config.mjs b/packages/astro/e2e/fixtures/multiple-frameworks/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/multiple-frameworks/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/multiple-frameworks/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/multiple-frameworks/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/multiple-frameworks/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/multiple-frameworks/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/multiple-frameworks/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/multiple-frameworks/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/multiple-frameworks/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/multiple-frameworks/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/multiple-frameworks/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/multiple-frameworks/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/multiple-frameworks/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/multiple-frameworks/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/multiple-frameworks/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/multiple-frameworks/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/multiple-frameworks/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/multiple-frameworks/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/multiple-frameworks/src/pages/index.astro b/packages/astro/e2e/fixtures/multiple-frameworks/src/pages/index.astro
index a30688bca8ae..747744852c8c 100644
--- a/packages/astro/e2e/fixtures/multiple-frameworks/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/multiple-frameworks/src/pages/index.astro
@@ -3,11 +3,11 @@
import '../styles/global.css';
// Component Imports
import { A, B as Renamed } from '../components';
-import * as react from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import * as react from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/astro.config.mjs b/packages/astro/e2e/fixtures/nested-in-preact/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-in-preact/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-in-preact/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-in-preact/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-preact/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-preact/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-in-preact/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-preact/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-in-preact/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-in-preact/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-preact/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-preact/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-in-preact/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-preact/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-in-preact/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-in-preact/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-preact/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-in-preact/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-in-preact/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-in-preact/src/pages/index.astro
index 619e8cccd0ae..7512b86f4dd6 100644
--- a/packages/astro/e2e/fixtures/nested-in-preact/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-in-preact/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import ReactCounter from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import ReactCounter from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-in-react/astro.config.mjs b/packages/astro/e2e/fixtures/nested-in-react/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-in-react/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-in-react/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-in-react/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-react/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-react/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-in-react/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-react/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-in-react/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-in-react/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-react/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-react/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-in-react/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-react/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-in-react/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-in-react/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-react/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-in-react/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-in-react/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-in-react/src/pages/index.astro
index 0b3b23d9d8e8..fe18a3151201 100644
--- a/packages/astro/e2e/fixtures/nested-in-react/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-in-react/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import ReactCounter from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import ReactCounter from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/astro.config.mjs b/packages/astro/e2e/fixtures/nested-in-solid/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-in-solid/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-in-solid/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-in-solid/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-solid/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-solid/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-in-solid/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-solid/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-in-solid/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-in-solid/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-solid/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-solid/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-in-solid/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-solid/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-in-solid/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-in-solid/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-solid/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-in-solid/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-in-solid/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-in-solid/src/pages/index.astro
index 0feb5ba60035..7b2c8da8d220 100644
--- a/packages/astro/e2e/fixtures/nested-in-solid/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-in-solid/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import { Counter as ReactCounter } from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import { Counter as ReactCounter } from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/astro.config.mjs b/packages/astro/e2e/fixtures/nested-in-svelte/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-in-svelte/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-in-svelte/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-in-svelte/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-svelte/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-svelte/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-in-svelte/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-svelte/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-in-svelte/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-in-svelte/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-svelte/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-svelte/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-in-svelte/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-svelte/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-in-svelte/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-in-svelte/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-svelte/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-in-svelte/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-in-svelte/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-in-svelte/src/pages/index.astro
index 764ebfaf702e..aa11de7fd862 100644
--- a/packages/astro/e2e/fixtures/nested-in-svelte/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-in-svelte/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import { Counter as ReactCounter } from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import { Counter as ReactCounter } from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/astro.config.mjs b/packages/astro/e2e/fixtures/nested-in-vue/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-in-vue/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-in-vue/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-in-vue/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-vue/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-vue/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-in-vue/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-vue/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-in-vue/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-in-vue/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-vue/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-in-vue/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-in-vue/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-vue/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-in-vue/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-in-vue/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-in-vue/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-in-vue/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-in-vue/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-in-vue/src/pages/index.astro
index 5e4d47d768b3..e89554755e7d 100644
--- a/packages/astro/e2e/fixtures/nested-in-vue/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-in-vue/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import { Counter as ReactCounter } from '../components/ReactCounter.jsx';
-import { PreactCounter } from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import { Counter as ReactCounter } from '../components/react/ReactCounter.jsx';
+import { PreactCounter } from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
diff --git a/packages/astro/e2e/fixtures/nested-recursive/astro.config.mjs b/packages/astro/e2e/fixtures/nested-recursive/astro.config.mjs
index 4b50887cd70c..0ef8f6e2b363 100644
--- a/packages/astro/e2e/fixtures/nested-recursive/astro.config.mjs
+++ b/packages/astro/e2e/fixtures/nested-recursive/astro.config.mjs
@@ -8,5 +8,11 @@ import solid from '@astrojs/solid-js';
// https://astro.build/config
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
- integrations: [preact(), react(), svelte(), vue(), solid()],
+ integrations: [
+ react({ include: ['**/react/*'] }),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ svelte(),
+ vue(),
+ ],
});
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/components/PreactCounter.tsx b/packages/astro/e2e/fixtures/nested-recursive/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-recursive/src/components/PreactCounter.tsx
rename to packages/astro/e2e/fixtures/nested-recursive/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/components/ReactCounter.jsx b/packages/astro/e2e/fixtures/nested-recursive/src/components/react/ReactCounter.jsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-recursive/src/components/ReactCounter.jsx
rename to packages/astro/e2e/fixtures/nested-recursive/src/components/react/ReactCounter.jsx
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/components/SolidCounter.tsx b/packages/astro/e2e/fixtures/nested-recursive/src/components/solid/SolidCounter.tsx
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-recursive/src/components/SolidCounter.tsx
rename to packages/astro/e2e/fixtures/nested-recursive/src/components/solid/SolidCounter.tsx
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/components/SvelteCounter.svelte b/packages/astro/e2e/fixtures/nested-recursive/src/components/svelte/SvelteCounter.svelte
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-recursive/src/components/SvelteCounter.svelte
rename to packages/astro/e2e/fixtures/nested-recursive/src/components/svelte/SvelteCounter.svelte
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/components/VueCounter.vue b/packages/astro/e2e/fixtures/nested-recursive/src/components/vue/VueCounter.vue
similarity index 100%
rename from packages/astro/e2e/fixtures/nested-recursive/src/components/VueCounter.vue
rename to packages/astro/e2e/fixtures/nested-recursive/src/components/vue/VueCounter.vue
diff --git a/packages/astro/e2e/fixtures/nested-recursive/src/pages/index.astro b/packages/astro/e2e/fixtures/nested-recursive/src/pages/index.astro
index 685c7fb5ed70..a17337c897fd 100644
--- a/packages/astro/e2e/fixtures/nested-recursive/src/pages/index.astro
+++ b/packages/astro/e2e/fixtures/nested-recursive/src/pages/index.astro
@@ -1,9 +1,9 @@
---
-import ReactCounter from '../components/ReactCounter.jsx';
-import PreactCounter from '../components/PreactCounter.tsx';
-import SolidCounter from '../components/SolidCounter.tsx';
-import VueCounter from '../components/VueCounter.vue';
-import SvelteCounter from '../components/SvelteCounter.svelte';
+import ReactCounter from '../components/react/ReactCounter.jsx';
+import PreactCounter from '../components/preact/PreactCounter.tsx';
+import SolidCounter from '../components/solid/SolidCounter.tsx';
+import VueCounter from '../components/vue/VueCounter.vue';
+import SvelteCounter from '../components/svelte/SvelteCounter.svelte';
---
diff --git a/packages/astro/src/core/build/plugins/plugin-renderers.ts b/packages/astro/src/core/build/plugins/plugin-renderers.ts
index 912df42418f0..f0cdf898331b 100644
--- a/packages/astro/src/core/build/plugins/plugin-renderers.ts
+++ b/packages/astro/src/core/build/plugins/plugin-renderers.ts
@@ -38,6 +38,8 @@ export function vitePluginRenderers(opts: StaticBuildOptions): VitePlugin {
exports.push(`export const renderers = [${rendererItems}];`);
return `${imports.join('\n')}\n${exports.join('\n')}`;
+ } else {
+ return `export const renderers = [];`;
}
}
},
diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts
index c0274f60293f..1d0938c00f33 100644
--- a/packages/astro/src/core/config/settings.ts
+++ b/packages/astro/src/core/config/settings.ts
@@ -3,7 +3,6 @@ import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type { AstroConfig, AstroSettings } from '../../@types/astro';
import { getContentPaths } from '../../content/index.js';
-import jsxRenderer from '../../jsx/renderer.js';
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
import { getDefaultClientDirectives } from '../client-directive/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
@@ -96,7 +95,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
},
},
],
- renderers: [jsxRenderer],
+ renderers: [],
scripts: [],
clientDirectives: getDefaultClientDirectives(),
watchFiles: [],
diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts
index efb78d137496..846d6109d3a0 100644
--- a/packages/astro/src/core/create-vite.ts
+++ b/packages/astro/src/core/create-vite.ts
@@ -19,9 +19,9 @@ import configAliasVitePlugin from '../vite-plugin-config-alias/index.js';
import envVitePlugin from '../vite-plugin-env/index.js';
import astroHeadPlugin from '../vite-plugin-head/index.js';
import htmlVitePlugin from '../vite-plugin-html/index.js';
+import mdxVitePlugin from '../vite-plugin-mdx/index.js';
import { astroInjectEnvTsPlugin } from '../vite-plugin-inject-env-ts/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 markdownVitePlugin from '../vite-plugin-markdown/index.js';
import astroScannerPlugin from '../vite-plugin-scanner/index.js';
@@ -121,7 +121,7 @@ export async function createVite(
envVitePlugin({ settings }),
markdownVitePlugin({ settings, logging }),
htmlVitePlugin(),
- jsxVitePlugin({ settings, logging }),
+ mdxVitePlugin({ settings, logging }),
astroPostprocessVitePlugin(),
astroIntegrationsContainerPlugin({ settings, logging }),
astroScriptsPageSSRPlugin({ settings }),
diff --git a/packages/astro/src/vite-plugin-jsx/index.ts b/packages/astro/src/vite-plugin-jsx/index.ts
deleted file mode 100644
index 7aa7e7b1642b..000000000000
--- a/packages/astro/src/vite-plugin-jsx/index.ts
+++ /dev/null
@@ -1,251 +0,0 @@
-import type { TransformResult } from 'rollup';
-import {
- transformWithEsbuild,
- type EsbuildTransformOptions,
- type Plugin,
- type ResolvedConfig,
-} from 'vite';
-import type { AstroRenderer, AstroSettings } from '../@types/astro';
-import type { LogOptions } from '../core/logger/core.js';
-import type { PluginMetadata } from '../vite-plugin-astro/types';
-
-import babel from '@babel/core';
-import * as colors from 'kleur/colors';
-import path from 'node:path';
-import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from '../content/index.js';
-import { astroEntryPrefix } from '../core/build/plugins/plugin-component-entry.js';
-import { error } from '../core/logger/core.js';
-import { removeQueryString } from '../core/path.js';
-import { detectImportSource } from './import-source.js';
-import tagExportsPlugin from './tag.js';
-
-const JSX_EXTENSIONS = new Set(['.jsx', '.tsx', '.mdx']);
-const IMPORT_STATEMENTS: Record = {
- react: "import React from 'react'",
- preact: "import { h } from 'preact'",
- 'solid-js': "import 'solid-js'",
- astro: "import 'astro/jsx-runtime'",
-};
-
-function getEsbuildLoader(filePath: string): EsbuildTransformOptions['loader'] {
- const fileExt = path.extname(filePath);
- if (fileExt === '.mdx') return 'jsx';
- return fileExt.slice(1) as EsbuildTransformOptions['loader'];
-}
-
-function collectJSXRenderers(renderers: AstroRenderer[]): Map {
- const renderersWithJSXSupport = renderers.filter((r) => r.jsxImportSource);
- return new Map(
- renderersWithJSXSupport.map((r) => [r.jsxImportSource, r] as [string, AstroRenderer])
- );
-}
-
-interface TransformJSXOptions {
- code: string;
- id: string;
- mode: string;
- renderer: AstroRenderer;
- ssr: boolean;
- root: URL;
-}
-
-async function transformJSX({
- code,
- mode,
- id,
- ssr,
- renderer,
- root,
-}: TransformJSXOptions): Promise {
- const { jsxTransformOptions } = renderer;
- const options = await jsxTransformOptions!({ mode, ssr });
- const plugins = [...(options.plugins || [])];
- if (ssr) {
- plugins.push(await tagExportsPlugin({ rendererName: renderer.name, root }));
- }
- const result = await babel.transformAsync(code, {
- presets: options.presets,
- plugins,
- cwd: process.cwd(),
- filename: id,
- ast: false,
- compact: false,
- sourceMaps: true,
- configFile: false,
- babelrc: false,
- inputSourceMap: options.inputSourceMap,
- });
- // TODO: Be more strict about bad return values here.
- // Should we throw an error instead? Should we never return `{code: ""}`?
- if (!result) return null;
-
- if (renderer.name === 'astro:jsx') {
- const { astro } = result.metadata as unknown as PluginMetadata;
- return {
- code: result.code || '',
- map: result.map,
- meta: {
- astro,
- vite: {
- // Setting this vite metadata to `ts` causes Vite to resolve .js
- // extensions to .ts files.
- lang: 'ts',
- },
- },
- };
- }
-
- return {
- code: result.code || '',
- map: result.map,
- };
-}
-
-interface AstroPluginJSXOptions {
- settings: AstroSettings;
- logging: LogOptions;
-}
-
-// Format inspired by https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L54
-const SPECIAL_QUERY_REGEX = new RegExp(
- `[?&](?:worker|sharedworker|raw|url|${CONTENT_FLAG}|${PROPAGATED_ASSET_FLAG})\\b`
-);
-
-/** Use Astro config to allow for alternate or multiple JSX renderers (by default Vite will assume React) */
-export default function jsx({ settings, logging }: AstroPluginJSXOptions): Plugin {
- let viteConfig: ResolvedConfig;
- const jsxRenderers = new Map();
- const jsxRenderersIntegrationOnly = new Map();
- // A reference to Astro's internal JSX renderer.
- let astroJSXRenderer: AstroRenderer;
- // The first JSX renderer provided is considered the default renderer.
- // This is a useful reference for when the user only gives a single render.
- let defaultJSXRendererEntry: [string, AstroRenderer] | undefined;
-
- return {
- name: 'astro:jsx',
- enforce: 'pre', // run transforms before other plugins
- async configResolved(resolvedConfig) {
- viteConfig = resolvedConfig;
- const possibleRenderers = collectJSXRenderers(settings.renderers);
- for (const [importSource, renderer] of possibleRenderers) {
- jsxRenderers.set(importSource, renderer);
- if (importSource === 'astro') {
- astroJSXRenderer = renderer;
- } else {
- jsxRenderersIntegrationOnly.set(importSource, renderer);
- }
- }
- defaultJSXRendererEntry = [...jsxRenderersIntegrationOnly.entries()][0];
- },
- async transform(code, id, opts) {
- const ssr = Boolean(opts?.ssr);
- // Skip special queries and astro entries. We skip astro entries here as we know it doesn't contain
- // JSX code, and also because we can't detect the import source to apply JSX transforms.
- if (SPECIAL_QUERY_REGEX.test(id) || id.startsWith(astroEntryPrefix)) {
- return null;
- }
- id = removeQueryString(id);
- if (!JSX_EXTENSIONS.has(path.extname(id))) {
- return null;
- }
-
- const { mode } = viteConfig;
- // Shortcut: only use Astro renderer for MD and MDX files
- if (id.endsWith('.mdx')) {
- const { code: jsxCode } = await transformWithEsbuild(code, id, {
- loader: getEsbuildLoader(id),
- jsx: 'preserve',
- sourcemap: 'inline',
- tsconfigRaw: {
- compilerOptions: {
- // Ensure client:only imports are treeshaken
- verbatimModuleSyntax: false,
- importsNotUsedAsValues: 'remove',
- },
- },
- });
- return transformJSX({
- code: jsxCode,
- id,
- renderer: astroJSXRenderer,
- mode,
- ssr,
- root: settings.config.root,
- });
- }
- if (defaultJSXRendererEntry && jsxRenderersIntegrationOnly.size === 1) {
- // downlevel any non-standard syntax, but preserve JSX
- const { code: jsxCode } = await transformWithEsbuild(code, id, {
- loader: getEsbuildLoader(id),
- jsx: 'preserve',
- sourcemap: 'inline',
- });
- return transformJSX({
- code: jsxCode,
- id,
- renderer: defaultJSXRendererEntry[1],
- mode,
- ssr,
- root: settings.config.root,
- });
- }
-
- const importSource = await detectImportSource(code, jsxRenderers, settings.tsConfig);
-
- // if we still can’t tell the import source, now is the time to throw an error.
- if (!importSource && defaultJSXRendererEntry) {
- const [defaultRendererName] = defaultJSXRendererEntry;
- error(
- logging,
- 'renderer',
- `${colors.yellow(id)}
-Unable to resolve a renderer that handles this file! With more than one renderer enabled, you should include an import or use a pragma comment.
-Add ${colors.cyan(
- IMPORT_STATEMENTS[defaultRendererName] || `import '${defaultRendererName}';`
- )} or ${colors.cyan(`/** @jsxImportSource: ${defaultRendererName} */`)} to this file.
-`
- );
- return null;
- } else if (!importSource) {
- error(
- logging,
- 'renderer',
- `${colors.yellow(id)}
-Unable to find a renderer for JSX. Do you have one configured in your Astro config? See this page to learn how:
-https://docs.astro.build/en/core-concepts/framework-components/#installing-integrations
-`
- );
- return null;
- }
-
- const selectedJsxRenderer = jsxRenderers.get(importSource);
- // if the renderer is not installed for this JSX source, throw error
- if (!selectedJsxRenderer) {
- error(
- logging,
- 'renderer',
- `${colors.yellow(
- id
- )} No renderer installed for ${importSource}. Try adding \`@astrojs/${importSource}\` to your project.`
- );
- return null;
- }
-
- // downlevel any non-standard syntax, but preserve JSX
- const { code: jsxCode } = await transformWithEsbuild(code, id, {
- loader: getEsbuildLoader(id),
- jsx: 'preserve',
- sourcemap: 'inline',
- });
- return await transformJSX({
- code: jsxCode,
- id,
- renderer: selectedJsxRenderer,
- mode,
- ssr,
- root: settings.config.root,
- });
- },
- };
-}
diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts
index dd2cbcd85cf4..aff27f7a6d4b 100644
--- a/packages/astro/src/vite-plugin-markdown/index.ts
+++ b/packages/astro/src/vite-plugin-markdown/index.ts
@@ -49,11 +49,6 @@ function safeMatter(source: string, id: string) {
}
}
-// absolute path of "astro/jsx-runtime"
-const astroJsxRuntimeModulePath = normalizePath(
- fileURLToPath(new URL('../jsx-runtime/index.js', import.meta.url))
-);
-
const astroServerRuntimeModulePath = normalizePath(
fileURLToPath(new URL('../runtime/server/index.js', import.meta.url))
);
@@ -115,8 +110,7 @@ export default function markdown({ settings, logging }: AstroPluginOptions): Plu
}
const code = escapeViteEnvReferences(`
- import { Fragment, jsx as h } from ${JSON.stringify(astroJsxRuntimeModulePath)};
- import { spreadAttributes } from ${JSON.stringify(astroServerRuntimeModulePath)};
+ import { unescapeHTML, spreadAttributes, createComponent, render, renderComponent } from ${JSON.stringify(astroServerRuntimeModulePath)};
import { AstroError, AstroErrorData } from ${JSON.stringify(astroErrorModulePath)};
${layout ? `import Layout from ${JSON.stringify(layout)};` : ''}
@@ -167,27 +161,29 @@ export default function markdown({ settings, logging }: AstroPluginOptions): Plu
export function getHeadings() {
return ${JSON.stringify(headings)};
}
- export async function Content() {
+
+ export const Content = createComponent((result, _props, slots) => {
const { layout, ...content } = frontmatter;
content.file = file;
content.url = url;
- const contentFragment = h(Fragment, { 'set:html': html });
+
return ${
layout
- ? `h(Layout, {
- file,
- url,
- content,
- frontmatter: content,
- headings: getHeadings(),
- rawContent,
- compiledContent,
- 'server:root': true,
- children: contentFragment
- })`
- : `contentFragment`
- };
- }
+ ? `render\`\${renderComponent(result, 'Layout', Layout, {
+ file,
+ url,
+ content,
+ frontmatter: content,
+ headings: getHeadings(),
+ rawContent,
+ compiledContent,
+ 'server:root': true,
+ }, {
+ 'default': () => render\`\${unescapeHTML(html)}\`
+ })}\`;`
+ : `render\`\${unescapeHTML(html)}\`;`
+ }
+ });
Content[Symbol.for('astro.needsHeadRendering')] = ${layout ? 'false' : 'true'};
export default Content;
`);
diff --git a/packages/astro/src/vite-plugin-jsx/README.md b/packages/astro/src/vite-plugin-mdx/README.md
similarity index 100%
rename from packages/astro/src/vite-plugin-jsx/README.md
rename to packages/astro/src/vite-plugin-mdx/README.md
diff --git a/packages/astro/src/vite-plugin-jsx/import-source.ts b/packages/astro/src/vite-plugin-mdx/import-source.ts
similarity index 100%
rename from packages/astro/src/vite-plugin-jsx/import-source.ts
rename to packages/astro/src/vite-plugin-mdx/import-source.ts
diff --git a/packages/astro/src/vite-plugin-mdx/index.ts b/packages/astro/src/vite-plugin-mdx/index.ts
new file mode 100644
index 000000000000..473c4a78e12b
--- /dev/null
+++ b/packages/astro/src/vite-plugin-mdx/index.ts
@@ -0,0 +1,134 @@
+import type { TransformResult } from 'rollup';
+import {
+ transformWithEsbuild,
+ type Plugin,
+ type ResolvedConfig,
+} from 'vite';
+import type { AstroRenderer, AstroSettings } from '../@types/astro';
+import type { LogOptions } from '../core/logger/core.js';
+import type { PluginMetadata } from '../vite-plugin-astro/types';
+
+import babel from '@babel/core';
+import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from '../content/index.js';
+import { astroEntryPrefix } from '../core/build/plugins/plugin-component-entry.js';
+import { removeQueryString } from '../core/path.js';
+import tagExportsPlugin from './tag.js';
+
+interface TransformJSXOptions {
+ code: string;
+ id: string;
+ mode: string;
+ renderer: AstroRenderer;
+ ssr: boolean;
+ root: URL;
+}
+
+async function transformJSX({
+ code,
+ mode,
+ id,
+ ssr,
+ renderer,
+ root,
+}: TransformJSXOptions): Promise {
+ const { jsxTransformOptions } = renderer;
+ const options = await jsxTransformOptions!({ mode, ssr });
+ const plugins = [...(options.plugins || [])];
+ if (ssr) {
+ plugins.push(await tagExportsPlugin({ rendererName: renderer.name, root }));
+ }
+ const result = await babel.transformAsync(code, {
+ presets: options.presets,
+ plugins,
+ cwd: process.cwd(),
+ filename: id,
+ ast: false,
+ compact: false,
+ sourceMaps: true,
+ configFile: false,
+ babelrc: false,
+ inputSourceMap: options.inputSourceMap,
+ });
+ // TODO: Be more strict about bad return values here.
+ // Should we throw an error instead? Should we never return `{code: ""}`?
+ if (!result) return null;
+
+ if (renderer.name === 'astro:jsx') {
+ const { astro } = result.metadata as unknown as PluginMetadata;
+ return {
+ code: result.code || '',
+ map: result.map,
+ meta: {
+ astro,
+ vite: {
+ // Setting this vite metadata to `ts` causes Vite to resolve .js
+ // extensions to .ts files.
+ lang: 'ts',
+ },
+ },
+ };
+ }
+
+ return {
+ code: result.code || '',
+ map: result.map,
+ };
+}
+
+interface AstroPluginJSXOptions {
+ settings: AstroSettings;
+ logging: LogOptions;
+}
+
+// Format inspired by https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L54
+const SPECIAL_QUERY_REGEX = new RegExp(
+ `[?&](?:worker|sharedworker|raw|url|${CONTENT_FLAG}|${PROPAGATED_ASSET_FLAG})\\b`
+);
+
+/** Use Astro config to allow for alternate or multiple JSX renderers (by default Vite will assume React) */
+export default function mdxVitePlugin({ settings }: AstroPluginJSXOptions): Plugin {
+ let viteConfig: ResolvedConfig;
+ // A reference to Astro's internal JSX renderer.
+ let astroJSXRenderer: AstroRenderer;
+
+ return {
+ name: 'astro:jsx',
+ enforce: 'pre', // run transforms before other plugins
+ async configResolved(resolvedConfig) {
+ viteConfig = resolvedConfig;
+ astroJSXRenderer = settings.renderers.find((r) => r.jsxImportSource === 'astro')!;
+ },
+ async transform(code, id, opts) {
+ // Skip special queries and astro entries. We skip astro entries here as we know it doesn't contain
+ // JSX code, and also because we can't detect the import source to apply JSX transforms.
+ if (SPECIAL_QUERY_REGEX.test(id) || id.startsWith(astroEntryPrefix)) {
+ return null;
+ }
+ id = removeQueryString(id);
+ // Shortcut: only use Astro renderer for MD and MDX files
+ if (!id.endsWith('.mdx')) {
+ return null;
+ }
+ const { code: jsxCode } = await transformWithEsbuild(code, id, {
+ loader: 'jsx',
+ jsx: 'preserve',
+ sourcemap: 'inline',
+ tsconfigRaw: {
+ compilerOptions: {
+ // Ensure client:only imports are treeshaken
+ verbatimModuleSyntax: false,
+ importsNotUsedAsValues: 'remove',
+ },
+ },
+ });
+ return transformJSX({
+ code: jsxCode,
+ id,
+ renderer: astroJSXRenderer,
+ mode: viteConfig.mode,
+ ssr: Boolean(opts?.ssr),
+ root: settings.config.root,
+ });
+ },
+ };
+}
diff --git a/packages/astro/src/vite-plugin-jsx/tag.ts b/packages/astro/src/vite-plugin-mdx/tag.ts
similarity index 100%
rename from packages/astro/src/vite-plugin-jsx/tag.ts
rename to packages/astro/src/vite-plugin-mdx/tag.ts
diff --git a/packages/astro/test/fixtures/astro-slots-nested/astro.config.mjs b/packages/astro/test/fixtures/astro-slots-nested/astro.config.mjs
index 4a8807ed05e2..6f37285c6bef 100644
--- a/packages/astro/test/fixtures/astro-slots-nested/astro.config.mjs
+++ b/packages/astro/test/fixtures/astro-slots-nested/astro.config.mjs
@@ -7,9 +7,9 @@ import vue from '@astrojs/vue';
export default defineConfig({
integrations: [
- react(),
- preact(),
- solid(),
+ preact({ include: ['**/preact/*'] }),
+ solid({ include: ['**/solid/*'] }),
+ react({ include: ['**/react/*'] }),
svelte(),
vue()
]
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildrenP.tsx b/packages/astro/test/fixtures/astro-slots-nested/src/components/preact/PassesChildrenP.tsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildrenP.tsx
rename to packages/astro/test/fixtures/astro-slots-nested/src/components/preact/PassesChildrenP.tsx
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/components/Inner.tsx b/packages/astro/test/fixtures/astro-slots-nested/src/components/react/Inner.tsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-slots-nested/src/components/Inner.tsx
rename to packages/astro/test/fixtures/astro-slots-nested/src/components/react/Inner.tsx
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/components/Parent.jsx b/packages/astro/test/fixtures/astro-slots-nested/src/components/react/Parent.jsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-slots-nested/src/components/Parent.jsx
rename to packages/astro/test/fixtures/astro-slots-nested/src/components/react/Parent.jsx
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildren.tsx b/packages/astro/test/fixtures/astro-slots-nested/src/components/react/PassesChildren.tsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildren.tsx
rename to packages/astro/test/fixtures/astro-slots-nested/src/components/react/PassesChildren.tsx
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildrenS.tsx b/packages/astro/test/fixtures/astro-slots-nested/src/components/solid/PassesChildrenS.tsx
similarity index 100%
rename from packages/astro/test/fixtures/astro-slots-nested/src/components/PassesChildrenS.tsx
rename to packages/astro/test/fixtures/astro-slots-nested/src/components/solid/PassesChildrenS.tsx
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/pages/component-slot.astro b/packages/astro/test/fixtures/astro-slots-nested/src/pages/component-slot.astro
index b9a03f887eb4..d803f3ff7b77 100644
--- a/packages/astro/test/fixtures/astro-slots-nested/src/pages/component-slot.astro
+++ b/packages/astro/test/fixtures/astro-slots-nested/src/pages/component-slot.astro
@@ -1,6 +1,6 @@
---
import SlotRender from '../components/SlotRender.astro'
-import Inner from '../components/Inner'
+import Inner from '../components/react/Inner'
---
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/pages/hidden-nested.astro b/packages/astro/test/fixtures/astro-slots-nested/src/pages/hidden-nested.astro
index e51ce00a0a8c..dcb3ebcba5b6 100644
--- a/packages/astro/test/fixtures/astro-slots-nested/src/pages/hidden-nested.astro
+++ b/packages/astro/test/fixtures/astro-slots-nested/src/pages/hidden-nested.astro
@@ -1,6 +1,6 @@
---
-import Parent from '../components/Parent'
-import Inner from '../components/Inner'
+import Parent from '../components/react/Parent'
+import Inner from '../components/react/Inner'
---
diff --git a/packages/astro/test/fixtures/astro-slots-nested/src/pages/server-component-nested.astro b/packages/astro/test/fixtures/astro-slots-nested/src/pages/server-component-nested.astro
index b5a3d72a0140..ec4ae3158beb 100644
--- a/packages/astro/test/fixtures/astro-slots-nested/src/pages/server-component-nested.astro
+++ b/packages/astro/test/fixtures/astro-slots-nested/src/pages/server-component-nested.astro
@@ -1,7 +1,7 @@
---
-import PassesChildren from '../components/PassesChildren.jsx';
-import PassesChildrenP from '../components/PassesChildrenP.jsx';
-import PassesChildrenS from '../components/PassesChildrenS.jsx';
+import PassesChildren from '../components/react/PassesChildren.jsx';
+import PassesChildrenP from '../components/preact/PassesChildrenP.jsx';
+import PassesChildrenS from '../components/solid/PassesChildrenS.jsx';
import PassesChildrenSv from '../components/PassesChildrenSv.svelte';
import PassesChildrenV from '../components/PassesChildrenV.vue';
---
diff --git a/packages/astro/test/fixtures/jsx/astro.config.mjs b/packages/astro/test/fixtures/jsx/astro.config.mjs
index 5b84d23a8f20..61d0d075e336 100644
--- a/packages/astro/test/fixtures/jsx/astro.config.mjs
+++ b/packages/astro/test/fixtures/jsx/astro.config.mjs
@@ -1,13 +1,27 @@
import { defineConfig } from 'astro/config';
import renderer from 'astro/jsx/renderer.js';
+import mdx from '@astrojs/mdx';
import preact from '@astrojs/preact';
import react from '@astrojs/react';
import svelte from '@astrojs/svelte';
import vue from '@astrojs/vue';
import solid from '@astrojs/solid-js';
+
export default defineConfig({
integrations: [
+ preact({
+ include: ['**/preact/*']
+ }),
+ react({
+ include: ['**/react/*']
+ }),
+ solid({
+ include: ['**/solid/*'],
+ }),
+ mdx(),
+ svelte(),
+ vue(),
{
name: '@astrojs/test-jsx',
hooks: {
@@ -16,10 +30,5 @@ export default defineConfig({
}
}
},
- preact(),
- react(),
- svelte(),
- vue(),
- solid(),
]
})
diff --git a/packages/astro/test/fixtures/jsx/package.json b/packages/astro/test/fixtures/jsx/package.json
index 1e7001b47ea3..e5b12ece4221 100644
--- a/packages/astro/test/fixtures/jsx/package.json
+++ b/packages/astro/test/fixtures/jsx/package.json
@@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
+ "@astrojs/mdx": "workspace:*",
"@astrojs/preact": "workspace:*",
"@astrojs/react": "workspace:*",
"@astrojs/solid-js": "workspace:*",
diff --git a/packages/astro/test/fixtures/jsx/src/components/Content.mdx b/packages/astro/test/fixtures/jsx/src/components/Content.mdx
new file mode 100644
index 000000000000..7a8bbc0f4309
--- /dev/null
+++ b/packages/astro/test/fixtures/jsx/src/components/Content.mdx
@@ -0,0 +1,5 @@
+import ReactCounter from './react/ReactCounter.jsx'
+
+# Hello world
+
+
diff --git a/packages/astro/test/fixtures/jsx/src/components/Frameworks.jsx b/packages/astro/test/fixtures/jsx/src/components/Frameworks.jsx
deleted file mode 100644
index 2cc17596457c..000000000000
--- a/packages/astro/test/fixtures/jsx/src/components/Frameworks.jsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import 'astro/jsx-runtime';
-import { Test } from "./Test";
-
-import PreactCounter from "./PreactCounter";
-import ReactCounter from "./ReactCounter";
-import SolidCounter from "./SolidCounter";
-import SvelteCounter from "./SvelteCounter.svelte";
-import VueCounter from "./VueCounter.vue";
-
-export function Preact() {
- return
-}
-
-export function React() {
- return
-}
-
-export function Solid() {
- return
-}
-
-export function Svelte() {
- return
-}
-
-export function Vue() {
- return
-}
diff --git a/packages/astro/test/fixtures/jsx/src/components/PreactCounter.tsx b/packages/astro/test/fixtures/jsx/src/components/preact/PreactCounter.tsx
similarity index 100%
rename from packages/astro/test/fixtures/jsx/src/components/PreactCounter.tsx
rename to packages/astro/test/fixtures/jsx/src/components/preact/PreactCounter.tsx
diff --git a/packages/astro/test/fixtures/jsx/src/components/ReactCounter.jsx b/packages/astro/test/fixtures/jsx/src/components/react/ReactCounter.jsx
similarity index 97%
rename from packages/astro/test/fixtures/jsx/src/components/ReactCounter.jsx
rename to packages/astro/test/fixtures/jsx/src/components/react/ReactCounter.jsx
index 5c5a001e8863..7404d45bc41e 100644
--- a/packages/astro/test/fixtures/jsx/src/components/ReactCounter.jsx
+++ b/packages/astro/test/fixtures/jsx/src/components/react/ReactCounter.jsx
@@ -6,6 +6,8 @@ export default function ReactCounter() {
const add = () => setCount((i) => i + 1);
const subtract = () => setCount((i) => i - 1);
+ debugger;
+
return (
diff --git a/packages/astro/test/fixtures/jsx/src/components/SolidCounter.jsx b/packages/astro/test/fixtures/jsx/src/components/solid/SolidCounter.jsx
similarity index 100%
rename from packages/astro/test/fixtures/jsx/src/components/SolidCounter.jsx
rename to packages/astro/test/fixtures/jsx/src/components/solid/SolidCounter.jsx
diff --git a/packages/astro/test/fixtures/jsx/src/pages/frameworks.astro b/packages/astro/test/fixtures/jsx/src/pages/frameworks.astro
index ede0f542c3cd..cfd28a3d4b15 100644
--- a/packages/astro/test/fixtures/jsx/src/pages/frameworks.astro
+++ b/packages/astro/test/fixtures/jsx/src/pages/frameworks.astro
@@ -1,13 +1,27 @@
---
-import * as Framework from '../components/Frameworks'
+import FrameworkSolid from '../components/solid/SolidCounter.jsx'
+import FrameworkPreact from '../components/preact/PreactCounter.jsx'
+import FrameworkReact from '../components/react/ReactCounter.jsx'
+import FrameworkSvelte from '../components/SvelteCounter.svelte'
+import FrameworkVue from '../components/VueCounter.vue'
+import FrameworkMDX from '../components/Content.mdx'
---
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/astro/test/fixtures/preact-compat-component/packages/react-lib/index.js b/packages/astro/test/fixtures/preact-compat-component/packages/react-lib/index.js
index 22fb55f10567..4f15bdac1cfb 100644
--- a/packages/astro/test/fixtures/preact-compat-component/packages/react-lib/index.js
+++ b/packages/astro/test/fixtures/preact-compat-component/packages/react-lib/index.js
@@ -2,4 +2,4 @@ import { useState } from "react";
export function useSpecialState(initialState) {
return useState(initialState);
-}
\ No newline at end of file
+}
diff --git a/packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx b/packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx
index bfdf5bed15a8..7ee876f2ccd3 100644
--- a/packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx
+++ b/packages/astro/test/fixtures/preact-compat-component/src/components/Counter.jsx
@@ -1,4 +1,3 @@
-/** @jsxImportSource preact */
import { useSpecialState } from '@test/react-lib'
export default function Counter({ children }) {
diff --git a/packages/astro/test/fixtures/tailwindcss/src/pages/markdown-page.md b/packages/astro/test/fixtures/tailwindcss/src/pages/markdown-page.md
deleted file mode 100644
index e4c6b6bc9d66..000000000000
--- a/packages/astro/test/fixtures/tailwindcss/src/pages/markdown-page.md
+++ /dev/null
@@ -1,11 +0,0 @@
----
-title: "Markdown + Tailwind"
-setup: |
- import Button from '../components/Button.astro';
- import Complex from '../components/Complex.astro';
----
-
-