mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
Remove experimental flag for custom client directives (#7237)
This commit is contained in:
parent
b5213654b1
commit
414eb19d2f
10 changed files with 5 additions and 53 deletions
5
.changeset/fuzzy-tables-build.md
Normal file
5
.changeset/fuzzy-tables-build.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove experimental flag for custom client directives
|
|
@ -7,7 +7,4 @@ export default defineConfig({
|
||||||
adapter: node({
|
adapter: node({
|
||||||
mode: 'standalone',
|
mode: 'standalone',
|
||||||
}),
|
}),
|
||||||
experimental: {
|
|
||||||
middleware: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,9 +4,6 @@ import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()],
|
integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()],
|
||||||
experimental: {
|
|
||||||
customClientDirectives: true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function astroClientClickDirective() {
|
function astroClientClickDirective() {
|
||||||
|
|
|
@ -1166,28 +1166,6 @@ export interface AstroUserConfig {
|
||||||
*/
|
*/
|
||||||
assets?: boolean;
|
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
|
* @docs
|
||||||
* @name experimental.hybridOutput
|
* @name experimental.hybridOutput
|
||||||
|
|
|
@ -43,8 +43,6 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
|
||||||
experimental: {
|
experimental: {
|
||||||
assets: false,
|
assets: false,
|
||||||
hybridOutput: false,
|
hybridOutput: false,
|
||||||
customClientDirectives: false,
|
|
||||||
middleware: false,
|
|
||||||
redirects: false,
|
redirects: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -208,10 +206,6 @@ export const AstroConfigSchema = z.object({
|
||||||
experimental: z
|
experimental: z
|
||||||
.object({
|
.object({
|
||||||
assets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.assets),
|
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),
|
hybridOutput: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.hybridOutput),
|
||||||
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.redirects),
|
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.redirects),
|
||||||
})
|
})
|
||||||
|
|
|
@ -102,11 +102,6 @@ export async function runHookConfigSetup({
|
||||||
updatedSettings.watchFiles.push(path instanceof URL ? fileURLToPath(path) : path);
|
updatedSettings.watchFiles.push(path instanceof URL ? fileURLToPath(path) : path);
|
||||||
},
|
},
|
||||||
addClientDirective: ({ name, entrypoint }) => {
|
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)) {
|
if (updatedSettings.clientDirectives.has(name) || addedClientDirectives.has(name)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.`
|
`The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.`
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { defineConfig } from 'astro/config';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
experimental: {
|
|
||||||
middleware: true
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -2,7 +2,4 @@ import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
output: "static",
|
output: "static",
|
||||||
experimental: {
|
|
||||||
middleware: true
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,4 @@ import tailwind from '@astrojs/tailwind';
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
integrations: [tailwind()],
|
integrations: [tailwind()],
|
||||||
experimental: {
|
|
||||||
middleware: true,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,7 +71,6 @@ describe('Astro.redirect', () => {
|
||||||
root: './fixtures/ssr-redirect/',
|
root: './fixtures/ssr-redirect/',
|
||||||
output: 'static',
|
output: 'static',
|
||||||
experimental: {
|
experimental: {
|
||||||
middleware: true,
|
|
||||||
redirects: true,
|
redirects: true,
|
||||||
},
|
},
|
||||||
redirects: {
|
redirects: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue