From 23a3a79d716299e12fe13f8120d4653f259305dc Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 29 May 2023 20:58:20 +0800 Subject: [PATCH 1/2] Remove experimental flag for custom client directives --- .changeset/fuzzy-tables-build.md | 5 +++++ .../custom-client-directives/astro.config.mjs | 3 --- packages/astro/src/@types/astro.ts | 22 ------------------- packages/astro/src/core/config/schema.ts | 5 ----- packages/astro/src/integrations/index.ts | 5 ----- 5 files changed, 5 insertions(+), 35 deletions(-) create mode 100644 .changeset/fuzzy-tables-build.md diff --git a/.changeset/fuzzy-tables-build.md b/.changeset/fuzzy-tables-build.md new file mode 100644 index 000000000000..11c5ea323f43 --- /dev/null +++ b/.changeset/fuzzy-tables-build.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Remove experimental flag for custom client directives diff --git a/packages/astro/e2e/fixtures/custom-client-directives/astro.config.mjs b/packages/astro/e2e/fixtures/custom-client-directives/astro.config.mjs index 451c7ddd8ad3..4f32edd6f182 100644 --- a/packages/astro/e2e/fixtures/custom-client-directives/astro.config.mjs +++ b/packages/astro/e2e/fixtures/custom-client-directives/astro.config.mjs @@ -4,9 +4,6 @@ import { fileURLToPath } from 'url'; export default defineConfig({ integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()], - experimental: { - customClientDirectives: true - } }); function astroClientClickDirective() { diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index c494cf12759a..d9e3bc16a2c5 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1099,28 +1099,6 @@ export interface AstroUserConfig { */ inlineStylesheets?: 'always' | 'auto' | 'never'; - /** - * @docs - * @name experimental.customClientDirectives - * @type {boolean} - * @default `false` - * @version 2.5.0 - * @description - * Allow integrations to use the [experimental `addClientDirective` API](/en/reference/integrations-reference/#addclientdirective-option) in the `astro:config:setup` hook - * to add custom client directives in Astro files. - * - * To enable this feature, set `experimental.customClientDirectives` to `true` in your Astro config: - * - * ```js - * { - * experimental: { - * customClientDirectives: true, - * }, - * } - * ``` - */ - customClientDirectives?: boolean; - /** * @docs * @name experimental.middleware diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index 1c246a4a8433..7c71d719cf47 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -40,7 +40,6 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = { experimental: { assets: false, hybridOutput: false, - customClientDirectives: false, inlineStylesheets: 'never', middleware: false, }, @@ -199,10 +198,6 @@ export const AstroConfigSchema = z.object({ experimental: z .object({ assets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.assets), - customClientDirectives: z - .boolean() - .optional() - .default(ASTRO_CONFIG_DEFAULTS.experimental.customClientDirecives), inlineStylesheets: z .enum(['always', 'auto', 'never']) .optional() diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 5d88a1196bf3..1bc69acc8ce6 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -102,11 +102,6 @@ export async function runHookConfigSetup({ updatedSettings.watchFiles.push(path instanceof URL ? fileURLToPath(path) : path); }, addClientDirective: ({ name, entrypoint }) => { - if (!settings.config.experimental.customClientDirectives) { - throw new Error( - `The "${integration.name}" integration is trying to add the "${name}" client directive, but the \`experimental.customClientDirectives\` config is not enabled.` - ); - } if (updatedSettings.clientDirectives.has(name) || addedClientDirectives.has(name)) { throw new Error( `The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.` From d0547182f1a7edd83a32388660de5ca13ce4eadd Mon Sep 17 00:00:00 2001 From: bluwy Date: Mon, 5 Jun 2023 23:45:34 +0800 Subject: [PATCH 2/2] Fix middleware test --- examples/middleware/astro.config.mjs | 3 --- .../astro/test/fixtures/middleware-dev/astro.config.mjs | 7 ------- .../astro/test/fixtures/middleware-ssg/astro.config.mjs | 3 --- .../test/fixtures/middleware-tailwind/astro.config.mjs | 3 --- packages/astro/test/redirects.test.js | 1 - 5 files changed, 17 deletions(-) delete mode 100644 packages/astro/test/fixtures/middleware-dev/astro.config.mjs diff --git a/examples/middleware/astro.config.mjs b/examples/middleware/astro.config.mjs index 1d4662423eff..68ba7fac5876 100644 --- a/examples/middleware/astro.config.mjs +++ b/examples/middleware/astro.config.mjs @@ -7,7 +7,4 @@ export default defineConfig({ adapter: node({ mode: 'standalone', }), - experimental: { - middleware: true, - }, }); diff --git a/packages/astro/test/fixtures/middleware-dev/astro.config.mjs b/packages/astro/test/fixtures/middleware-dev/astro.config.mjs deleted file mode 100644 index 4379be246f94..000000000000 --- a/packages/astro/test/fixtures/middleware-dev/astro.config.mjs +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'astro/config'; - -export default defineConfig({ - experimental: { - middleware: true - } -}); diff --git a/packages/astro/test/fixtures/middleware-ssg/astro.config.mjs b/packages/astro/test/fixtures/middleware-ssg/astro.config.mjs index 2f2e911a8d6d..a8ce50d378e6 100644 --- a/packages/astro/test/fixtures/middleware-ssg/astro.config.mjs +++ b/packages/astro/test/fixtures/middleware-ssg/astro.config.mjs @@ -2,7 +2,4 @@ import { defineConfig } from 'astro/config'; export default defineConfig({ output: "static", - experimental: { - middleware: true - } }); diff --git a/packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs b/packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs index e6b93533dd7b..db58bbf858ea 100644 --- a/packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs +++ b/packages/astro/test/fixtures/middleware-tailwind/astro.config.mjs @@ -5,7 +5,4 @@ import tailwind from '@astrojs/tailwind'; // https://astro.build/config export default defineConfig({ integrations: [tailwind()], - experimental: { - middleware: true, - } }); diff --git a/packages/astro/test/redirects.test.js b/packages/astro/test/redirects.test.js index e1891e5f35c7..5cff8fe3d938 100644 --- a/packages/astro/test/redirects.test.js +++ b/packages/astro/test/redirects.test.js @@ -71,7 +71,6 @@ describe('Astro.redirect', () => { root: './fixtures/ssr-redirect/', output: 'static', experimental: { - middleware: true, redirects: true, }, redirects: {