From 153a5abb905042ac68b712514dc9ec387d3e6b17 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 28 Nov 2023 00:44:20 +0800 Subject: [PATCH] Remove deprecated features from Astro 3.0 (#9168) --- .changeset/slow-hornets-try.md | 5 ++ .changeset/wicked-sloths-develop.md | 11 ++++ benchmark/packages/timer/src/index.ts | 1 + packages/astro-rss/README.md | 22 +++---- packages/astro-rss/src/index.ts | 16 +---- packages/astro-rss/src/schema.ts | 1 - packages/astro-rss/test/rss.test.js | 26 +------- packages/astro/client.d.ts | 2 - packages/astro/src/@types/astro.ts | 62 ++----------------- packages/astro/src/cli/build/index.ts | 1 - packages/astro/src/cli/flags.ts | 3 - packages/astro/src/core/build/generate.ts | 45 +++----------- packages/astro/src/core/build/index.ts | 28 +-------- .../src/core/build/plugins/plugin-manifest.ts | 2 - .../src/core/build/plugins/plugin-pages.ts | 4 -- .../src/core/build/plugins/plugin-ssr.ts | 13 ++-- packages/astro/src/core/config/config.ts | 1 - packages/astro/src/core/config/schema.ts | 28 +-------- packages/astro/src/core/render/core.ts | 8 --- .../integrations/astroFeaturesValidation.ts | 28 +++------ packages/astro/src/integrations/index.ts | 6 +- packages/astro/src/runtime/server/endpoint.ts | 31 +--------- .../astro/test/astro-markdown-drafts.test.js | 44 ------------- packages/astro/test/events.test.js | 2 - packages/astro/test/featuresSupport.test.js | 14 +---- .../astro-markdown-drafts/package.json | 8 --- .../astro-markdown-drafts/src/pages/index.md | 7 --- .../astro-markdown-drafts/src/pages/wip.md | 8 --- .../astro-markdown/src/pages/vite-env-vars.md | 2 +- .../ssr-api-route/src/pages/binary.js | 2 +- .../src/pages/invalid-redirect.json.ts | 2 +- packages/astro/test/middleware.test.js | 20 ++++-- .../test/ssr-adapter-build-config.test.js | 1 + packages/astro/test/test-adapter.js | 10 +-- .../astro/test/units/integrations/api.test.js | 2 +- .../src/pages/collection.json.js | 2 +- .../src/pages/entry.json.js | 2 +- packages/integrations/mdx/README.md | 6 +- .../src/pages/glob.json.js | 2 +- .../mdx-frontmatter/src/pages/glob.json.js | 2 +- .../mdx-get-headings/src/pages/pages.json.js | 2 +- .../mdx-url-export/src/pages/pages.json.js | 2 +- .../src/pages/frontmatter.json.js | 2 +- .../fixtures/node-middleware/src/pages/ssr.ts | 2 +- .../static/src/pages/endpoint.json.ts | 2 +- packages/markdown/remark/src/index.ts | 2 +- packages/markdown/remark/src/types.ts | 1 - 47 files changed, 95 insertions(+), 398 deletions(-) create mode 100644 .changeset/slow-hornets-try.md create mode 100644 .changeset/wicked-sloths-develop.md delete mode 100644 packages/astro/test/astro-markdown-drafts.test.js delete mode 100644 packages/astro/test/fixtures/astro-markdown-drafts/package.json delete mode 100644 packages/astro/test/fixtures/astro-markdown-drafts/src/pages/index.md delete mode 100644 packages/astro/test/fixtures/astro-markdown-drafts/src/pages/wip.md diff --git a/.changeset/slow-hornets-try.md b/.changeset/slow-hornets-try.md new file mode 100644 index 000000000000..970e7f49105b --- /dev/null +++ b/.changeset/slow-hornets-try.md @@ -0,0 +1,5 @@ +--- +'@astrojs/rss': major +--- + +Removes the `drafts` option as the feature is deprecated in Astro 3.0 diff --git a/.changeset/wicked-sloths-develop.md b/.changeset/wicked-sloths-develop.md new file mode 100644 index 000000000000..806e0270728f --- /dev/null +++ b/.changeset/wicked-sloths-develop.md @@ -0,0 +1,11 @@ +--- +'astro': major +--- + +Removes deprecated features from Astro 3.0 + +- Adapters are now required to pass `supportedAstroFeatures` to specify a list of features they support. +- The `build.split` and `build.excludeMiddleware` options are removed. Use `functionPerRoute` and `edgeMiddleware` from adapters instead. +- The `markdown.drafts` option and draft feature is removed. Use content collections instead. +- Lowercase endpoint names are no longer supported. Use uppercase endpoint names instead. +- `getHeaders()` exported from markdown files is removed. Use `getHeadings()` instead. diff --git a/benchmark/packages/timer/src/index.ts b/benchmark/packages/timer/src/index.ts index 49edcb5e86a5..2ea41af6624d 100644 --- a/benchmark/packages/timer/src/index.ts +++ b/benchmark/packages/timer/src/index.ts @@ -6,6 +6,7 @@ export function getAdapter(): AstroAdapter { serverEntrypoint: '@benchmark/timer/server.js', previewEntrypoint: '@benchmark/timer/preview.js', exports: ['handler'], + supportedAstroFeatures: {}, }; } diff --git a/packages/astro-rss/README.md b/packages/astro-rss/README.md index 268f58f26690..c8485b02e3e8 100644 --- a/packages/astro-rss/README.md +++ b/packages/astro-rss/README.md @@ -28,7 +28,7 @@ Start by [adding a `site` to your project's `astro.config` for link generation]( import rss from '@astrojs/rss'; import { getCollection } from 'astro:content'; -export async function get(context) { +export async function GET(context) { const posts = await getCollection('blog'); return rss({ title: 'Buzz’s Blog', @@ -55,7 +55,7 @@ Read **[Astro's RSS docs][astro-rss]** for more on using content collections, an The `rss` default export offers a number of configuration options. Here's a quick reference: ```js -export function get(context) { +export function GET(context) { return rss({ // `` field in output xml title: 'Buzz’s Blog', @@ -98,7 +98,7 @@ The base URL to use when generating RSS item links. We recommend using the [endp ```ts import rss from '@astrojs/rss'; -export const get = (context) => +export const GET = (context) => rss({ site: context.site, // ... @@ -113,14 +113,6 @@ A list of formatted RSS feed items. See [Astro's RSS items documentation](https: When providing a formatted RSS item list, see the [`RSSFeedItem` type reference](#rssfeeditem). -### drafts - -Type: `boolean (optional)` - -**Deprecated**: Manually filter `items` instead. - -Set `drafts: true` to include [draft posts](https://docs.astro.build/en/guides/markdown-content/#draft-pages) in the feed output. By default, this option is `false` and draft posts are not included. - ### stylesheet Type: `string (optional)` @@ -136,7 +128,7 @@ A string of valid XML to be injected between your feed's `<description>` and `<i ```js import rss from '@astrojs/rss'; -export const get = () => rss({ +export const GET = () => rss({ ... customData: '<language>en-us</language>', }); @@ -181,7 +173,7 @@ By default, the library will add trailing slashes to the emitted URLs. To preven ```js import rss from '@astrojs/rss'; -export const get = () => +export const GET = () => rss({ trailingSlash: false, }); @@ -361,7 +353,7 @@ This function assumes, but does not verify, you are globbing for items inside `s // src/pages/rss.xml.js import rss, { pagesGlobToRssItems } from '@astrojs/rss'; -export async function get(context) { +export async function GET(context) { return rss({ title: 'Buzz’s Blog', description: 'A humble Astronaut’s guide to the stars', @@ -379,7 +371,7 @@ As `rss()` returns a `Response`, you can also use `getRssString()` to get the RS // src/pages/rss.xml.js import { getRssString } from '@astrojs/rss'; -export async function get(context) { +export async function GET(context) { const rssString = await getRssString({ title: 'Buzz’s Blog', ... diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts index a611afc1637d..48c5defe855c 100644 --- a/packages/astro-rss/src/index.ts +++ b/packages/astro-rss/src/index.ts @@ -27,11 +27,6 @@ export type RSSOptions = { stylesheet?: z.infer<typeof rssOptionsValidator>['stylesheet']; /** Specify custom data in opening of file */ customData?: z.infer<typeof rssOptionsValidator>['customData']; - /** - * Whether to include drafts or not - * @deprecated Deprecated since version 3.0. Use content collections instead. - */ - drafts?: z.infer<typeof rssOptionsValidator>['drafts']; trailingSlash?: z.infer<typeof rssOptionsValidator>['trailingSlash']; }; @@ -48,11 +43,6 @@ export type RSSFeedItem = { description?: z.infer<typeof rssSchema>['description']; /** Append some other XML-valid data to this item */ customData?: z.infer<typeof rssSchema>['customData']; - /** - * Whether draft or not - * @deprecated Deprecated since version 3.0. Use content collections instead. - */ - draft?: z.infer<typeof rssSchema>['draft']; /** Categories or tags related to the item */ categories?: z.infer<typeof rssSchema>['categories']; /** The item author's email address */ @@ -92,7 +82,6 @@ const rssOptionsValidator = z.object({ return items; }), xmlns: z.record(z.string()).optional(), - drafts: z.boolean().default(false), stylesheet: z.union([z.string(), z.boolean()]).optional(), customData: z.string().optional(), trailingSlash: z.boolean().default(true), @@ -159,10 +148,7 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed /** Generate RSS 2.0 feed */ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> { - const { site } = rssOptions; - const items = rssOptions.drafts - ? rssOptions.items - : rssOptions.items.filter((item) => !item.draft); + const { items, site } = rssOptions; const xmlOptions = { ignoreAttributes: false, diff --git a/packages/astro-rss/src/schema.ts b/packages/astro-rss/src/schema.ts index eb15ecd58409..98aa35f81212 100644 --- a/packages/astro-rss/src/schema.ts +++ b/packages/astro-rss/src/schema.ts @@ -8,7 +8,6 @@ export const rssSchema = z.object({ .refine((value) => !isNaN(value.getTime())), description: z.string().optional(), customData: z.string().optional(), - draft: z.boolean().optional(), categories: z.array(z.string()).optional(), author: z.string().optional(), commentsUrl: z.string().optional(), diff --git a/packages/astro-rss/test/rss.test.js b/packages/astro-rss/test/rss.test.js index 5dfb48b32adf..cc7bff82b2ed 100644 --- a/packages/astro-rss/test/rss.test.js +++ b/packages/astro-rss/test/rss.test.js @@ -156,36 +156,12 @@ describe('getRssString', () => { chai.expect(str).to.contain(customData); }); - it('should filter out entries marked as `draft`', async () => { - const str = await getRssString({ - title, - description, - items: [phpFeedItem, { ...web1FeedItem, draft: true }], - site, - }); - - chai.expect(str).xml.to.equal(validXmlWithoutWeb1FeedResult); - }); - - it('should respect drafts option', async () => { - const str = await getRssString({ - title, - description, - items: [phpFeedItem, { ...web1FeedItem, draft: true }], - site, - drafts: true, - }); - - chai.expect(str).xml.to.equal(validXmlResult); - }); - it('should not append trailing slash to URLs with the given option', async () => { const str = await getRssString({ title, description, - items: [phpFeedItem, { ...web1FeedItem, draft: true }], + items: [phpFeedItem], site, - drafts: true, trailingSlash: false, }); diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts index fe1a23311694..7cec060661eb 100644 --- a/packages/astro/client.d.ts +++ b/packages/astro/client.d.ts @@ -242,8 +242,6 @@ interface ExportedMarkdownModuleEntities { file: MD['file']; url: MD['url']; getHeadings: MD['getHeadings']; - /** @deprecated Renamed to `getHeadings()` */ - getHeaders: () => void; Content: MD['Content']; rawContent: MD['rawContent']; compiledContent: MD['compiledContent']; diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 5531cf9b9dec..a769bcdf48b6 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -143,7 +143,6 @@ export interface CLIFlags { host?: string | boolean; port?: number; config?: string; - drafts?: boolean; open?: boolean; } @@ -886,33 +885,6 @@ export interface AstroUserConfig { * ``` */ inlineStylesheets?: 'always' | 'auto' | 'never'; - - /** - * @docs - * @name build.split - * @type {boolean} - * @default `false` - * @deprecated Deprecated since version 3.0. - * @description - * The build config option `build.split` has been replaced by the adapter configuration option [`functionPerRoute`](/en/reference/adapter-reference/#functionperroute). - * - * Please see your [SSR adapter's documentation](/en/guides/integrations-guide/#official-integrations) for using `functionPerRoute` to define how your SSR code is bundled. - * - */ - split?: boolean; - - /** - * @docs - * @name build.excludeMiddleware - * @type {boolean} - * @default `false` - * @deprecated Deprecated since version 3.0. - * @description - * The build config option `build.excludeMiddleware` has been replaced by the adapter configuration option [`edgeMiddleware`](/en/reference/adapter-reference/#edgemiddleware). - * - * Please see your [SSR adapter's documentation](/en/guides/integrations-guide/#official-integrations) for using `edgeMiddleware` to define whether or not any SSR middleware code will be bundled when built. - */ - excludeMiddleware?: boolean; }; /** @@ -1183,28 +1155,6 @@ export interface AstroUserConfig { * @name Markdown Options */ markdown?: { - /** - * @docs - * @name markdown.drafts - * @type {boolean} - * @default `false` - * @deprecated Deprecated since version 3.0. Use content collections instead. - * @description - * Control whether Markdown draft pages should be included in the build. - * - * A Markdown page is considered a draft if it includes `draft: true` in its frontmatter. Draft pages are always included & visible during development (`astro dev`) but by default they will not be included in your final build. - * - * ```js - * { - * markdown: { - * // Example: Include all drafts in your final build - * drafts: true, - * } - * } - * ``` - */ - drafts?: boolean; - /** * @docs * @name markdown.shikiConfig @@ -1749,10 +1699,6 @@ export interface ComponentInstance { css?: string[]; partial?: boolean; prerender?: boolean; - /** - * Only used for logging if deprecated drafts feature is used - */ - frontmatter?: Record<string, any>; getStaticPaths?: (options: GetStaticPathsOptions) => GetStaticPathsResult; } @@ -2056,7 +2002,7 @@ export interface AstroAdapter { * * If the adapter is not able to handle certain configurations, Astro will throw an error. */ - supportedAstroFeatures?: AstroFeatureMap; + supportedAstroFeatures: AstroFeatureMap; } type Body = string; @@ -2145,7 +2091,7 @@ export interface APIContext< * ]; * } * - * export async function get({ params }) { + * export async function GET({ params }) { * return { * body: `Hello user ${params.id}!`, * } @@ -2168,7 +2114,7 @@ export interface APIContext< * ]; * } * - * export function get({ props }) { + * export function GET({ props }) { * return { * body: `Hello ${props.name}!`, * } @@ -2184,7 +2130,7 @@ export interface APIContext< * Example usage: * ```ts * // src/pages/secret.ts - * export function get({ redirect }) { + * export function GET({ redirect }) { * return redirect('/login'); * } * ``` diff --git a/packages/astro/src/cli/build/index.ts b/packages/astro/src/cli/build/index.ts index 1a7d5aa52048..15ff584317d9 100644 --- a/packages/astro/src/cli/build/index.ts +++ b/packages/astro/src/cli/build/index.ts @@ -14,7 +14,6 @@ export async function build({ flags }: BuildOptions) { usage: '[...flags]', tables: { Flags: [ - ['--drafts', `Include Markdown draft pages in the build.`], ['--outDir <directory>', `Specify the output directory for the build.`], ['--help (-h)', 'See all available flags.'], ], diff --git a/packages/astro/src/cli/flags.ts b/packages/astro/src/cli/flags.ts index c97f1801acf1..c384d98671b8 100644 --- a/packages/astro/src/cli/flags.ts +++ b/packages/astro/src/cli/flags.ts @@ -15,9 +15,6 @@ export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig { site: typeof flags.site === 'string' ? flags.site : undefined, base: typeof flags.base === 'string' ? flags.base : undefined, outDir: typeof flags.outDir === 'string' ? flags.outDir : undefined, - markdown: { - drafts: typeof flags.drafts === 'boolean' ? flags.drafts : undefined, - }, server: { port: typeof flags.port === 'number' ? flags.port : undefined, host: diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 3ffd13b7dd80..4750f2afc89c 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -111,16 +111,6 @@ async function getEntryForFallbackRoute( return RedirectSinglePageBuiltModule; } -function shouldSkipDraft(pageModule: ComponentInstance, settings: AstroSettings): boolean { - return ( - // Drafts are disabled - !settings.config.markdown.drafts && - // This is a draft post - 'frontmatter' in pageModule && - (pageModule as any).frontmatter?.draft === true - ); -} - // Gives back a facadeId that is relative to the root. // ie, src/pages/index.astro instead of /Users/name..../src/pages/index.astro export function rootRelativeFacadeId(facadeId: string, settings: AstroSettings): string { @@ -185,11 +175,7 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn if (pageData.route.prerender) { const ssrEntryURLPage = createEntryURL(filePath, outFolder); const ssrEntryPage = await import(ssrEntryURLPage.toString()); - if ( - // TODO: remove in Astro 4.0 - opts.settings.config.build.split || - opts.settings.adapter?.adapterFeatures?.functionPerRoute - ) { + if (opts.settings.adapter?.adapterFeatures?.functionPerRoute) { // forcing to use undefined, so we fail in an expected way if the module is not even there. const ssrEntry = ssrEntryPage?.pageModule; if (ssrEntry) { @@ -244,10 +230,7 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn await queue.onIdle(); const assetsTimeEnd = performance.now(); - logger.info( - null, - green(`✓ Completed in ${getTimeStat(assetsTimer, assetsTimeEnd)}.\n`) - ); + logger.info(null, green(`✓ Completed in ${getTimeStat(assetsTimer, assetsTimeEnd)}.\n`)); delete globalThis?.astroAsset?.addStaticImage; } @@ -302,16 +285,6 @@ async function generatePage( ); } const pageModule = await pageModulePromise(); - // TODO: Remove in Astro 4.0 - if (shouldSkipDraft(pageModule, pipeline.getSettings())) { - logger.info(null, `${magenta('⚠️')} Skipping draft ${pageData.route.component}`); - logger.warn( - null, - `The drafts feature is deprecated. You should migrate to content collections instead. See https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries for more information.` - ); - return; - } - const generationOptions: Readonly<GeneratePathOptions> = { pageData, linkIds, @@ -390,13 +363,13 @@ async function getPathsForRoute( throw err; }); - const label = staticPaths.length === 1 ? 'page' : 'pages'; - logger.debug( - 'build', - `├── ${bold(green('✔'))} ${route.component} → ${magenta( - `[${staticPaths.length} ${label}]` - )}` - ); + const label = staticPaths.length === 1 ? 'page' : 'pages'; + logger.debug( + 'build', + `├── ${bold(green('✔'))} ${route.component} → ${magenta( + `[${staticPaths.length} ${label}]` + )}` + ); paths.push( ...staticPaths diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 19f263a017a6..0245e50c2ff1 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -161,7 +161,7 @@ class AstroBuilder { this.logger.info('build', `output: ${blue('"' + this.settings.config.output + '"')}`); this.logger.info('build', `directory: ${blue(fileURLToPath(this.settings.config.outDir))}`); if (this.settings.adapter) { - this.logger.info('build', `adapter: ${green(this.settings.adapter.name)}`); + this.logger.info('build', `adapter: ${green(this.settings.adapter.name)}`); } this.logger.info('build', 'Collecting build info...'); this.timer.loadStart = performance.now(); @@ -253,32 +253,6 @@ class AstroBuilder { `the outDir cannot be the root folder. Please build to a folder such as dist.` ); } - - // TODO: Remove in Astro 4.0 - if (config.build.split === true) { - if (config.output === 'static') { - this.logger.warn( - 'config', - 'The option `build.split` won\'t take effect, because `output` is not `"server"` or `"hybrid"`.' - ); - } - this.logger.warn( - 'deprecated', - 'The option `build.split` is deprecated. Use the adapter options.' - ); - } - if (config.build.excludeMiddleware === true) { - if (config.output === 'static') { - this.logger.warn( - 'config', - 'The option `build.excludeMiddleware` won\'t take effect, because `output` is not `"server"` or `"hybrid"`.' - ); - } - this.logger.warn( - 'deprecated', - 'The option `build.excludeMiddleware` is deprecated. Use the adapter options.' - ); - } } /** Stats */ diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts index 83065ecacbe4..0ac0db028823 100644 --- a/packages/astro/src/core/build/plugins/plugin-manifest.ts +++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts @@ -98,8 +98,6 @@ export function pluginManifest( const manifest = await createManifest(options, internals); const shouldPassMiddlewareEntryPoint = - // TODO: remove in Astro 4.0 - options.settings.config.build.excludeMiddleware || options.settings.adapter?.adapterFeatures?.edgeMiddleware; await runHookBuildSsr({ config: options.settings.config, diff --git a/packages/astro/src/core/build/plugins/plugin-pages.ts b/packages/astro/src/core/build/plugins/plugin-pages.ts index 2a348f18fece..fee94071ee25 100644 --- a/packages/astro/src/core/build/plugins/plugin-pages.ts +++ b/packages/astro/src/core/build/plugins/plugin-pages.ts @@ -92,10 +92,6 @@ function vitePluginPages(opts: StaticBuildOptions, internals: BuildInternals): V } export function shouldBundleMiddleware(settings: AstroSettings) { - // TODO: Remove in Astro 4.0 - if (settings.config.build.excludeMiddleware === true) { - return false; - } if (settings.adapter?.adapterFeatures?.edgeMiddleware === true) { return false; } diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index fd892c9b63c7..6a6dd224af4f 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -102,10 +102,7 @@ export function pluginSSR( hooks: { 'build:before': () => { let vitePlugin = - ssr && - // TODO: Remove in Astro 4.0 - options.settings.config.build.split === false && - functionPerRouteEnabled === false + ssr && functionPerRouteEnabled === false ? vitePluginSSR(internals, options.settings.adapter!, options) : undefined; @@ -119,7 +116,7 @@ export function pluginSSR( return; } - if (options.settings.config.build.split || functionPerRouteEnabled) { + if (functionPerRouteEnabled) { return; } @@ -146,7 +143,7 @@ function vitePluginSSRSplit( name: '@astrojs/vite-plugin-astro-ssr-split', enforce: 'post', options(opts) { - if (options.settings.config.build.split || functionPerRouteEnabled) { + if (functionPerRouteEnabled) { const inputs = new Set<string>(); for (const [path, pageData] of eachPageFromAllPages(options.allPages)) { @@ -223,7 +220,7 @@ export function pluginSSRSplit( hooks: { 'build:before': () => { let vitePlugin = - ssr && (options.settings.config.build.split || functionPerRouteEnabled) + ssr && functionPerRouteEnabled ? vitePluginSSRSplit(internals, options.settings.adapter!, options) : undefined; @@ -240,7 +237,7 @@ function generateSSRCode(config: AstroConfig, adapter: AstroAdapter) { const imports: string[] = []; const contents: string[] = []; let pageMap; - if (config.build.split || isFunctionPerRouteEnabled(adapter)) { + if (isFunctionPerRouteEnabled(adapter)) { pageMap = 'pageModule'; } else { pageMap = 'pageMap'; diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index 53acb6924fcb..82bb872b1593 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -67,7 +67,6 @@ export function resolveFlags(flags: Partial<Flags>): CLIFlags { config: typeof flags.config === 'string' ? flags.config : undefined, host: typeof flags.host === 'string' || typeof flags.host === 'boolean' ? flags.host : undefined, - drafts: typeof flags.drafts === 'boolean' ? flags.drafts : undefined, }; } diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index eaa11786a5c9..4ef77b5326c8 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -38,8 +38,6 @@ const ASTRO_CONFIG_DEFAULTS = { serverEntry: 'entry.mjs', redirects: true, inlineStylesheets: 'auto', - split: false, - excludeMiddleware: false, }, image: { service: { entrypoint: 'astro/assets/services/sharp', config: {} }, @@ -51,10 +49,7 @@ const ASTRO_CONFIG_DEFAULTS = { open: false, }, integrations: [], - markdown: { - drafts: false, - ...markdownConfigDefaults, - }, + markdown: markdownConfigDefaults, vite: {}, legacy: {}, redirects: {}, @@ -139,20 +134,6 @@ export const AstroConfigSchema = z.object({ .enum(['always', 'auto', 'never']) .optional() .default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets), - - /** - * @deprecated - * Use the adapter feature instead - */ - split: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.split), - /** - * @deprecated - * Use the adapter feature instead - */ - excludeMiddleware: z - .boolean() - .optional() - .default(ASTRO_CONFIG_DEFAULTS.build.excludeMiddleware), }) .default({}), server: z.preprocess( @@ -245,7 +226,6 @@ export const AstroConfigSchema = z.object({ .default(ASTRO_CONFIG_DEFAULTS.image), markdown: z .object({ - drafts: z.boolean().default(false), syntaxHighlight: z .union([z.literal('shiki'), z.literal('prism'), z.literal(false)]) .default(ASTRO_CONFIG_DEFAULTS.markdown.syntaxHighlight), @@ -452,12 +432,6 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: string) { .enum(['always', 'auto', 'never']) .optional() .default(ASTRO_CONFIG_DEFAULTS.build.inlineStylesheets), - - split: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.split), - excludeMiddleware: z - .boolean() - .optional() - .default(ASTRO_CONFIG_DEFAULTS.build.excludeMiddleware), }) .optional() .default({}), diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index 5b120bb07420..c73306de06ba 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -64,14 +64,6 @@ export async function renderPage({ mod, renderContext, env, cookies }: RenderPag routingStrategy: renderContext.routingStrategy, }); - // TODO: Remove in Astro 4.0 - if (mod.frontmatter && typeof mod.frontmatter === 'object' && 'draft' in mod.frontmatter) { - env.logger.warn( - null, - `The drafts feature is deprecated and used in ${renderContext.route.component}. You should migrate to content collections instead. See https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries for more information.` - ); - } - const response = await runtimeRenderPage( result, Component, diff --git a/packages/astro/src/integrations/astroFeaturesValidation.ts b/packages/astro/src/integrations/astroFeaturesValidation.ts index d9049f8765bf..4c6b1131b328 100644 --- a/packages/astro/src/integrations/astroFeaturesValidation.ts +++ b/packages/astro/src/integrations/astroFeaturesValidation.ts @@ -17,17 +17,6 @@ const UNSUPPORTED_ASSETS_FEATURE: AstroAssetsFeature = { isSharpCompatible: false, }; -// NOTE: remove for Astro 4.0 -const ALL_UNSUPPORTED: Required<AstroFeatureMap> = { - serverOutput: UNSUPPORTED, - staticOutput: UNSUPPORTED, - hybridOutput: UNSUPPORTED, - assets: UNSUPPORTED_ASSETS_FEATURE, - i18n: { - detectBrowserLanguage: UNSUPPORTED, - }, -}; - type ValidationResult = { [Property in keyof AstroFeatureMap]: boolean; }; @@ -41,7 +30,7 @@ type ValidationResult = { */ export function validateSupportedFeatures( adapterName: string, - featureMap: AstroFeatureMap = ALL_UNSUPPORTED, + featureMap: AstroFeatureMap, config: AstroConfig, logger: Logger ): ValidationResult { @@ -105,18 +94,21 @@ function validateSupportKind( } function featureIsUnsupported(adapterName: string, logger: Logger, featureName: string) { - logger.error( - 'config', - `The feature ${featureName} is not supported (used by ${adapterName}).` - ); + logger.error('config', `The feature ${featureName} is not supported (used by ${adapterName}).`); } function featureIsExperimental(adapterName: string, logger: Logger) { - logger.warn('config', `The feature is experimental and subject to change (used by ${adapterName}).`); + logger.warn( + 'config', + `The feature is experimental and subject to change (used by ${adapterName}).` + ); } function featureIsDeprecated(adapterName: string, logger: Logger) { - logger.warn('config', `The feature is deprecated and will be removed in the future (used by ${adapterName}).`); + logger.warn( + 'config', + `The feature is deprecated and will be removed in the future (used by ${adapterName}).` + ); } const SHARP_SERVICE = 'astro/assets/services/sharp'; diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 66c451ee8dd2..f21fd088b67c 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -244,10 +244,8 @@ export async function runHookConfigDone({ ); } if (!adapter.supportedAstroFeatures) { - // NOTE: throw an error in Astro 4.0 - logger.warn( - null, - `The adapter ${adapter.name} doesn't provide a feature map. From Astro 3.0, an adapter can provide a feature map. Not providing a feature map will cause an error in Astro 4.0.` + throw new Error( + `The adapter ${adapter.name} doesn't provide a feature map. It is required in Astro 4.0.` ); } else { const validationResult = validateSupportedFeatures( diff --git a/packages/astro/src/runtime/server/endpoint.ts b/packages/astro/src/runtime/server/endpoint.ts index df415ca67a47..f8fc1c071c78 100644 --- a/packages/astro/src/runtime/server/endpoint.ts +++ b/packages/astro/src/runtime/server/endpoint.ts @@ -2,35 +2,11 @@ import { bold } from 'kleur/colors'; import type { APIContext, EndpointHandler, Params } from '../../@types/astro.js'; import type { Logger } from '../../core/logger/core.js'; -function getHandlerFromModule(mod: EndpointHandler, method: string, logger: Logger) { - const lowerCaseMethod = method.toLowerCase(); - - // TODO: remove in Astro 4.0 - if (mod[lowerCaseMethod]) { - logger.warn( - null, - `Lower case endpoint names are deprecated and will not be supported in Astro 4.0. Rename the endpoint ${lowerCaseMethod} to ${method}.` - ); - } +function getHandlerFromModule(mod: EndpointHandler, method: string) { // If there was an exact match on `method`, return that function. if (mod[method]) { return mod[method]; } - - // TODO: remove in Astro 4.0 - if (mod[lowerCaseMethod]) { - return mod[lowerCaseMethod]; - } - // TODO: remove in Astro 4.0 - // Handle `del` instead of `delete`, since `delete` is a reserved word in JS. - if (method === 'delete' && mod['del']) { - return mod['del']; - } - // TODO: remove in Astro 4.0 - // If a single `all` handler was used, return that function. - if (mod['all']) { - return mod['all']; - } if (mod['ALL']) { return mod['ALL']; } @@ -48,9 +24,8 @@ export async function renderEndpoint( const { request, url } = context; const chosenMethod = request.method?.toUpperCase(); - const handler = getHandlerFromModule(mod, chosenMethod, logger); - // TODO: remove the 'get' check in Astro 4.0 - if (!ssr && ssr === false && chosenMethod && chosenMethod !== 'GET' && chosenMethod !== 'get') { + const handler = getHandlerFromModule(mod, chosenMethod); + if (!ssr && ssr === false && chosenMethod && chosenMethod !== 'GET') { logger.warn( null, `${url.pathname} ${bold( diff --git a/packages/astro/test/astro-markdown-drafts.test.js b/packages/astro/test/astro-markdown-drafts.test.js deleted file mode 100644 index 8f6c753e4c5f..000000000000 --- a/packages/astro/test/astro-markdown-drafts.test.js +++ /dev/null @@ -1,44 +0,0 @@ -import { expect } from 'chai'; -import * as cheerio from 'cheerio'; -import { loadFixture } from './test-utils.js'; - -describe('Astro Markdown with draft posts disabled', () => { - let fixture; - - before(async () => { - fixture = await loadFixture({ - root: './fixtures/astro-markdown-drafts/', - }); - await fixture.build(); - }); - it('Does not render the draft post', async () => { - let renderedDraft = false; - try { - await fixture.readFile('/wip/index.html'); - renderedDraft = true; - } catch (err) { - expect(err.code).to.equal('ENOENT'); - } - expect(renderedDraft).to.equal(false, 'Rendered a draft post'); - }); -}); - -describe('Astro Markdown with draft posts enabled', () => { - let fixture; - - before(async () => { - fixture = await loadFixture({ - root: './fixtures/astro-markdown-drafts/', - markdown: { - drafts: true, - }, - }); - await fixture.build(); - }); - it('Renders the draft post', async () => { - const html = await fixture.readFile('/wip/index.html'); - const $ = cheerio.load(html); - expect($('h1').length).to.be.ok; - expect($('h1').text()).to.equal('WIP'); - }); -}); diff --git a/packages/astro/test/events.test.js b/packages/astro/test/events.test.js index b0732a15c61b..c0c6266d9f1e 100644 --- a/packages/astro/test/events.test.js +++ b/packages/astro/test/events.test.js @@ -105,7 +105,6 @@ describe('Events', () => { config: 'path/to/config.mjs', experimentalSsr: true, experimentalIntegrations: true, - drafts: true, }; const [{ payload }] = events.eventCliSession( { @@ -122,7 +121,6 @@ describe('Events', () => { 'config', 'experimentalSsr', 'experimentalIntegrations', - 'drafts', ]); }); }); diff --git a/packages/astro/test/featuresSupport.test.js b/packages/astro/test/featuresSupport.test.js index c25d9d5f8f08..15606b927c1d 100644 --- a/packages/astro/test/featuresSupport.test.js +++ b/packages/astro/test/featuresSupport.test.js @@ -10,14 +10,9 @@ describe('Adapter', () => { fixture = await loadFixture({ root: './fixtures/middleware space/', output: 'server', - build: { - excludeMiddleware: true, - }, adapter: testAdapter({ extendAdapter: { - supportsFeatures: { - edgeMiddleware: 'Unsupported', - }, + supportedAstroFeatures: {}, }, }), }); @@ -34,14 +29,9 @@ describe('Adapter', () => { fixture = await loadFixture({ root: './fixtures/middleware space/', output: 'server', - build: { - split: true, - }, adapter: testAdapter({ extendAdapter: { - supportsFeatures: { - functionPerPage: 'Unsupported', - }, + supportedAstroFeatures: {}, }, }), }); diff --git a/packages/astro/test/fixtures/astro-markdown-drafts/package.json b/packages/astro/test/fixtures/astro-markdown-drafts/package.json deleted file mode 100644 index fa376d6f134f..000000000000 --- a/packages/astro/test/fixtures/astro-markdown-drafts/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "@test/astro-markdown-drafts", - "version": "0.0.0", - "private": true, - "dependencies": { - "astro": "workspace:*" - } -} diff --git a/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/index.md b/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/index.md deleted file mode 100644 index 0e06444da3cc..000000000000 --- a/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -foo: bar ---- - -# Hello world - -This should be visible. \ No newline at end of file diff --git a/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/wip.md b/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/wip.md deleted file mode 100644 index 27b8296140d7..000000000000 --- a/packages/astro/test/fixtures/astro-markdown-drafts/src/pages/wip.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -foo: bar -draft: true ---- - -# WIP - -This is a draft. Don't build me! \ No newline at end of file diff --git a/packages/astro/test/fixtures/astro-markdown/src/pages/vite-env-vars.md b/packages/astro/test/fixtures/astro-markdown/src/pages/vite-env-vars.md index f4983af2c75b..5fac52727244 100644 --- a/packages/astro/test/fixtures/astro-markdown/src/pages/vite-env-vars.md +++ b/packages/astro/test/fixtures/astro-markdown/src/pages/vite-env-vars.md @@ -21,7 +21,7 @@ This should also work outside of code blocks: // src/pages/rss.xml.js import rss from '@astrojs/rss'; -export const get = () => rss({ +export const GET = () => rss({ // Use Vite env vars with import.meta.env site: import.meta.env.SITE, title: import.meta.env.TITLE, diff --git a/packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js b/packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js index 796bf4616be3..b5f1b013617e 100644 --- a/packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js +++ b/packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js @@ -4,7 +4,7 @@ export function GET() { return new Response('ok') } -export async function post({ request }) { +export async function POST({ request }) { const data = await request.formData(); const file = data.get('file'); diff --git a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/invalid-redirect.json.ts b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/invalid-redirect.json.ts index b1b48634f145..9e8e40580ea8 100644 --- a/packages/astro/test/fixtures/with-endpoint-routes/src/pages/invalid-redirect.json.ts +++ b/packages/astro/test/fixtures/with-endpoint-routes/src/pages/invalid-redirect.json.ts @@ -1,4 +1,4 @@ -export const get = () => { +export const GET = () => { return new Response( undefined, { diff --git a/packages/astro/test/middleware.test.js b/packages/astro/test/middleware.test.js index 8332dfe41949..5b033ca4dc02 100644 --- a/packages/astro/test/middleware.test.js +++ b/packages/astro/test/middleware.test.js @@ -277,6 +277,11 @@ describe('Middleware API in PROD mode, SSR', () => { excludeMiddleware: true, }, adapter: testAdapter({ + extendAdapter: { + adapterFeatures: { + edgeMiddleware: true, + }, + }, setMiddlewareEntryPoint(entryPointsOrMiddleware) { middlewarePath = entryPointsOrMiddleware; }, @@ -317,7 +322,9 @@ describe('Middleware with tailwind', () => { }); }); -describe('Middleware, split middleware option', () => { +// `loadTestAdapterApp()` does not understand how to load the page with `functionPerRoute` +// since there's no `entry.mjs`. Skip for now. +describe.skip('Middleware supports functionPerRoute feature', () => { /** @type {import('./test-utils').Fixture} */ let fixture; @@ -325,10 +332,13 @@ describe('Middleware, split middleware option', () => { fixture = await loadFixture({ root: './fixtures/middleware space/', output: 'server', - build: { - excludeMiddleware: true, - }, - adapter: testAdapter({}), + adapter: testAdapter({ + extendAdapter: { + adapterFeatures: { + functionPerRoute: true, + }, + }, + }), }); await fixture.build(); }); diff --git a/packages/astro/test/ssr-adapter-build-config.test.js b/packages/astro/test/ssr-adapter-build-config.test.js index d739cee3cd09..5d2221c31298 100644 --- a/packages/astro/test/ssr-adapter-build-config.test.js +++ b/packages/astro/test/ssr-adapter-build-config.test.js @@ -47,6 +47,7 @@ describe('Integration buildConfig hook', () => { name: 'my-ssr-adapter', serverEntrypoint: '@my-ssr', exports: ['manifest', 'createApp'], + supportedAstroFeatures: {}, }); }, }, diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js index 0090b6d9da92..0a30583b22e7 100644 --- a/packages/astro/test/test-adapter.js +++ b/packages/astro/test/test-adapter.js @@ -77,15 +77,7 @@ export default function ( name: 'my-ssr-adapter', serverEntrypoint: '@my-ssr', exports: ['manifest', 'createApp'], - supportedFeatures: { - assets: { - supportKind: 'Stable', - isNodeCompatible: true, - }, - serverOutput: 'Stable', - staticOutput: 'Stable', - hybridOutput: 'Stable', - }, + supportedAstroFeatures: {}, ...extendAdapter, }); }, diff --git a/packages/astro/test/units/integrations/api.test.js b/packages/astro/test/units/integrations/api.test.js index a4a76975a341..8960e662dcb9 100644 --- a/packages/astro/test/units/integrations/api.test.js +++ b/packages/astro/test/units/integrations/api.test.js @@ -106,7 +106,7 @@ describe('Astro feature map', function () { it('should not support the feature when not provided', () => { let result = validateSupportedFeatures( 'test', - undefined, + {}, { output: 'hybrid', }, diff --git a/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/collection.json.js b/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/collection.json.js index 98ae36a58247..6f389f0a7235 100644 --- a/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/collection.json.js +++ b/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/collection.json.js @@ -2,7 +2,7 @@ import { getCollection } from 'astro:content'; import { stringify } from 'devalue'; import { stripAllRenderFn } from '../../utils.js'; -export async function get() { +export async function GET() { const posts = await getCollection('blog'); return { body: stringify(stripAllRenderFn(posts)) diff --git a/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/entry.json.js b/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/entry.json.js index 7899a757a929..aa24117ab88d 100644 --- a/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/entry.json.js +++ b/packages/integrations/markdoc/test/fixtures/content-collections/src/pages/entry.json.js @@ -2,7 +2,7 @@ import { getEntryBySlug } from 'astro:content'; import { stringify } from 'devalue'; import { stripRenderFn } from '../../utils.js'; -export async function get() { +export async function GET() { const post = await getEntryBySlug('blog', 'post-1'); return { body: stringify(stripRenderFn(post)), diff --git a/packages/integrations/mdx/README.md b/packages/integrations/mdx/README.md index df0458ce9e27..150ada5e8da3 100644 --- a/packages/integrations/mdx/README.md +++ b/packages/integrations/mdx/README.md @@ -83,11 +83,7 @@ You can configure how your MDX is rendered with the following options: ### Options inherited from Markdown config -All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options) except `drafts` can be configured separately in the MDX integration. This includes remark and rehype plugins, syntax highlighting, and more. Options will default to those in your Markdown config ([see the `extendMarkdownConfig` option](#extendmarkdownconfig) to modify this). - -:::note -There is no separate MDX configuration for [including pages marked as draft in the build](https://docs.astro.build/en/reference/configuration-reference/#markdowndrafts). This Markdown setting will be respected by both Markdown and MDX files and cannot be overridden for MDX files specifically. -::: +All [`markdown` configuration options](https://docs.astro.build/en/reference/configuration-reference/#markdown-options) can be configured separately in the MDX integration. This includes remark and rehype plugins, syntax highlighting, and more. Options will default to those in your Markdown config ([see the `extendMarkdownConfig` option](#extendmarkdownconfig) to modify this). ```js // astro.config.mjs diff --git a/packages/integrations/mdx/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js b/packages/integrations/mdx/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js index b73cd234d75d..3423bc634446 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js +++ b/packages/integrations/mdx/test/fixtures/mdx-frontmatter-injection/src/pages/glob.json.js @@ -1,4 +1,4 @@ -export async function get() { +export async function GET() { const docs = await import.meta.glob('./*.mdx', { eager: true }); return { body: JSON.stringify(Object.values(docs).map(doc => doc.frontmatter)), diff --git a/packages/integrations/mdx/test/fixtures/mdx-frontmatter/src/pages/glob.json.js b/packages/integrations/mdx/test/fixtures/mdx-frontmatter/src/pages/glob.json.js index a1d6a4ac42dd..9a10127b7606 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-frontmatter/src/pages/glob.json.js +++ b/packages/integrations/mdx/test/fixtures/mdx-frontmatter/src/pages/glob.json.js @@ -1,4 +1,4 @@ -export async function get() { +export async function GET() { const mdxPages = await import.meta.glob('./*.mdx', { eager: true }); return { diff --git a/packages/integrations/mdx/test/fixtures/mdx-get-headings/src/pages/pages.json.js b/packages/integrations/mdx/test/fixtures/mdx-get-headings/src/pages/pages.json.js index 940e5c141c38..de65e50e0b90 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-get-headings/src/pages/pages.json.js +++ b/packages/integrations/mdx/test/fixtures/mdx-get-headings/src/pages/pages.json.js @@ -1,4 +1,4 @@ -export async function get() { +export async function GET() { const mdxPages = await import.meta.glob('./*.mdx', { eager: true }); return { diff --git a/packages/integrations/mdx/test/fixtures/mdx-url-export/src/pages/pages.json.js b/packages/integrations/mdx/test/fixtures/mdx-url-export/src/pages/pages.json.js index 36b6f7af69aa..93bf31be29d7 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-url-export/src/pages/pages.json.js +++ b/packages/integrations/mdx/test/fixtures/mdx-url-export/src/pages/pages.json.js @@ -1,4 +1,4 @@ -export async function get() { +export async function GET() { const mdxPages = await import.meta.glob('./*.mdx', { eager: true }); return { diff --git a/packages/integrations/mdx/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js b/packages/integrations/mdx/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js index ce3cf81e5cf8..91654c3923f3 100644 --- a/packages/integrations/mdx/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js +++ b/packages/integrations/mdx/test/fixtures/mdx-vite-env-vars/src/pages/frontmatter.json.js @@ -1,6 +1,6 @@ import { frontmatter } from './vite-env-vars.mdx'; -export function get() { +export function GET() { return { body: JSON.stringify(frontmatter), } diff --git a/packages/integrations/node/test/fixtures/node-middleware/src/pages/ssr.ts b/packages/integrations/node/test/fixtures/node-middleware/src/pages/ssr.ts index 93543190f1e2..67f32eafae14 100644 --- a/packages/integrations/node/test/fixtures/node-middleware/src/pages/ssr.ts +++ b/packages/integrations/node/test/fixtures/node-middleware/src/pages/ssr.ts @@ -1,4 +1,4 @@ -export async function get() { +export async function GET() { let number = Math.random(); return { body: JSON.stringify({ diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts index 8f9fa2c90c10..4b848f3398d3 100644 --- a/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts @@ -1,4 +1,4 @@ -export async function get({}) { +export async function GET({}) { return { body: JSON.stringify({ name: 'Astro', diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index bf70a368d274..14301584793c 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -29,7 +29,7 @@ export { remarkShiki } from './remark-shiki.js'; export { createShikiHighlighter, replaceCssVariables, type ShikiHighlighter } from './shiki.js'; export * from './types.js'; -export const markdownConfigDefaults: Omit<Required<AstroMarkdownOptions>, 'drafts'> = { +export const markdownConfigDefaults: Required<AstroMarkdownOptions> = { syntaxHighlight: 'shiki', shikiConfig: { langs: [], diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts index b25e9227130e..ab5af8ed134b 100644 --- a/packages/markdown/remark/src/types.ts +++ b/packages/markdown/remark/src/types.ts @@ -40,7 +40,6 @@ export interface ShikiConfig { } export interface AstroMarkdownOptions { - drafts?: boolean; syntaxHighlight?: 'shiki' | 'prism' | false; shikiConfig?: ShikiConfig; remarkPlugins?: RemarkPlugins;