Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 27 additions & 71 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { sitemap } from './integrations/sitemap';
import rehypeSlug from 'rehype-slug';
import remarkSmartypants from 'remark-smartypants';
import starlight from '@astrojs/starlight';
import tailwind from '@astrojs/tailwind';
import json5Plugin from 'vite-plugin-json5';
import { unified } from '@astrojs/markdown-remark';
import { builtinModules } from 'module';

/* https://vercel.com/docs/projects/environment-variables/system-environment-variables#system-environment-variables */
Expand All @@ -33,31 +32,28 @@ export default defineConfig({
starlight({
title: 'Docs',

customCss: ['./src/styles/custom.css', './src/styles/tailwind.css'],
customCss: ['./src/styles/custom.css', './src/styles/theme.css'],
components: {
EditLink: './src/components/starlight/EditLink.astro',
Head: './src/components/starlight/Head.astro',
Hero: './src/components/starlight/Hero.astro',
MarkdownContent: './src/components/starlight/MarkdownContent.astro',
MobileTableOfContents: './src/components/starlight/MobileTableOfContents.astro',
TableOfContents: './src/components/starlight/TableOfContents.astro',
PageSidebar: './src/components/starlight/PageSidebar.astro',
Pagination: './src/components/starlight/Pagination.astro',
SiteTitle: './src/components/starlight/SiteTitle.astro',
Search: './src/components/starlight/Search.astro',
Sidebar: './src/components/starlight/Sidebar.astro',
PageTitle: './src/components/starlight/PageTitle.astro',
},
routeMiddleware: './src/routeData.ts',
markdown: {
headingLinks: false,
},
editLink: {
baseUrl: 'https://github.com/prosopo/docs/edit/main',
},
defaultLocale: 'en',
locales: makeLocalesConfig(),
sidebar: makeSidebar(),
social: {
github: 'https://github.com/prosopo/captcha',
discord: 'https://discord.gg/dwQx2w9Tgm',
},
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/prosopo/captcha' },
{ icon: 'discord', label: 'Discord', href: 'https://discord.gg/dwQx2w9Tgm' },
],
pagefind: false,
head: [
// Add ICO favicon fallback for Safari.
Expand All @@ -71,81 +67,41 @@ export default defineConfig({
},
],
}),
tailwind({
// Disable the default base styles:
applyBaseStyles: false,
configFiles: ['./tailwind.config.mjs'],
}),
sitemap(),

],
trailingSlash: 'always',
scopedStyleStrategy: 'where',
compressHTML: false,
markdown: {
// Override with our own config
smartypants: false,
remarkPlugins: [
[remarkSmartypants, { dashes: false }],
// Add our custom plugin that marks links to fallback language pages
remarkFallbackLang(),
],
rehypePlugins: [
rehypeSlug,
// This adds links to headings
...rehypeAutolink(),
// Tweak GFM task list syntax
rehypeTasklistEnhancer(),
],
processor: unified({
// Override with our own config
smartypants: false,
remarkPlugins: [
[remarkSmartypants, { dashes: false }],
// Add our custom plugin that marks links to fallback language pages
remarkFallbackLang(),
],
rehypePlugins: [
rehypeSlug,
// This adds links to headings
...rehypeAutolink(),
// Tweak GFM task list syntax
rehypeTasklistEnhancer(),
],
}),
},
image: {
domains: ['avatars.githubusercontent.com'],
service: sharpImageService(),
},
experimental: {
contentCollectionCache: false,
directRenderScript: true,
},
vite: {
plugins: [
json5Plugin(),
{
name: 'raw-jsonc-loader',
transform(code, id) {
// Handle .jsonc files (with or without ?raw suffix)
if (id.includes('.jsonc')) {
const json = JSON.stringify(code)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
return {
code: `export default ${json}`,
map: null
};
}
return null;
}
}
],
optimizeDeps: {
esbuildOptions: {
loader: {
'.jsonc': 'text',
},
},
},
ssr: {
noExternal: ['@astrojs/starlight'],
esbuild: {
options: {
loader: {
'.jsonc': 'text',
},
},
},
},
build: {
modulePreload: { polyfill: true },
rollupOptions: {
rolldownOptions: {
external: [
'fsevents',
...allExternal
Expand Down
Loading
Loading