diff --git a/.changeset/loud-apes-flash.md b/.changeset/loud-apes-flash.md new file mode 100644 index 000000000000..598f26d05846 --- /dev/null +++ b/.changeset/loud-apes-flash.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Removes warnings for integrations/ssr diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index e3e94095a6c6..f4bb441c3cc9 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -69,8 +69,6 @@ export interface CLIFlags { host?: string | boolean; port?: number; config?: string; - experimentalSsr?: boolean; - experimentalIntegrations?: boolean; drafts?: boolean; } @@ -684,20 +682,6 @@ export interface AstroUserConfig { */ vite?: ViteUserConfig; - experimental?: { - /** - * Enable support for 3rd-party integrations. - * Default: false - */ - integrations?: boolean; - - /** - * Enable support for 3rd-party SSR adapters. - * Default: false - */ - ssr?: boolean; - }; - // Legacy options to be removed /** @deprecated - Use "integrations" instead. Run Astro to learn more about migrating. */ @@ -720,8 +704,6 @@ export interface AstroUserConfig { buildOptions?: never; /** @deprecated `devOptions` has been renamed to `server` */ devOptions?: never; - /** @deprecated `experimentalIntegrations` has been renamed to `experimental: { integrations: true }` */ - experimentalIntegrations?: never; } // NOTE(fks): We choose to keep our hand-generated AstroUserConfig interface so that diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 131cf14421af..f35e2d12f6a9 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -14,7 +14,7 @@ import { } from '../../integrations/index.js'; import { createVite, ViteConfigWithSSR } from '../create-vite.js'; import { fixViteErrorMessage } from '../errors.js'; -import { debug, info, levels, timerMessage, warnIfUsingExperimentalSSR } from '../logger/core.js'; +import { debug, info, levels, timerMessage } from '../logger/core.js'; import { apply as applyPolyfill } from '../polyfill.js'; import { RouteCache } from '../render/route-cache.js'; import { createRouteManifest } from '../routing/index.js'; @@ -80,7 +80,6 @@ class AstroBuilder { { astroConfig: this.config, logging, mode: 'build' } ); await runHookConfigDone({ config: this.config }); - warnIfUsingExperimentalSSR(logging, this.config); const viteServer = await vite.createServer(viteConfig); debug('build', timerMessage('Vite started', this.timer.viteStart)); return { viteConfig, viteServer }; diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index c08bf3576507..b474b29dfa7e 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -50,10 +50,6 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = { rehypePlugins: [], }, vite: {}, - experimental: { - ssr: false, - integrations: false, - }, }; async function resolvePostcssConfig(inlineOptions: any, root: URL): Promise { @@ -90,7 +86,6 @@ export const LEGACY_ASTRO_CONFIG_KEYS = new Set([ 'markdownOptions', 'buildOptions', 'devOptions', - 'experimentalIntegrations', ]); export const AstroConfigSchema = z.object({ @@ -221,13 +216,6 @@ export const AstroConfigSchema = z.object({ vite: z .custom((data) => data instanceof Object && !Array.isArray(data)) .default(ASTRO_CONFIG_DEFAULTS.vite), - experimental: z - .object({ - ssr: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.ssr), - integrations: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.integrations), - }) - .optional() - .default({}), }); /** Turn raw config values into normalized values */ @@ -354,22 +342,6 @@ export async function validateConfig( (result._ctx.renderers as any[]).unshift(jsxRenderer); } - // Final-Pass Validation (perform checks that require the full config object) - if ( - !result.experimental?.integrations && - !result.integrations.every((int) => int.name.startsWith('@astrojs/')) - ) { - throw new Error( - [ - `Astro integrations are still experimental.`, - ``, - `Only official "@astrojs/*" integrations are currently supported.`, - `To enable 3rd-party integrations, use the "--experimental-integrations" flag.`, - `Breaking changes may occur in this API before Astro v1.0 is released.`, - ``, - ].join('\n') - ); - } // If successful, return the result as a verified AstroConfig object. return result; } @@ -383,11 +355,6 @@ function resolveFlags(flags: Partial): CLIFlags { config: typeof flags.config === 'string' ? flags.config : undefined, host: typeof flags.host === 'string' || typeof flags.host === 'boolean' ? flags.host : undefined, - experimentalSsr: typeof flags.experimentalSsr === 'boolean' ? flags.experimentalSsr : undefined, - experimentalIntegrations: - typeof flags.experimentalIntegrations === 'boolean' - ? flags.experimentalIntegrations - : undefined, drafts: typeof flags.drafts === 'boolean' ? flags.drafts : false, }; } @@ -395,13 +362,8 @@ function resolveFlags(flags: Partial): CLIFlags { /** Merge CLI flags & user config object (CLI flags take priority) */ function mergeCLIFlags(astroConfig: AstroUserConfig, flags: CLIFlags, cmd: string) { astroConfig.server = astroConfig.server || {}; - astroConfig.experimental = astroConfig.experimental || {}; astroConfig.markdown = astroConfig.markdown || {}; if (typeof flags.site === 'string') astroConfig.site = flags.site; - if (typeof flags.experimentalSsr === 'boolean') - astroConfig.experimental.ssr = flags.experimentalSsr; - if (typeof flags.experimentalIntegrations === 'boolean') - astroConfig.experimental.integrations = flags.experimentalIntegrations; if (typeof flags.drafts === 'boolean') astroConfig.markdown.drafts = flags.drafts; if (typeof flags.port === 'number') { // @ts-expect-error astroConfig.server may be a function, but TS doesn't like attaching properties to a function. diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index 0e5a3fca0442..df26858e5e26 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -11,7 +11,7 @@ import { runHookServerStart, } from '../../integrations/index.js'; import { createVite } from '../create-vite.js'; -import { info, LogOptions, warn, warnIfUsingExperimentalSSR } from '../logger/core.js'; +import { info, LogOptions, warn } from '../logger/core.js'; import * as msg from '../messages.js'; import { apply as applyPolyfill } from '../polyfill.js'; @@ -58,7 +58,6 @@ export default async function dev(config: AstroConfig, options: DevOptions): Pro { astroConfig: config, logging: options.logging, mode: 'dev' } ); await runHookConfigDone({ config }); - warnIfUsingExperimentalSSR(options.logging, config); const viteServer = await vite.createServer(viteConfig); runHookServerSetup({ config, server: viteServer }); await viteServer.listen(port); diff --git a/packages/astro/src/core/logger/core.ts b/packages/astro/src/core/logger/core.ts index 06296208613a..bed6c7be8a39 100644 --- a/packages/astro/src/core/logger/core.ts +++ b/packages/astro/src/core/logger/core.ts @@ -127,17 +127,3 @@ export function timerMessage(message: string, startTime: number = Date.now()) { timeDiff < 750 ? `${Math.round(timeDiff)}ms` : `${(timeDiff / 1000).toFixed(1)}s`; return `${message} ${dim(timeDisplay)}`; } - -/** - * A warning that SSR is experimental. Remove when we can. - */ -export function warnIfUsingExperimentalSSR(opts: LogOptions, config: AstroConfig) { - if (config._ctx.adapter?.serverEntrypoint) { - warn( - opts, - 'warning', - bold(`Warning:`), - `SSR support is still experimental and subject to API changes. If using in production, pin your dependencies to prevent accidental breakage.` - ); - } -} diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 8d766771b63b..76c2c310a884 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -187,20 +187,7 @@ export function isBuildingToSSR(config: AstroConfig): boolean { if (!adapter) return false; if (typeof adapter.serverEntrypoint === 'string') { - if (!adapter.name.startsWith('@astrojs/') && !config.experimental.ssr) { - throw new Error( - [ - `Server-side rendering (SSR) is still experimental.`, - ``, - `Only official "@astrojs/*" adapters are currently supported.`, - `To enable SSR for 3rd-party adapters, use the "--experimental-ssr" flag.`, - `Breaking changes may occur in this API before Astro v1.0 is released.`, - ``, - ].join('\n') - ); - } else { - return true; - } + return true; } else { return false; } diff --git a/packages/astro/test/config-validate.test.js b/packages/astro/test/config-validate.test.js index 95c3af17c207..6fefed9e4cf9 100644 --- a/packages/astro/test/config-validate.test.js +++ b/packages/astro/test/config-validate.test.js @@ -61,14 +61,6 @@ describe('Config Validation', () => { { name: '@astrojs/c', hooks: {} }, ]); }); - it('blocks third-party "integration" values', async () => { - const configError = await validateConfig( - { integrations: [{ name: '@my-plugin/a' }] }, - process.cwd() - ).catch((err) => err); - expect(configError).to.be.instanceOf(Error); - expect(configError.message).to.include('Astro integrations are still experimental.'); - }); it('ignores null or falsy "integration" values', async () => { const configError = await validateConfig( { integrations: [null, undefined, false, '', ``] }, @@ -76,10 +68,4 @@ describe('Config Validation', () => { ).catch((err) => err); expect(configError).to.be.not.instanceOf(Error); }); - it('allows third-party "integration" values with the --experimental-integrations flag', async () => { - await validateConfig( - { integrations: [{ name: '@my-plugin/a' }], experimental: { integrations: true } }, - process.cwd() - ).catch((err) => err); - }); });