// @ts-check
import { defineConfig } from 'astro/config';

import react from '@astrojs/react';
import tailwind from '@astrojs/tailwind';
import mdx from '@astrojs/mdx';
import m2dx from 'astro-m2dx';

import rehypeSlug from 'rehype-slug';
import rehypeMdxCodeProps from 'rehype-mdx-code-props';

import icon from 'astro-icon';

import node from '@astrojs/node';

/** @type {import('astro-m2dx').Options} */
const m2dxOptions = {
  frontmatter: true,
  exportComponents: true,
};

// https://astro.build/config
export default defineConfig({
  site: "https://eleboog.com",

  vite: {
    ssr: {
      external: ['prismjs'],
    },
  },

  redirects: {
    '/about': '/me',
    '/slashes': '/me',
    '/why': '/me#why',
    '/uses': '/me#everyday',
    '/carry': '/me#everyday',
    '/tip': '/me#tip',
    '/contact': '/me#contact',
    '/verify': '/me#contact',
    '/colophon': '/me#colophon',
    '/now': '/journal#now',
    '/links': '/sharefeed',
    '/ideas': '/me#ideas',
    '/feed.xml': '/feeds/feed.xml',
    '/feeds': '/feeds/feed.xml',
  },

  integrations: [react(), tailwind(), mdx({
    syntaxHighlight: false,
    remarkPlugins: [[m2dx, m2dxOptions]],
    rehypePlugins: [rehypeSlug, [rehypeMdxCodeProps, {tagName: 'code'}]],
  }), icon()],

  output: 'server',

  adapter: node({
    mode: 'standalone'
  })
});