From 519a1c4e8407c7abcb8d879b67a9f4b960652cae Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 11 Aug 2023 10:05:02 -0400 Subject: [PATCH] JSX refactor (#7924) * JSX refactor * Get preact/compat test to pass * Use include config * Remove old astro flavored markdown test * Move babel dep to preact * Remove errant debugger * Update lockfile * Update the multi-framework example * Update e2e tests * Fix nested-in-vue tests * Add back in astro check * Update packages/astro/src/core/create-vite.ts Co-authored-by: Nate Moore * Update packages/astro/src/core/create-vite.ts Co-authored-by: Nate Moore * Update packages/integrations/solid/src/index.ts Co-authored-by: Nate Moore * Update packages/integrations/solid/src/index.ts Co-authored-by: Nate Moore * Update .changeset/perfect-horses-tell.md Co-authored-by: Nate Moore * Move the comment about the include config * Remove redundant alias config * Use react's own preamble code * Use the base for the preamble * Remove solid redundancy * Update .changeset/perfect-horses-tell.md Co-authored-by: Sarah Rainsberger * Update based on review comments * Oops --------- Co-authored-by: Fred K. Schott Co-authored-by: Nate Moore Co-authored-by: Sarah Rainsberger --- .changeset/cool-feet-rest.md | 7 + .changeset/large-countries-share.md | 7 + .changeset/perfect-horses-tell.md | 27 + .changeset/slimy-carrots-sell.md | 9 + examples/framework-multiple/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.tsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../framework-multiple/src/pages/index.astro | 10 +- packages/astro/e2e/errors.test.js | 4 +- .../e2e/fixtures/client-only/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../client-only/src/pages/index.astro | 10 +- .../e2e/fixtures/errors/astro.config.mjs | 10 +- .../{ => preact}/PreactRuntimeError.jsx | 0 .../{ => preact}/PreactSyntaxError.jsx | 0 .../{ => react}/ReactRuntimeError.jsx | 0 .../{ => react}/ReactSyntaxError.jsx | 0 .../{ => solid}/SolidRuntimeError.jsx | 0 .../{ => solid}/SolidSyntaxError.jsx | 0 .../{ => svelte}/SvelteDirectiveError.svelte | 0 .../{ => svelte}/SvelteRuntimeError.svelte | 0 .../{ => svelte}/SvelteSyntaxError.svelte | 0 .../components/{ => vue}/VueRuntimeError.vue | 0 .../components/{ => vue}/VueSyntaxError.vue | 0 .../src/pages/astro-client-media-error.astro | 4 +- .../src/pages/astro-hydration-error.astro | 4 +- .../src/pages/preact-runtime-error.astro | 2 +- .../src/pages/preact-syntax-error.astro | 2 +- .../src/pages/react-runtime-error.astro | 2 +- .../errors/src/pages/react-syntax-error.astro | 2 +- .../src/pages/solid-runtime-error.astro | 2 +- .../errors/src/pages/solid-syntax-error.astro | 2 +- .../src/pages/svelte-runtime-error.astro | 2 +- .../src/pages/svelte-syntax-error.astro | 2 +- .../errors/src/pages/vue-runtime-error.astro | 2 +- .../errors/src/pages/vue-syntax-error.astro | 2 +- .../multiple-frameworks/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../multiple-frameworks/src/pages/index.astro | 10 +- .../nested-in-preact/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-in-preact/src/pages/index.astro | 10 +- .../fixtures/nested-in-react/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-in-react/src/pages/index.astro | 10 +- .../fixtures/nested-in-solid/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-in-solid/src/pages/index.astro | 10 +- .../nested-in-svelte/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-in-svelte/src/pages/index.astro | 10 +- .../fixtures/nested-in-vue/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-in-vue/src/pages/index.astro | 10 +- .../nested-recursive/astro.config.mjs | 8 +- .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 0 .../components/{ => solid}/SolidCounter.tsx | 0 .../{ => svelte}/SvelteCounter.svelte | 0 .../src/components/{ => vue}/VueCounter.vue | 0 .../nested-recursive/src/pages/index.astro | 10 +- .../core/build/plugins/plugin-renderers.ts | 2 + packages/astro/src/core/config/settings.ts | 3 +- packages/astro/src/core/create-vite.ts | 4 +- packages/astro/src/vite-plugin-jsx/index.ts | 251 --------- .../astro/src/vite-plugin-markdown/index.ts | 42 +- .../README.md | 0 .../import-source.ts | 0 packages/astro/src/vite-plugin-mdx/index.ts | 134 +++++ .../tag.ts | 0 .../astro-slots-nested/astro.config.mjs | 6 +- .../{ => preact}/PassesChildrenP.tsx | 0 .../src/components/{ => react}/Inner.tsx | 0 .../src/components/{ => react}/Parent.jsx | 0 .../components/{ => react}/PassesChildren.tsx | 0 .../{ => solid}/PassesChildrenS.tsx | 0 .../src/pages/component-slot.astro | 2 +- .../src/pages/hidden-nested.astro | 4 +- .../src/pages/server-component-nested.astro | 6 +- .../astro/test/fixtures/jsx/astro.config.mjs | 19 +- packages/astro/test/fixtures/jsx/package.json | 1 + .../fixtures/jsx/src/components/Content.mdx | 5 + .../jsx/src/components/Frameworks.jsx | 28 - .../components/{ => preact}/PreactCounter.tsx | 0 .../components/{ => react}/ReactCounter.jsx | 2 + .../components/{ => solid}/SolidCounter.jsx | 0 .../fixtures/jsx/src/pages/frameworks.astro | 34 +- .../packages/react-lib/index.js | 2 +- .../src/components/Counter.jsx | 1 - .../tailwindcss/src/pages/markdown-page.md | 11 - packages/astro/test/jsx.test.js | 28 +- .../test/preact-compat-component.test.js | 29 +- packages/astro/test/tailwindcss.test.js | 9 +- packages/astro/test/test-utils.js | 2 +- packages/integrations/mdx/src/index.ts | 4 +- packages/integrations/preact/package.json | 5 +- packages/integrations/preact/src/index.ts | 124 ++--- packages/integrations/preact/src/server.ts | 4 +- packages/integrations/react/package.json | 4 +- packages/integrations/react/src/index.ts | 44 +- packages/integrations/solid/package.json | 3 +- .../integrations/solid/src/dependencies.ts | 27 - packages/integrations/solid/src/index.ts | 79 +-- pnpm-lock.yaml | 486 +++++++++++------- 135 files changed, 857 insertions(+), 802 deletions(-) create mode 100644 .changeset/cool-feet-rest.md create mode 100644 .changeset/large-countries-share.md create mode 100644 .changeset/perfect-horses-tell.md create mode 100644 .changeset/slimy-carrots-sell.md rename examples/framework-multiple/src/components/{ => preact}/PreactCounter.tsx (100%) rename examples/framework-multiple/src/components/{ => react}/ReactCounter.tsx (100%) rename examples/framework-multiple/src/components/{ => solid}/SolidCounter.tsx (100%) rename examples/framework-multiple/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename examples/framework-multiple/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/client-only/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/client-only/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/client-only/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/client-only/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/client-only/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => preact}/PreactRuntimeError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => preact}/PreactSyntaxError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => react}/ReactRuntimeError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => react}/ReactSyntaxError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => solid}/SolidRuntimeError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => solid}/SolidSyntaxError.jsx (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => svelte}/SvelteDirectiveError.svelte (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => svelte}/SvelteRuntimeError.svelte (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => svelte}/SvelteSyntaxError.svelte (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => vue}/VueRuntimeError.vue (100%) rename packages/astro/e2e/fixtures/errors/src/components/{ => vue}/VueSyntaxError.vue (100%) rename packages/astro/e2e/fixtures/multiple-frameworks/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/multiple-frameworks/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/multiple-frameworks/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/multiple-frameworks/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/multiple-frameworks/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-in-preact/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-preact/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-in-preact/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-preact/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-in-preact/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-in-react/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-react/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-in-react/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-react/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-in-react/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-in-solid/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-solid/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-in-solid/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-solid/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-in-solid/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-in-svelte/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-svelte/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-in-svelte/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-svelte/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-in-svelte/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-in-vue/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-vue/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-in-vue/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-in-vue/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-in-vue/src/components/{ => vue}/VueCounter.vue (100%) rename packages/astro/e2e/fixtures/nested-recursive/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-recursive/src/components/{ => react}/ReactCounter.jsx (100%) rename packages/astro/e2e/fixtures/nested-recursive/src/components/{ => solid}/SolidCounter.tsx (100%) rename packages/astro/e2e/fixtures/nested-recursive/src/components/{ => svelte}/SvelteCounter.svelte (100%) rename packages/astro/e2e/fixtures/nested-recursive/src/components/{ => vue}/VueCounter.vue (100%) delete mode 100644 packages/astro/src/vite-plugin-jsx/index.ts rename packages/astro/src/{vite-plugin-jsx => vite-plugin-mdx}/README.md (100%) rename packages/astro/src/{vite-plugin-jsx => vite-plugin-mdx}/import-source.ts (100%) create mode 100644 packages/astro/src/vite-plugin-mdx/index.ts rename packages/astro/src/{vite-plugin-jsx => vite-plugin-mdx}/tag.ts (100%) rename packages/astro/test/fixtures/astro-slots-nested/src/components/{ => preact}/PassesChildrenP.tsx (100%) rename packages/astro/test/fixtures/astro-slots-nested/src/components/{ => react}/Inner.tsx (100%) rename packages/astro/test/fixtures/astro-slots-nested/src/components/{ => react}/Parent.jsx (100%) rename packages/astro/test/fixtures/astro-slots-nested/src/components/{ => react}/PassesChildren.tsx (100%) rename packages/astro/test/fixtures/astro-slots-nested/src/components/{ => solid}/PassesChildrenS.tsx (100%) create mode 100644 packages/astro/test/fixtures/jsx/src/components/Content.mdx delete mode 100644 packages/astro/test/fixtures/jsx/src/components/Frameworks.jsx rename packages/astro/test/fixtures/jsx/src/components/{ => preact}/PreactCounter.tsx (100%) rename packages/astro/test/fixtures/jsx/src/components/{ => react}/ReactCounter.jsx (97%) rename packages/astro/test/fixtures/jsx/src/components/{ => solid}/SolidCounter.jsx (100%) delete mode 100644 packages/astro/test/fixtures/tailwindcss/src/pages/markdown-page.md delete mode 100644 packages/integrations/solid/src/dependencies.ts diff --git a/.changeset/cool-feet-rest.md b/.changeset/cool-feet-rest.md new file mode 100644 index 000000000..c2e724d80 --- /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 000000000..b3101d2f2 --- /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 000000000..7723c665f --- /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 000000000..c1c9e694f --- /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 4b50887cd..36f75aec2 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 94630aa1e..ccf5aaa71 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 e23b22c65..2a5a83ace 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', () => `

No mismatch

`), + astro.editFile('./src/components/svelte/SvelteSyntaxError.svelte', () => `

No mismatch

`), ]); 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 4b50887cd..0ef8f6e2b 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 708ba1582..0b4299600 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 8f27d8fab..48e8736bd 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 46bb9a2c4..94e124c9a 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 1852539eb..8fcd56bd4 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 5c0aa2526..17ad92808 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 6748b0366..b0f709b9d 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 f1df8ec99..18490518e 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 6e61ae31d..c11b49ae0 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 51a2608bd..7d4160126 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 0fdbad25b..028ab9ede 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 ec499f6db..662a48f0e 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 26c14c15e..e275251a4 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 b63f85e63..698da561f 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 8db897fe1..c76ed16fe 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 4b50887cd..0ef8f6e2b 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 a30688bca..747744852 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 4b50887cd..0ef8f6e2b 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 619e8cccd..7512b86f4 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 4b50887cd..0ef8f6e2b 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 0b3b23d9d..fe18a3151 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 4b50887cd..0ef8f6e2b 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 0feb5ba60..7b2c8da8d 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 4b50887cd..0ef8f6e2b 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 764ebfaf7..aa11de7fd 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 4b50887cd..0ef8f6e2b 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 5e4d47d76..e89554755 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 4b50887cd..0ef8f6e2b 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 685c7fb5e..a17337c89 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 912df4241..f0cdf8983 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 c0274f602..1d0938c00 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 efb78d137..846d6109d 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 7aa7e7b16..000000000 --- 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 dd2cbcd85..aff27f7a6 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 000000000..473c4a78e --- /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 4a8807ed0..6f37285c6 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 b9a03f887..d803f3ff7 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 e51ce00a0..dcb3ebcba 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 b5a3d72a0..ec4ae3158 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 5b84d23a8..61d0d075e 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 1e7001b47..e5b12ece4 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 000000000..7a8bbc0f4 --- /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 2cc175964..000000000 --- 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 5c5a001e8..7404d45bc 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 ede0f542c..cfd28a3d4 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 22fb55f10..4f15bdac1 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 bfdf5bed1..7ee876f2c 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 e4c6b6bc9..000000000 --- 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'; ---- - -
- - -
\ No newline at end of file diff --git a/packages/astro/test/jsx.test.js b/packages/astro/test/jsx.test.js index 41671699c..64c7a7609 100644 --- a/packages/astro/test/jsx.test.js +++ b/packages/astro/test/jsx.test.js @@ -20,43 +20,51 @@ describe('jsx-runtime', () => { expect($('#named').text()).to.equal('Named'); }); - it('Can load Preact component inside Astro JSX', async () => { + it('Can load Preact component inside Astro', async () => { const html = await fixture.readFile('/frameworks/index.html'); const $ = cheerio.load(html); - expect($('#has-preact #preact').length).to.equal(1); + expect($('#has-preact #preact').length).to.equal(0); expect($('#preact').text()).to.include('Preact'); }); - it('Can load React component inside Astro JSX', async () => { + it('Can load React component inside Astro', async () => { const html = await fixture.readFile('/frameworks/index.html'); const $ = cheerio.load(html); - expect($('#has-react #react').length).to.equal(1); + expect($('#has-react #react').length).to.equal(0); expect($('#react').text()).to.include('React'); }); - it('Can load Solid component inside Astro JSX', async () => { + it('Can load Solid component inside Astro', async () => { const html = await fixture.readFile('/frameworks/index.html'); const $ = cheerio.load(html); - expect($('#has-solid #solid').length).to.equal(1); + expect($('#has-solid #solid').length).to.equal(0); expect($('#solid').text()).to.include('Solid'); }); - it('Can load Svelte component inside Astro JSX', async () => { + it('Can load Svelte component inside Astro', async () => { const html = await fixture.readFile('/frameworks/index.html'); const $ = cheerio.load(html); - expect($('#has-svelte #svelte').length).to.equal(1); + expect($('#has-svelte #svelte').length).to.equal(0); expect($('#svelte').text()).to.include('Svelte'); }); - it('Can load Vue component inside Astro JSX', async () => { + it('Can load Vue component inside Astro', async () => { const html = await fixture.readFile('/frameworks/index.html'); const $ = cheerio.load(html); - expect($('#has-vue #vue').length).to.equal(1); + expect($('#has-vue #vue').length).to.equal(0); expect($('#vue').text()).to.include('Vue'); }); + + it('Can load MDX component inside Astro', async () => { + const html = await fixture.readFile('/frameworks/index.html'); + const $ = cheerio.load(html); + + expect($('#mdx-wrapper #hello-world')).to.have.a.lengthOf(1, 'md content rendered'); + expect($('#mdx-wrapper #react')).to.have.a.lengthOf(1, 'React component rendered') + }); }); diff --git a/packages/astro/test/preact-compat-component.test.js b/packages/astro/test/preact-compat-component.test.js index f0cd9e45f..8937e9afa 100644 --- a/packages/astro/test/preact-compat-component.test.js +++ b/packages/astro/test/preact-compat-component.test.js @@ -3,18 +3,30 @@ import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; describe('Preact compat component', () => { + /** @type {import('./test-utils.js').Fixture} */ + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/preact-compat-component/', + }); + }); + describe('Development', () => { - let fixture; + /** @type {import('./test-utils.js').DevServer} */ + let devServer; before(async () => { - fixture = await loadFixture({ - root: './fixtures/preact-compat-component/', - }); - await fixture.startDevServer(); + devServer = await fixture.startDevServer(); }); + after(async() => { + await devServer.stop(); + }) + it('Can load Counter', async () => { - const html = await fixture.fetch('/').then((res) => res.text()); + const res = await fixture.fetch('/'); + const html = await res.text(); const $ = cheerio.load(html); expect($('#counter-text').text()).to.be.eq('0'); @@ -22,12 +34,7 @@ describe('Preact compat component', () => { }); describe('Build', () => { - let fixture; - before(async () => { - fixture = await loadFixture({ - root: './fixtures/preact-compat-component/', - }); await fixture.build(); }); diff --git a/packages/astro/test/tailwindcss.test.js b/packages/astro/test/tailwindcss.test.js index 2a37c6572..3c249cc2c 100644 --- a/packages/astro/test/tailwindcss.test.js +++ b/packages/astro/test/tailwindcss.test.js @@ -3,6 +3,7 @@ import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; describe('Tailwind', () => { + /** @type {import('./test-utils.js').Fixture} */ let fixture; before(async () => { @@ -58,14 +59,6 @@ describe('Tailwind', () => { expect(button.hasClass('2xl:w-[80%]'), 'complex class').to.be.true; }); - it('handles Markdown pages', async () => { - const html = await fixture.readFile('/markdown-page/index.html'); - const $md = cheerio.load(html); - const bundledCSSHREF = $md('link[rel=stylesheet][href^=/_astro/]').attr('href'); - const mdBundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/')); - expect(mdBundledCSS, 'includes used component classes').to.match(/\.bg-purple-600{/); - }); - it('handles MDX pages (with integration)', async () => { const html = await fixture.readFile('/mdx-page/index.html'); const $md = cheerio.load(html); diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index a58d417d7..0b336698f 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -20,7 +20,7 @@ import { sync } from '../dist/core/sync/index.js'; process.env.ASTRO_TELEMETRY_DISABLED = true; /** - * @typedef {import('../src/core/dev/dev').DedvServer} DevServer + * @typedef {import('../src/core/dev/dev').DevServer} DevServer * @typedef {import('../src/@types/astro').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig * @typedef {import('../src/core/preview/index').PreviewServer} PreviewServer * @typedef {import('../src/core/app/index').App} App diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index ecf2a9a95..4cce23921 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -13,6 +13,7 @@ import type { Plugin as VitePlugin } from 'vite'; import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js'; import type { OptimizeOptions } from './rehype-optimize-static.js'; import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js'; +import astroJSXRenderer from 'astro/jsx/renderer.js'; export type MdxOptions = Omit & { extendMarkdownConfig: boolean; @@ -37,9 +38,10 @@ export default function mdx(partialMdxOptions: Partial = {}): AstroI name: '@astrojs/mdx', hooks: { 'astro:config:setup': async (params) => { - const { updateConfig, config, addPageExtension, addContentEntryType, command } = + const { updateConfig, config, addPageExtension, addContentEntryType, command, addRenderer } = params as SetupHookParams; + addRenderer(astroJSXRenderer); addPageExtension('.mdx'); addContentEntryType({ extensions: ['.mdx'], diff --git a/packages/integrations/preact/package.json b/packages/integrations/preact/package.json index f1a5f08f4..5fefa53eb 100644 --- a/packages/integrations/preact/package.json +++ b/packages/integrations/preact/package.json @@ -35,10 +35,11 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@babel/core": "^7.22.5", "@babel/plugin-transform-react-jsx": "^7.22.5", + "@babel/plugin-transform-react-jsx-development": "^7.22.5", + "babel-plugin-transform-hook-names": "^1.0.2", + "@preact/preset-vite": "^2.5.0", "@preact/signals": "^1.1.3", - "babel-plugin-module-resolver": "^5.0.0", "preact-render-to-string": "^5.2.6" }, "devDependencies": { diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts index 98a2dd205..153b9e1c3 100644 --- a/packages/integrations/preact/src/index.ts +++ b/packages/integrations/preact/src/index.ts @@ -1,94 +1,68 @@ import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro'; +import preact, {type PreactPluginOptions as VitePreactPluginOptions} from '@preact/preset-vite'; +import { fileURLToPath } from 'node:url'; + +const babelCwd = new URL('../', import.meta.url); function getRenderer(development: boolean): AstroRenderer { return { name: '@astrojs/preact', clientEntrypoint: development ? '@astrojs/preact/client-dev.js' : '@astrojs/preact/client.js', serverEntrypoint: '@astrojs/preact/server.js', - jsxImportSource: 'preact', - jsxTransformOptions: async () => { - // @ts-expect-error types not found - const plugin = await import('@babel/plugin-transform-react-jsx'); - const jsx = plugin.default?.default ?? plugin.default; - return { - plugins: [jsx({}, { runtime: 'automatic', importSource: 'preact' })], - }; - }, }; } -function getCompatRenderer(development: boolean): AstroRenderer { - return { - name: '@astrojs/preact', - clientEntrypoint: development ? '@astrojs/preact/client-dev.js' : '@astrojs/preact/client.js', - serverEntrypoint: '@astrojs/preact/server.js', - jsxImportSource: 'react', - jsxTransformOptions: async () => { - // @ts-expect-error types not found - const plugin = await import('@babel/plugin-transform-react-jsx'); - const jsx = plugin.default?.default ?? plugin.default; - return { - plugins: [ - jsx({}, { runtime: 'automatic', importSource: 'preact/compat' }), - [ - 'babel-plugin-module-resolver', - { - alias: { - react: 'preact/compat', - 'react-dom/test-utils': 'preact/test-utils', - 'react-dom': 'preact/compat', - 'react/jsx-runtime': 'preact/jsx-runtime', - }, - }, - ], - ], - }; - }, - }; -} +export type Options =Pick & { compat?: boolean }; -function getViteConfiguration(compat?: boolean): ViteUserConfig { - const viteConfig: ViteUserConfig = { - optimizeDeps: { - include: ['@astrojs/preact/client.js', 'preact', 'preact/jsx-runtime'], - exclude: ['@astrojs/preact/server.js'], - }, - }; - - if (compat) { - viteConfig.optimizeDeps!.include!.push( - 'preact/compat', - 'preact/test-utils', - 'preact/compat/jsx-runtime' - ); - viteConfig.resolve = { - alias: [ - { find: 'react', replacement: 'preact/compat' }, - { find: 'react-dom/test-utils', replacement: 'preact/test-utils' }, - { find: 'react-dom', replacement: 'preact/compat' }, - { find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }, - ], - dedupe: ['preact/compat', 'preact'], - }; - // noExternal React entrypoints to be bundled, resolved, and aliased by Vite - viteConfig.ssr = { - noExternal: ['react', 'react-dom', 'react-dom/test-utils', 'react/jsx-runtime'], - }; - } - - return viteConfig; -} - -export default function ({ compat }: { compat?: boolean } = {}): AstroIntegration { +export default function ({include, exclude, compat}: Options = {}): AstroIntegration { return { name: '@astrojs/preact', hooks: { 'astro:config:setup': ({ addRenderer, updateConfig, command }) => { - const development = command === 'dev'; - if (compat) addRenderer(getCompatRenderer(development)); - addRenderer(getRenderer(development)); + const preactPlugin = preact({ + include, + exclude, + babel: { + cwd: fileURLToPath(babelCwd) + } + }); + + const viteConfig: ViteUserConfig = { + optimizeDeps: { + include: ['@astrojs/preact/client.js', 'preact', 'preact/jsx-runtime'], + exclude: ['@astrojs/preact/server.js'], + }, + }; + + // If not compat, delete the plugin that does it + if(!compat) { + const pIndex = preactPlugin.findIndex(p => p.name == 'preact:config'); + if (pIndex >= 0) { + preactPlugin.splice(pIndex, 1); + } + } else { + viteConfig.optimizeDeps!.include!.push( + 'preact/compat', + 'preact/test-utils', + 'preact/compat/jsx-runtime', + ); + viteConfig.resolve = { + alias: [ + { find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }, + ], + dedupe: ['preact/compat', 'preact'], + }; + // noExternal React entrypoints to be bundled, resolved, and aliased by Vite + viteConfig.ssr = { + noExternal: ['react', 'react-dom', 'react-dom/test-utils', 'react/jsx-runtime'], + }; + } + + viteConfig.plugins = [preactPlugin]; + + addRenderer(getRenderer(command === 'dev')); updateConfig({ - vite: getViteConfiguration(compat), + vite: viteConfig, }); }, }, diff --git a/packages/integrations/preact/src/server.ts b/packages/integrations/preact/src/server.ts index 6a2ceb612..b9d063b62 100644 --- a/packages/integrations/preact/src/server.ts +++ b/packages/integrations/preact/src/server.ts @@ -29,8 +29,8 @@ function check(this: RendererContext, Component: any, props: Record // There are edge cases (SolidJS) where Preact *might* render a string, // but components would be - - return !/\/.test(html); + // It also might render an empty sting. + return html == '' ? false : !/\/.test(html); } catch (err) { return false; } diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 958ee5ed7..28dbf0891 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -44,8 +44,8 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@babel/core": "^7.22.5", - "@babel/plugin-transform-react-jsx": "^7.22.5" + "@astrojs/internal-helpers": "0.2.0-beta.0", + "@vitejs/plugin-react": "^4.0.3" }, "devDependencies": { "@types/react": "^17.0.62", diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index d7906fe4a..da008a670 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -1,5 +1,10 @@ import type { AstroIntegration } from 'astro'; import { version as ReactVersion } from 'react-dom'; +import react, {type Options as ViteReactPluginOptions} from '@vitejs/plugin-react'; +import { appendForwardSlash } from '@astrojs/internal-helpers/path'; + + +const FAST_REFRESH_PREAMBLE = react.preambleCode; function getRenderer() { return { @@ -10,33 +15,10 @@ function getRenderer() { serverEntrypoint: ReactVersion.startsWith('18.') ? '@astrojs/react/server.js' : '@astrojs/react/server-v17.js', - jsxImportSource: 'react', - jsxTransformOptions: async () => { - // @ts-expect-error types not found - const babelPluginTransformReactJsxModule = await import('@babel/plugin-transform-react-jsx'); - const jsx = - babelPluginTransformReactJsxModule?.default?.default ?? - babelPluginTransformReactJsxModule?.default; - return { - plugins: [ - jsx( - {}, - { - runtime: 'automatic', - // This option tells the JSX transform how to construct the "*/jsx-runtime" import. - // In React v17, we had to shim this due to an export map issue in React. - // In React v18, this issue was fixed and we can import "react/jsx-runtime" directly. - // See `./jsx-runtime.js` for more details. - importSource: ReactVersion.startsWith('18.') ? 'react' : '@astrojs/react', - } - ), - ], - }; - }, }; } -function getViteConfiguration() { +function getViteConfiguration({include, exclude}: Options = {}) { return { optimizeDeps: { include: [ @@ -54,8 +36,9 @@ function getViteConfiguration() { : '@astrojs/react/server-v17.js', ], }, + plugins: [react({include, exclude})], resolve: { - dedupe: ['react', 'react-dom'], + dedupe: ['react', 'react-dom', 'react-dom/server'], }, ssr: { external: ReactVersion.startsWith('18.') @@ -73,13 +56,18 @@ function getViteConfiguration() { }; } -export default function (): AstroIntegration { +export type Options =Pick; +export default function ({include, exclude}: Pick = {}): AstroIntegration { return { name: '@astrojs/react', hooks: { - 'astro:config:setup': ({ addRenderer, updateConfig }) => { + 'astro:config:setup': ({ config, command, addRenderer, updateConfig, injectScript }) => { addRenderer(getRenderer()); - updateConfig({ vite: getViteConfiguration() }); + updateConfig({ vite: getViteConfiguration({include, exclude}) }); + if (command === 'dev') { + const preamble = FAST_REFRESH_PREAMBLE.replace(`__BASE__`, appendForwardSlash(config.base)) + injectScript('before-hydration', preamble); + } }, }, }; diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json index c962e025a..580545f44 100644 --- a/packages/integrations/solid/package.json +++ b/packages/integrations/solid/package.json @@ -35,8 +35,7 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "babel-preset-solid": "^1.7.4", - "vitefu": "^0.2.4" + "vite-plugin-solid": "^2.7.0" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/solid/src/dependencies.ts b/packages/integrations/solid/src/dependencies.ts deleted file mode 100644 index ac6e5c655..000000000 --- a/packages/integrations/solid/src/dependencies.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { AstroConfig } from 'astro'; -import { fileURLToPath } from 'node:url'; -import { crawlFrameworkPkgs } from 'vitefu'; - -export async function getSolidPkgsConfig(isBuild: boolean, astroConfig: AstroConfig) { - return await crawlFrameworkPkgs({ - root: fileURLToPath(astroConfig.root), - isBuild, - viteUserConfig: astroConfig.vite, - isFrameworkPkgByJson(pkgJson) { - return containsSolidField(pkgJson.exports || {}); - }, - }); -} - -// Reference vite-plugin-solid heuristic -// https://github.com/solidjs/vite-plugin-solid/blob/5558486b0c63788e1275244256918f80294a8338/src/index.ts#L251-L259 -// License: MIT (https://github.com/solidjs/vite-plugin-solid/blob/5558486b0c63788e1275244256918f80294a8338/package.json#L38) -function containsSolidField(fields: Record) { - const keys = Object.keys(fields); - for (const key of keys) { - if (key === 'solid') return true; - if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key])) - return true; - } - return false; -} diff --git a/packages/integrations/solid/src/index.ts b/packages/integrations/solid/src/index.ts index cfd38224c..1385ffc21 100644 --- a/packages/integrations/solid/src/index.ts +++ b/packages/integrations/solid/src/index.ts @@ -1,63 +1,64 @@ -import type { AstroConfig, AstroIntegration, AstroRenderer } from 'astro'; -import { getSolidPkgsConfig } from './dependencies.js'; +import type { AstroIntegration, AstroRenderer } from 'astro'; +import solid, { type Options as ViteSolidPluginOptions } from 'vite-plugin-solid'; -function getRenderer(): AstroRenderer { - return { - name: '@astrojs/solid-js', - clientEntrypoint: '@astrojs/solid-js/client.js', - serverEntrypoint: '@astrojs/solid-js/server.js', - jsxImportSource: 'solid-js', - jsxTransformOptions: async ({ ssr }) => { - // @ts-expect-error types not found - const [{ default: solid }] = await Promise.all([import('babel-preset-solid')]); - const options = { - presets: [solid({}, { generate: ssr ? 'ssr' : 'dom', hydratable: true })], - plugins: [], - // Otherwise, babel will try to consume the source map generated by esbuild - // This causes unexpected issues with newline characters: https://github.com/withastro/astro/issues/3371 - // Note "vite-plugin-solid" does the same: https://github.com/solidjs/vite-plugin-solid/blob/master/src/index.ts#L344-L345 - inputSourceMap: false as any, - }; - - return options; - }, - }; -} - -async function getViteConfiguration(isDev: boolean, astroConfig: AstroConfig) { +async function getViteConfiguration( + isDev: boolean, + { include, exclude }: Options = {}, +) { // https://github.com/solidjs/vite-plugin-solid // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode const nestedDeps = ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h']; - const solidPkgsConfig = await getSolidPkgsConfig(!isDev, astroConfig); return { - /** - * We only need esbuild on .ts or .js files. - * .tsx & .jsx files are handled by us - */ - esbuild: { include: /\.ts$/ }, resolve: { conditions: ['solid', ...(isDev ? ['development'] : [])], dedupe: nestedDeps, alias: [{ find: /^solid-refresh$/, replacement: '/@solid-refresh' }], }, optimizeDeps: { - include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include], - exclude: ['@astrojs/solid-js/server.js', ...solidPkgsConfig.optimizeDeps.exclude], + include: [...nestedDeps], + exclude: ['@astrojs/solid-js/server.js'], }, + plugins: [ + solid({ include, exclude, dev: isDev, ssr: true }), + { + name: '@astrojs/solid:config-overrides', + enforce: 'post', + config() { + return { + esbuild: { + // To support using alongside other JSX frameworks, still let + // esbuild compile stuff. Solid goes first anyways. + include: /\.(m?ts|[jt]sx)$/ + }, + } + }, + } + ], ssr: { - external: ['babel-preset-solid', ...solidPkgsConfig.ssr.external], - noExternal: [...solidPkgsConfig.ssr.noExternal], + external: ['babel-preset-solid'], }, }; } -export default function (): AstroIntegration { +function getRenderer(): AstroRenderer { + return { + name: '@astrojs/solid-js', + clientEntrypoint: '@astrojs/solid-js/client.js', + serverEntrypoint: '@astrojs/solid-js/server.js', + }; +} + +export type Options = Pick; + +export default function (opts: Options = {}): AstroIntegration { return { name: '@astrojs/solid-js', hooks: { - 'astro:config:setup': async ({ command, addRenderer, updateConfig, config }) => { + 'astro:config:setup': async ({ command, addRenderer, updateConfig }) => { addRenderer(getRenderer()); - updateConfig({ vite: await getViteConfiguration(command === 'dev', config) }); + updateConfig({ + vite: await getViteConfiguration(command === 'dev', opts), + }); }, }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af528d5ab..baeea8504 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2761,6 +2761,9 @@ importers: specifier: ^3.3.4 version: 3.3.4 devDependencies: + '@astrojs/mdx': + specifier: workspace:* + version: link:../../../../integrations/mdx '@astrojs/preact': specifier: workspace:* version: link:../../../../integrations/preact @@ -4482,18 +4485,21 @@ importers: packages/integrations/preact: dependencies: - '@babel/core': - specifier: ^7.22.5 - version: 7.22.5 '@babel/plugin-transform-react-jsx': specifier: ^7.22.5 version: 7.22.5(@babel/core@7.22.5) + '@babel/plugin-transform-react-jsx-development': + specifier: ^7.22.5 + version: 7.22.5 + '@preact/preset-vite': + specifier: ^2.5.0 + version: 2.5.0(preact@10.15.1) '@preact/signals': specifier: ^1.1.3 version: 1.1.3(preact@10.15.1) - babel-plugin-module-resolver: - specifier: ^5.0.0 - version: 5.0.0 + babel-plugin-transform-hook-names: + specifier: ^1.0.2 + version: 1.0.2 preact-render-to-string: specifier: ^5.2.6 version: 5.2.6(preact@10.15.1) @@ -4556,12 +4562,12 @@ importers: packages/integrations/react: dependencies: - '@babel/core': - specifier: ^7.22.5 - version: 7.22.5 - '@babel/plugin-transform-react-jsx': - specifier: ^7.22.5 - version: 7.22.5(@babel/core@7.22.5) + '@astrojs/internal-helpers': + specifier: 0.2.0-beta.0 + version: link:../../internal-helpers + '@vitejs/plugin-react': + specifier: ^4.0.3 + version: 4.0.3 devDependencies: '@types/react': specifier: ^17.0.62 @@ -4639,12 +4645,9 @@ importers: packages/integrations/solid: dependencies: - babel-preset-solid: - specifier: ^1.7.4 - version: 1.7.4 - vitefu: - specifier: ^0.2.4 - version: 0.2.4(vite@4.4.6) + vite-plugin-solid: + specifier: ^2.7.0 + version: 2.7.0(solid-js@1.7.6) devDependencies: astro: specifier: workspace:* @@ -5393,8 +5396,8 @@ packages: semver: 6.3.1 dev: false - /@babel/helper-create-class-features-plugin@7.21.8(@babel/core@7.22.5): - resolution: {integrity: sha512-+THiN8MqiH2AczyuZrnrKL6cAxFRRQDKW9h1YkBvbgKmAm6mwiacig1qT73DHIWMGo40GRnsEfN3LA+E6NtmSw==} + /@babel/helper-create-class-features-plugin@7.22.9(@babel/core@7.22.5): + resolution: {integrity: sha512-Pwyi89uO4YrGKxL/eNJ8lfEH55DnRloGPOseaA8NFNL6jAUnn+KccaISiFazCj5IolPPDjGSdzQzXVzODVRqUQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 @@ -5406,14 +5409,12 @@ packages: '@babel/helper-annotate-as-pure': 7.22.5 '@babel/helper-environment-visitor': 7.22.5 '@babel/helper-function-name': 7.22.5 - '@babel/helper-member-expression-to-functions': 7.21.5 - '@babel/helper-optimise-call-expression': 7.18.6 - '@babel/helper-replace-supers': 7.21.5 - '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 - '@babel/helper-split-export-declaration': 7.22.5 + '@babel/helper-member-expression-to-functions': 7.22.5 + '@babel/helper-optimise-call-expression': 7.22.5 + '@babel/helper-replace-supers': 7.22.9(@babel/core@7.22.5) + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 semver: 6.3.1 - transitivePeerDependencies: - - supports-color dev: false /@babel/helper-create-regexp-features-plugin@7.21.8(@babel/core@7.22.5): @@ -5470,8 +5471,8 @@ packages: '@babel/types': 7.22.5 dev: false - /@babel/helper-member-expression-to-functions@7.21.5: - resolution: {integrity: sha512-nIcGfgwpH2u4n9GG1HpStW5Ogx7x7ekiFHbjjFRKXbn5zUvqO9ZgotCO4x1aNbKn/x/xOUaXEhyNHCwtFCpxWg==} + /@babel/helper-member-expression-to-functions@7.22.5: + resolution: {integrity: sha512-aBiH1NKMG0H2cGZqspNvsaBe6wNGjbJjuLy29aU+eDZjSbbN53BaxlpB02xm9v34pLTZ1nIQPFYn2qMZoa5BQQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.22.5 @@ -5514,8 +5515,8 @@ packages: - supports-color dev: false - /@babel/helper-optimise-call-expression@7.18.6: - resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==} + /@babel/helper-optimise-call-expression@7.22.5: + resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.22.5 @@ -5544,18 +5545,19 @@ packages: - supports-color dev: false - /@babel/helper-replace-supers@7.21.5: - resolution: {integrity: sha512-/y7vBgsr9Idu4M6MprbOVUfH3vs7tsIfnVWv/Ml2xgwvyH6LTngdfbf5AdsKwkJy4zgy1X/kuNrEKvhhK28Yrg==} + /@babel/helper-replace-supers@7.22.9(@babel/core@7.22.5): + resolution: {integrity: sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==} engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + peerDependenciesMeta: + '@babel/core': + optional: true dependencies: + '@babel/core': 7.22.5 '@babel/helper-environment-visitor': 7.22.5 - '@babel/helper-member-expression-to-functions': 7.21.5 - '@babel/helper-optimise-call-expression': 7.18.6 - '@babel/template': 7.22.5 - '@babel/traverse': 7.22.5 - '@babel/types': 7.22.5 - transitivePeerDependencies: - - supports-color + '@babel/helper-member-expression-to-functions': 7.22.5 + '@babel/helper-optimise-call-expression': 7.22.5 dev: false /@babel/helper-simple-access@7.22.5: @@ -5565,8 +5567,8 @@ packages: '@babel/types': 7.22.5 dev: false - /@babel/helper-skip-transparent-expression-wrappers@7.20.0: - resolution: {integrity: sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg==} + /@babel/helper-skip-transparent-expression-wrappers@7.22.5: + resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.22.5 @@ -5579,6 +5581,13 @@ packages: '@babel/types': 7.22.5 dev: false + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: false + /@babel/helper-string-parser@7.22.5: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} engines: {node: '>=6.9.0'} @@ -5587,11 +5596,6 @@ packages: resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} engines: {node: '>=6.9.0'} - /@babel/helper-validator-option@7.21.0: - resolution: {integrity: sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==} - engines: {node: '>=6.9.0'} - dev: false - /@babel/helper-validator-option@7.22.5: resolution: {integrity: sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==} engines: {node: '>=6.9.0'} @@ -5659,7 +5663,7 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 '@babel/plugin-proposal-optional-chaining': 7.21.0(@babel/core@7.22.5) dev: false @@ -5691,10 +5695,8 @@ packages: optional: true dependencies: '@babel/core': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.21.8(@babel/core@7.22.5) + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-proposal-class-static-block@7.21.0(@babel/core@7.22.5): @@ -5707,11 +5709,9 @@ packages: optional: true dependencies: '@babel/core': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.21.8(@babel/core@7.22.5) + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.22.5) - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-proposal-dynamic-import@7.18.6(@babel/core@7.22.5): @@ -5840,7 +5840,7 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.22.5) dev: false @@ -5854,10 +5854,8 @@ packages: optional: true dependencies: '@babel/core': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.21.8(@babel/core@7.22.5) + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-proposal-private-property-in-object@7.21.0(@babel/core@7.22.5): @@ -5871,11 +5869,9 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.21.8(@babel/core@7.22.5) + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.22.5) - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-proposal-unicode-property-regex@7.18.6(@babel/core@7.22.5): @@ -6114,8 +6110,8 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: false - /@babel/plugin-syntax-typescript@7.21.4(@babel/core@7.22.5): - resolution: {integrity: sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA==} + /@babel/plugin-syntax-typescript@7.22.5(@babel/core@7.22.5): + resolution: {integrity: sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -6197,13 +6193,11 @@ packages: '@babel/helper-compilation-targets': 7.22.5(@babel/core@7.22.5) '@babel/helper-environment-visitor': 7.22.5 '@babel/helper-function-name': 7.22.5 - '@babel/helper-optimise-call-expression': 7.18.6 + '@babel/helper-optimise-call-expression': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-replace-supers': 7.21.5 - '@babel/helper-split-export-declaration': 7.22.5 + '@babel/helper-replace-supers': 7.22.9(@babel/core@7.22.5) + '@babel/helper-split-export-declaration': 7.22.6 globals: 11.12.0 - transitivePeerDependencies: - - supports-color dev: false /@babel/plugin-transform-computed-properties@7.21.5(@babel/core@7.22.5): @@ -6344,8 +6338,8 @@ packages: - supports-color dev: false - /@babel/plugin-transform-modules-commonjs@7.21.5(@babel/core@7.22.5): - resolution: {integrity: sha512-OVryBEgKUbtqMoB7eG2rs6UFexJi6Zj6FDXx+esBLPTCxCNxAY9o+8Di7IsUGJ+AVhp5ncK0fxWUBd0/1gPhrQ==} + /@babel/plugin-transform-modules-commonjs@7.22.5(@babel/core@7.22.5): + resolution: {integrity: sha512-B4pzOXj+ONRmuaQTg05b3y/4DuFz3WcCNAXPLb2Q0GT0TrGKGxNKV4jwsXts+StaM0LQczZbOpj8o1DLPDJIiA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -6433,9 +6427,7 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-replace-supers': 7.21.5 - transitivePeerDependencies: - - supports-color + '@babel/helper-replace-supers': 7.22.9(@babel/core@7.22.5) dev: false /@babel/plugin-transform-parameters@7.21.3(@babel/core@7.22.5): @@ -6464,6 +6456,44 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: false + /@babel/plugin-transform-react-jsx-development@7.22.5: + resolution: {integrity: sha512-bDhuzwWMuInwCYeDeMzyi7TaBgRQei6DqxhbyniL7/VG4RSS7HtSL2QbY4eESy1KJqlWt8g3xeEBGPuo+XqC8A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + peerDependenciesMeta: + '@babel/core': + optional: true + dependencies: + '@babel/plugin-transform-react-jsx': 7.22.5(@babel/core@7.22.5) + dev: false + + /@babel/plugin-transform-react-jsx-self@7.22.5(@babel/core@7.22.5): + resolution: {integrity: sha512-nTh2ogNUtxbiSbxaT4Ds6aXnXEipHweN9YRgOX/oNXdf0cCrGn/+2LozFa3lnPV5D90MkjhgckCPBrsoSc1a7g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + peerDependenciesMeta: + '@babel/core': + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/helper-plugin-utils': 7.22.5 + dev: false + + /@babel/plugin-transform-react-jsx-source@7.22.5(@babel/core@7.22.5): + resolution: {integrity: sha512-yIiRO6yobeEIaI0RTbIr8iAK9FcBHLtZq0S89ZPjDLQXBA4xvghaKqI0etp/tF3htTM0sazJKKLz9oEiGRtu7w==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + peerDependenciesMeta: + '@babel/core': + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/helper-plugin-utils': 7.22.5 + dev: false + /@babel/plugin-transform-react-jsx@7.22.5(@babel/core@7.22.5): resolution: {integrity: sha512-rog5gZaVbUip5iWDMTYbVM15XQq+RkUKhET/IHR6oizR+JEoN6CAfTTuHcK4vwUyzca30qqHqEpzBOnaRMWYMA==} engines: {node: '>=6.9.0'} @@ -6532,7 +6562,7 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-skip-transparent-expression-wrappers': 7.20.0 + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 dev: false /@babel/plugin-transform-sticky-regex@7.18.6(@babel/core@7.22.5): @@ -6585,11 +6615,25 @@ packages: dependencies: '@babel/core': 7.22.5 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-create-class-features-plugin': 7.21.8(@babel/core@7.22.5) + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 - '@babel/plugin-syntax-typescript': 7.21.4(@babel/core@7.22.5) - transitivePeerDependencies: - - supports-color + '@babel/plugin-syntax-typescript': 7.22.5(@babel/core@7.22.5) + dev: false + + /@babel/plugin-transform-typescript@7.22.9(@babel/core@7.22.5): + resolution: {integrity: sha512-BnVR1CpKiuD0iobHPaM1iLvcwPYN2uVFAqoLVSpEDKWuOikoCv5HbKLxclhKYUXlWkX86DoZGtqI4XhbOsyrMg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + peerDependenciesMeta: + '@babel/core': + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/helper-annotate-as-pure': 7.22.5 + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.5) + '@babel/helper-plugin-utils': 7.22.5 + '@babel/plugin-syntax-typescript': 7.22.5(@babel/core@7.22.5) dev: false /@babel/plugin-transform-unicode-escapes@7.21.5(@babel/core@7.22.5): @@ -6632,7 +6676,7 @@ packages: '@babel/core': 7.22.5 '@babel/helper-compilation-targets': 7.22.5(@babel/core@7.22.5) '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-validator-option': 7.21.0 + '@babel/helper-validator-option': 7.22.5 '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.18.6(@babel/core@7.22.5) '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.20.7(@babel/core@7.22.5) '@babel/plugin-proposal-async-generator-functions': 7.20.7(@babel/core@7.22.5) @@ -6681,7 +6725,7 @@ packages: '@babel/plugin-transform-literals': 7.18.9(@babel/core@7.22.5) '@babel/plugin-transform-member-expression-literals': 7.18.6(@babel/core@7.22.5) '@babel/plugin-transform-modules-amd': 7.20.11(@babel/core@7.22.5) - '@babel/plugin-transform-modules-commonjs': 7.21.5(@babel/core@7.22.5) + '@babel/plugin-transform-modules-commonjs': 7.22.5(@babel/core@7.22.5) '@babel/plugin-transform-modules-systemjs': 7.20.11(@babel/core@7.22.5) '@babel/plugin-transform-modules-umd': 7.18.6(@babel/core@7.22.5) '@babel/plugin-transform-named-capturing-groups-regex': 7.20.5(@babel/core@7.22.5) @@ -6725,6 +6769,25 @@ packages: esutils: 2.0.3 dev: false + /@babel/preset-typescript@7.22.5(@babel/core@7.22.5): + resolution: {integrity: sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + peerDependenciesMeta: + '@babel/core': + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/helper-plugin-utils': 7.22.5 + '@babel/helper-validator-option': 7.22.5 + '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.22.5) + '@babel/plugin-transform-modules-commonjs': 7.22.5(@babel/core@7.22.5) + '@babel/plugin-transform-typescript': 7.22.9(@babel/core@7.22.5) + transitivePeerDependencies: + - supports-color + dev: false + /@babel/regjsgen@0.8.0: resolution: {integrity: sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==} dev: false @@ -6900,7 +6963,7 @@ packages: resolution: {integrity: sha512-JppheLu7S114aEs157fOZDjFqUDpm7eHdq5E8SSR0gUBTEK0cNSHsrSR5a66xs0z3RWuo46QvA3vawp8BxDHvg==} dependencies: dataloader: 1.4.0 - node-fetch: 2.6.12 + node-fetch: 2.6.11 transitivePeerDependencies: - encoding dev: true @@ -7759,11 +7822,11 @@ packages: detect-libc: 2.0.1 https-proxy-agent: 5.0.1 make-dir: 3.1.0 - node-fetch: 2.6.12 + node-fetch: 2.6.11 nopt: 5.0.0 npmlog: 5.0.1 rimraf: 3.0.2 - semver: 7.5.4 + semver: 7.5.3 tar: 6.1.15 transitivePeerDependencies: - encoding @@ -8138,7 +8201,7 @@ packages: '@octokit/request-error': 2.1.0 '@octokit/types': 6.41.0 is-plain-object: 5.0.0 - node-fetch: 2.6.12 + node-fetch: 2.6.11 universal-user-agent: 6.0.0 transitivePeerDependencies: - encoding @@ -8183,6 +8246,30 @@ packages: playwright-core: 1.29.2 dev: true + /@preact/preset-vite@2.5.0(preact@10.15.1): + resolution: {integrity: sha512-BUhfB2xQ6ex0yPkrT1Z3LbfPzjpJecOZwQ/xJrXGFSZD84+ObyS//41RdEoQCMWsM0t7UHGaujUxUBub7WM1Jw==} + peerDependencies: + '@babel/core': 7.x + vite: 2.x || 3.x || 4.x + peerDependenciesMeta: + '@babel/core': + optional: true + vite: + optional: true + dependencies: + '@babel/plugin-transform-react-jsx': 7.22.5(@babel/core@7.22.5) + '@babel/plugin-transform-react-jsx-development': 7.22.5 + '@prefresh/vite': 2.4.1(preact@10.15.1) + '@rollup/pluginutils': 4.2.1 + babel-plugin-transform-hook-names: 1.0.2 + debug: 4.3.4 + kolorist: 1.8.0 + resolve: 1.22.2 + transitivePeerDependencies: + - preact + - supports-color + dev: false + /@preact/signals-core@1.3.0: resolution: {integrity: sha512-M+M3ZOtd1dtV/uasyk4SZu1vbfEJ4NeENv0F7F12nijZYedB5wSgbtZcuACyssnTznhF4ctUyrR0dZHuHfyWKA==} dev: false @@ -8205,6 +8292,41 @@ packages: preact: 10.15.1 dev: false + /@prefresh/babel-plugin@0.5.0: + resolution: {integrity: sha512-joAwpkUDwo7ZqJnufXRGzUb+udk20RBgfA8oLPBh5aJH2LeStmV1luBfeJTztPdyCscC2j2SmZ/tVxFRMIxAEw==} + dev: false + + /@prefresh/core@1.5.1(preact@10.15.1): + resolution: {integrity: sha512-e0mB0Oxtog6ZpKPDBYbzFniFJDIktuKMzOHp7sguntU+ot0yi6dbhJRE9Css1qf0u16wdSZjpL2W2ODWuU05Cw==} + peerDependencies: + preact: ^10.0.0 + dependencies: + preact: 10.15.1 + dev: false + + /@prefresh/utils@1.2.0: + resolution: {integrity: sha512-KtC/fZw+oqtwOLUFM9UtiitB0JsVX0zLKNyRTA332sqREqSALIIQQxdUCS1P3xR/jT1e2e8/5rwH6gdcMLEmsQ==} + dev: false + + /@prefresh/vite@2.4.1(preact@10.15.1): + resolution: {integrity: sha512-vthWmEqu8TZFeyrBNc9YE5SiC3DVSzPgsOCp/WQ7FqdHpOIJi7Z8XvCK06rBPOtG4914S52MjG9Ls22eVAiuqQ==} + peerDependencies: + preact: ^10.4.0 + vite: '>=2.0.0' + peerDependenciesMeta: + vite: + optional: true + dependencies: + '@babel/core': 7.22.5 + '@prefresh/babel-plugin': 0.5.0 + '@prefresh/core': 1.5.1(preact@10.15.1) + '@prefresh/utils': 1.2.0 + '@rollup/pluginutils': 4.2.1 + preact: 10.15.1 + transitivePeerDependencies: + - supports-color + dev: false + /@rollup/plugin-babel@5.3.1(@babel/core@7.22.5)(rollup@2.79.1): resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} engines: {node: '>= 10.0.0'} @@ -8855,7 +8977,7 @@ packages: debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 - semver: 7.5.4 + semver: 7.5.3 ts-api-utils: 1.0.1(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -8876,7 +8998,7 @@ packages: '@typescript-eslint/typescript-estree': 6.0.0(typescript@5.1.6) eslint: 8.43.0 eslint-scope: 5.1.1 - semver: 7.5.4 + semver: 7.5.3 transitivePeerDependencies: - supports-color - typescript @@ -8953,6 +9075,23 @@ packages: - supports-color dev: false + /@vitejs/plugin-react@4.0.3: + resolution: {integrity: sha512-pwXDog5nwwvSIzwrvYYmA2Ljcd/ZNlcsSG2Q9CNDBwnsd55UGAyr2doXtB5j+2uymRCnCfExlznzzSFbBRcoCg==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.2.0 + peerDependenciesMeta: + vite: + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/plugin-transform-react-jsx-self': 7.22.5(@babel/core@7.22.5) + '@babel/plugin-transform-react-jsx-source': 7.22.5(@babel/core@7.22.5) + react-refresh: 0.14.0 + transitivePeerDependencies: + - supports-color + dev: false + /@vitejs/plugin-vue-jsx@3.0.1(vite@4.4.6)(vue@3.3.4): resolution: {integrity: sha512-+Jb7ggL48FSPS1uhPnJbJwWa9Sr90vQ+d0InW+AhBM22n+cfuYqJZDckBc+W3QSHe1WDvewMZfa4wZOtk5pRgw==} engines: {node: ^14.18.0 || >=16.0.0} @@ -9520,7 +9659,7 @@ packages: preferred-pm: 3.0.3 prompts: 2.4.2 rehype: 12.0.1 - semver: 7.5.4 + semver: 7.5.3 server-destroy: 1.0.1 shiki: 0.14.1 string-width: 5.1.2 @@ -9609,7 +9748,7 @@ packages: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} - /babel-plugin-jsx-dom-expressions@0.36.10: + /babel-plugin-jsx-dom-expressions@0.36.10(@babel/core@7.22.5): resolution: {integrity: sha512-QA2k/14WGw+RgcGGnEuLWwnu4em6CGhjeXtjvgOYyFHYS2a+CzPeaVQHDOlfuiBcjq/3hWMspHMIMnPEOIzdBg==} peerDependencies: '@babel/core': ^7.20.12 @@ -9617,6 +9756,7 @@ packages: '@babel/core': optional: true dependencies: + '@babel/core': 7.22.5 '@babel/helper-module-imports': 7.18.6 '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.22.5) '@babel/types': 7.22.5 @@ -9624,17 +9764,6 @@ packages: validate-html-nesting: 1.2.2 dev: false - /babel-plugin-module-resolver@5.0.0: - resolution: {integrity: sha512-g0u+/ChLSJ5+PzYwLwP8Rp8Rcfowz58TJNCe+L/ui4rpzE/mg//JVX0EWBUYoxaextqnwuGHzfGp2hh0PPV25Q==} - engines: {node: '>= 16'} - dependencies: - find-babel-config: 2.0.0 - glob: 8.1.0 - pkg-up: 3.1.0 - reselect: 4.1.8 - resolve: 1.22.2 - dev: false - /babel-plugin-polyfill-corejs2@0.3.3(@babel/core@7.22.5): resolution: {integrity: sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==} peerDependencies: @@ -9680,7 +9809,16 @@ packages: - supports-color dev: false - /babel-preset-solid@1.7.4: + /babel-plugin-transform-hook-names@1.0.2: + resolution: {integrity: sha512-5gafyjyyBTTdX/tQQ0hRgu4AhNHG/hqWi0ZZmg2xvs2FgRkJXzDNKBZCyoYqgFkovfDrgM8OoKg8karoUvWeCw==} + peerDependencies: + '@babel/core': ^7.12.10 + peerDependenciesMeta: + '@babel/core': + optional: true + dev: false + + /babel-preset-solid@1.7.4(@babel/core@7.22.5): resolution: {integrity: sha512-0mbHNYkbOVYhH6L95VlHVkBEVQjOXSzUqLDiFxUcsg/tU4yTM/qx7FI8C+kmos9LHckQBSm3wtwoe1BZLNJR1w==} peerDependencies: '@babel/core': ^7.0.0 @@ -9688,7 +9826,8 @@ packages: '@babel/core': optional: true dependencies: - babel-plugin-jsx-dom-expressions: 0.36.10 + '@babel/core': 7.22.5 + babel-plugin-jsx-dom-expressions: 0.36.10(@babel/core@7.22.5) dev: false /bail@2.0.2: @@ -9858,7 +9997,7 @@ packages: /builtins@5.0.1: resolution: {integrity: sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==} dependencies: - semver: 7.5.4 + semver: 7.5.3 dev: true /bundle-name@3.0.0: @@ -10243,7 +10382,7 @@ packages: js-string-escape: 1.0.1 lodash: 4.17.21 md5-hex: 3.0.1 - semver: 7.5.4 + semver: 7.5.3 well-known-symbols: 2.0.0 dev: false @@ -11801,21 +11940,6 @@ packages: dependencies: to-regex-range: 5.0.1 - /find-babel-config@2.0.0: - resolution: {integrity: sha512-dOKT7jvF3hGzlW60Gc3ONox/0rRZ/tz7WCil0bqA1In/3I8f1BctpXahRnEKDySZqci7u+dqq93sZST9fOJpFw==} - engines: {node: '>=16.0.0'} - dependencies: - json5: 2.2.3 - path-exists: 4.0.0 - dev: false - - /find-up@3.0.0: - resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} - engines: {node: '>=6'} - dependencies: - locate-path: 3.0.0 - dev: false - /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -12101,17 +12225,6 @@ packages: once: 1.4.0 path-is-absolute: 1.0.1 - /glob@8.1.0: - resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} - engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - dev: false - /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -12139,7 +12252,7 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.2.12 + fast-glob: 3.3.1 ignore: 5.2.4 merge2: 1.4.1 slash: 3.0.0 @@ -12162,7 +12275,7 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: dir-glob: 3.0.1 - fast-glob: 3.2.12 + fast-glob: 3.3.1 ignore: 5.2.4 merge2: 1.4.1 slash: 4.0.0 @@ -12905,6 +13018,11 @@ packages: dependencies: call-bind: 1.0.2 + /is-what@4.1.15: + resolution: {integrity: sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==} + engines: {node: '>=12.13'} + dev: false + /is-windows@1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} @@ -13126,6 +13244,10 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} + /kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + dev: false + /leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} engines: {node: '>=6'} @@ -13215,14 +13337,6 @@ packages: engines: {node: '>=14'} dev: false - /locate-path@3.0.0: - resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} - engines: {node: '>=6'} - dependencies: - p-locate: 3.0.0 - path-exists: 3.0.0 - dev: false - /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -13659,6 +13773,13 @@ packages: yargs-parser: 18.1.3 dev: true + /merge-anything@5.1.7: + resolution: {integrity: sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ==} + engines: {node: '>=12.13'} + dependencies: + is-what: 4.1.15 + dev: false + /merge-descriptors@1.0.1: resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} dev: true @@ -14334,7 +14455,7 @@ packages: resolution: {integrity: sha512-zNy02qivjjRosswoYmPi8hIKJRr8MpQyeKT6qlcq/OnOgA3Rhoae+IYOqsM9V5+JnHWmxKnWOT2GxvtqdtOCXA==} engines: {node: '>=10'} dependencies: - semver: 7.5.4 + semver: 7.5.3 dev: false /node-addon-api@6.1.0: @@ -14350,8 +14471,8 @@ packages: resolution: {integrity: sha512-5IAMBTl9p6PaAjYCnMv5FmqIF6GcZnawAVnzaCG0rX2aYZJ4CxEkZNtVPuTRug7fL7wyM5BQYTlAzcyMPi6oTQ==} dev: false - /node-fetch@2.6.12: - resolution: {integrity: sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==} + /node-fetch@2.6.11: + resolution: {integrity: sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==} engines: {node: 4.x || >=6.0.0} peerDependencies: encoding: ^0.1.0 @@ -14471,7 +14592,7 @@ packages: dependencies: execa: 6.1.0 parse-package-name: 1.0.0 - semver: 7.5.4 + semver: 7.5.3 validate-npm-package-name: 4.0.0 dev: true @@ -14640,13 +14761,6 @@ packages: yocto-queue: 1.0.0 dev: false - /p-locate@3.0.0: - resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} - engines: {node: '>=6'} - dependencies: - p-limit: 2.3.0 - dev: false - /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -14795,11 +14909,6 @@ packages: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} dev: true - /path-exists@3.0.0: - resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} - engines: {node: '>=4'} - dev: false - /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -14897,13 +15006,6 @@ packages: pathe: 1.1.0 dev: false - /pkg-up@3.1.0: - resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} - engines: {node: '>=8'} - dependencies: - find-up: 3.0.0 - dev: false - /playwright-core@1.29.2: resolution: {integrity: sha512-94QXm4PMgFoHAhlCuoWyaBYKb92yOcGVHdQLoxQ7Wjlc7Flg4aC/jbFW7xMR52OfXMVkWicue4WXE7QEegbIRA==} engines: {node: '>=14'} @@ -15557,6 +15659,11 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: false + /react-refresh@0.14.0: + resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} + engines: {node: '>=0.10.0'} + dev: false + /react@18.2.0: resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} engines: {node: '>=0.10.0'} @@ -15916,10 +16023,6 @@ packages: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} dev: true - /reselect@4.1.8: - resolution: {integrity: sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==} - dev: false - /resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -16054,8 +16157,8 @@ packages: optionalDependencies: fsevents: 2.3.2 - /rollup@3.26.3: - resolution: {integrity: sha512-7Tin0C8l86TkpcMtXvQu6saWH93nhG3dGQ1/+l5V2TDMceTxO7kDiK6GzbfLWNNxqJXm591PcEZUozZm51ogwQ==} + /rollup@3.27.0: + resolution: {integrity: sha512-aOltLCrYZ0FhJDm7fCqwTjIUEVjWjcydKBV/Zeid6Mn8BWgDCUBBWT5beM5ieForYNo/1ZHuGJdka26kvQ3Gzg==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: @@ -16175,13 +16278,6 @@ packages: dependencies: lru-cache: 6.0.0 - /semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -16413,6 +16509,17 @@ packages: csstype: 3.1.2 seroval: 0.5.1 + /solid-refresh@0.5.3(solid-js@1.7.6): + resolution: {integrity: sha512-Otg5it5sjOdZbQZJnvo99TEBAr6J7PQ5AubZLNU6szZzg3RQQ5MX04oteBIIGDs0y2Qv8aXKm9e44V8z+UnFdw==} + peerDependencies: + solid-js: ^1.3 + dependencies: + '@babel/generator': 7.22.5 + '@babel/helper-module-imports': 7.22.5 + '@babel/types': 7.22.5 + solid-js: 1.7.6 + dev: false + /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} @@ -17208,7 +17315,7 @@ packages: /typescript-auto-import-cache@0.3.0: resolution: {integrity: sha512-Rq6/q4O9iyqUdjvOoyas7x/Qf9nWUMeqpP3YeTaLA+uECgfy5wOhfOS+SW/+fZ/uI/ZcKaf+2/ZhFzXh8xfofQ==} dependencies: - semver: 7.5.4 + semver: 7.5.3 dev: true /typescript@5.1.6: @@ -17579,6 +17686,27 @@ packages: - supports-color dev: false + /vite-plugin-solid@2.7.0(solid-js@1.7.6): + resolution: {integrity: sha512-avp/Jl5zOp/Itfo67xtDB2O61U7idviaIp4mLsjhCa13PjKNasz+IID0jYTyqUp9SFx6/PmBr6v4KgDppqompg==} + peerDependencies: + solid-js: ^1.7.2 + vite: ^3.0.0 || ^4.0.0 + peerDependenciesMeta: + vite: + optional: true + dependencies: + '@babel/core': 7.22.5 + '@babel/preset-typescript': 7.22.5(@babel/core@7.22.5) + '@types/babel__core': 7.20.1 + babel-preset-solid: 1.7.4(@babel/core@7.22.5) + merge-anything: 5.1.7 + solid-js: 1.7.6 + solid-refresh: 0.5.3(solid-js@1.7.6) + vitefu: 0.2.4(vite@4.4.6) + transitivePeerDependencies: + - supports-color + dev: false + /vite@4.3.9(@types/node@18.16.18): resolution: {integrity: sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==} engines: {node: ^14.18.0 || >=16.0.0} @@ -17643,7 +17771,7 @@ packages: '@types/node': 14.18.51 esbuild: 0.18.16 postcss: 8.4.27 - rollup: 3.26.3 + rollup: 3.27.0 optionalDependencies: fsevents: 2.3.2 dev: true @@ -17679,7 +17807,7 @@ packages: '@types/node': 18.16.18 esbuild: 0.18.16 postcss: 8.4.27 - rollup: 3.26.3 + rollup: 3.27.0 sass: 1.63.4 optionalDependencies: fsevents: 2.3.2 @@ -17846,7 +17974,7 @@ packages: dependencies: '@volar/language-service': 1.10.0 '@volar/typescript': 1.10.0 - semver: 7.5.4 + semver: 7.5.3 typescript-auto-import-cache: 0.3.0 vscode-languageserver-textdocument: 1.0.8 vscode-nls: 5.2.0