Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove experimental flag for custom client directives #7237

Merged
merged 5 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fuzzy-tables-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': minor
---

Remove experimental flag for custom client directives
3 changes: 0 additions & 3 deletions examples/middleware/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ export default defineConfig({
adapter: node({
mode: 'standalone',
}),
experimental: {
middleware: true,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { fileURLToPath } from 'url';

export default defineConfig({
integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()],
experimental: {
customClientDirectives: true
}
});

function astroClientClickDirective() {
Expand Down
22 changes: 0 additions & 22 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,28 +1166,6 @@ export interface AstroUserConfig {
*/
assets?: boolean;

/**
* @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.hybridOutput
Expand Down
6 changes: 0 additions & 6 deletions packages/astro/src/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
experimental: {
assets: false,
hybridOutput: false,
customClientDirectives: false,
middleware: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this wasn't removed in the unflag middleware PR, which I removed here.

redirects: false,
},
};
Expand Down Expand Up @@ -208,10 +206,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),
hybridOutput: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.hybridOutput),
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.redirects),
})
Expand Down
5 changes: 0 additions & 5 deletions packages/astro/src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
Expand Down
7 changes: 0 additions & 7 deletions packages/astro/test/fixtures/middleware-dev/astro.config.mjs

This file was deleted.

3 changes: 0 additions & 3 deletions packages/astro/test/fixtures/middleware-ssg/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ import { defineConfig } from 'astro/config';

export default defineConfig({
output: "static",
experimental: {
middleware: true
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ import tailwind from '@astrojs/tailwind';
// https://astro.build/config
export default defineConfig({
integrations: [tailwind()],
experimental: {
middleware: true,
}
});
1 change: 0 additions & 1 deletion packages/astro/test/redirects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ describe('Astro.redirect', () => {
root: './fixtures/ssr-redirect/',
output: 'static',
experimental: {
middleware: true,
redirects: true,
},
redirects: {
Expand Down