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

import tailwindcss from "@tailwindcss/vite";

import icon from "astro-icon";

import mdx from "@astrojs/mdx";

import sitemap from "@astrojs/sitemap";

import robotsTxt from "astro-robots-txt";

import { transformerMetaHighlight } from "@shikijs/transformers";

import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
  vite: {
    plugins: [tailwindcss()],
    resolve: {
      alias: {
        "@": path.resolve("./src"),
        "@layouts": path.resolve("./src/layouts"),
        "@components": path.resolve("./src/components"),
        "@assets": path.resolve("./src/assets"),
        "@lib": path.resolve("./src/lib"),
        "@data": path.resolve("./src/data")
      }
    }
  },

  integrations: [icon(), mdx(), sitemap(), robotsTxt()],

  markdown: {
    shikiConfig: {
      transformers: [
        transformerMetaHighlight(),
        {
          pre(hast) {
            hast.properties["data-meta"] = this.options.meta?.__raw;
            hast.properties["data-code"] = this.source;
          }
        }
      ],
      themes: {
        light: "github-light",
        dark: "github-dark"
      }
    }
  },

  site: "https://www.nathancummins.com.au",
  trailingSlash: "always",

  image: {
    responsiveStyles: false
  },

  output: "static",

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