// @ts-check import { defineConfig } from 'astro/config'; import starlight from '@astrojs/starlight'; import sitemap from '@astrojs/sitemap'; import node from '@astrojs/node'; import AstroPWA from '@vite-pwa/astro'; export default defineConfig({ site: 'https://nibiru-framework.com', output: 'server', adapter: node({ mode: 'standalone' }), // Disable Astro's dev-mode floating toolbar — it's the small dark bar with // component-inspect controls. Useful for Astro debugging, not needed for // reviewing the design. devToolbar: { enabled: false }, redirects: { '/': '/en/', // Bing/Yandex/IndexNow probe /sitemap.xml directly. Astro's sitemap // integration emits sitemap-index.xml + sitemap-0.xml; add a 301 so // either path resolves. Both are also referenced in robots.txt. '/sitemap.xml': '/sitemap-index.xml', }, integrations: [ AstroPWA({ registerType: 'autoUpdate', includeAssets: [ 'favicon.svg', 'img/nibiru-logo.png', 'img/lifecycle.svg', ], manifest: { name: 'Nibiru — Modular MMVC PHP Framework', short_name: 'Nibiru', description: 'A modular MMVC PHP framework for builders who ship. First-class AI, the Atelier × Cosmos design system, on-brand docs.', start_url: '/en/', scope: '/', display: 'standalone', orientation: 'portrait-primary', background_color: '#fdf6df', theme_color: '#7c7bb8', lang: 'en', categories: ['developer-tools', 'productivity', 'education'], icons: [ { src: '/img/pwa-192.png', sizes: '192x192', type: 'image/png' }, { src: '/img/pwa-512.png', sizes: '512x512', type: 'image/png' }, { src: '/img/pwa-512-maskable.png', sizes: '512x512', type: 'image/png', purpose: 'maskable', }, ], shortcuts: [ { name: 'Quick Start', short_name: 'Start', url: '/en/start/quick-start/', description: 'Build your first Nibiru page in five minutes.', }, { name: 'AI module', short_name: 'AI', url: '/en/ai/module/overview/', description: 'First-class AI in your Nibiru app.', }, { name: 'Why Nibiru', short_name: 'Why', url: '/en/why-nibiru/', description: 'Differentiators with code references.', }, ], }, workbox: { navigateFallback: '/en/', // SSR /api/* endpoints — never cache, always go to network. navigateFallbackDenylist: [/^\/api\//], // Don't precache the heavy hero illustrations — they're served // from network and runtime-cached after first view. globPatterns: [ '**/*.{html,css,js,svg,woff2,json,xml}', 'img/pwa-*.png', 'img/apple-touch-icon.png', 'img/nibiru-*.png', 'img/lotus-divider.png', 'img/showcase-*.png', 'img/hero-backdrop.png', ], maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, runtimeCaching: [ { urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i, handler: 'StaleWhileRevalidate', options: { cacheName: 'google-fonts-stylesheets' }, }, { urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i, handler: 'CacheFirst', options: { cacheName: 'google-fonts-webfonts', expiration: { maxEntries: 16, maxAgeSeconds: 60 * 60 * 24 * 365 }, }, }, { urlPattern: /\/img\/.*\.(png|svg|jpg|jpeg|webp)$/i, handler: 'CacheFirst', options: { cacheName: 'nibiru-images', expiration: { maxEntries: 60, maxAgeSeconds: 60 * 60 * 24 * 30 }, }, }, ], }, devOptions: { enabled: false, // PWA runs only in production builds navigateFallback: '/en/', }, }), sitemap({ i18n: { defaultLocale: 'en', locales: { en: 'en', de: 'de', ja: 'ja', es: 'es', fr: 'fr' }, }, filter: (page) => !page.includes('/api/'), }), starlight({ title: 'Nibiru', description: 'A modular MMVC PHP framework for rapid prototyping. Born among the old gods, built for modern builders.', // Analytics — production-only. // 1. Umami (self-hosted) — cookie-free, honours Do-Not-Track, // no PII captured, no GDPR banner required. // 2. Google Analytics 4 (gtag.js) — added for Search Console // cross-linking + audience reach. Subject to GDPR; configure // consent / IP-anonymisation in the GA property settings. head: import.meta.env.PROD ? [ { tag: 'script', attrs: { defer: true, src: 'https://analytics.neuronetz.ai/script.js', 'data-website-id': '5f2143d2-775b-4269-afcd-2639381add47', 'data-do-not-track': 'true', 'data-exclude-search': 'true', }, }, { tag: 'script', attrs: { async: true, src: 'https://www.googletagmanager.com/gtag/js?id=G-V8QWB45G6X', }, }, { tag: 'script', content: "window.dataLayer = window.dataLayer || [];\n" + "function gtag(){dataLayer.push(arguments);}\n" + "gtag('js', new Date());\n" + "gtag('config', 'G-V8QWB45G6X');", }, ] : [], logo: { src: './public/img/nibiru-logo.png', replacesTitle: true, alt: 'Nibiru — Create, Invent, Impress', }, favicon: '/favicon.svg', editLink: { baseUrl: 'https://github.com/alllinux/Nibiru/edit/master/docs/' }, lastUpdated: true, defaultLocale: 'en', locales: { en: { label: 'English', lang: 'en' }, de: { label: 'Deutsch', lang: 'de' }, ja: { label: '日本語', lang: 'ja' }, es: { label: 'Español', lang: 'es' }, fr: { label: 'Français', lang: 'fr' }, }, customCss: [ // 1. Brand tokens (--nibiru-*). Mirrored from /design-system/ by // scripts/sync-design-system.mjs on every dev/build. './src/styles/design-system/tokens.css', // 2. Docs-system tokens — verbatim from the design handoff. Defines // --space, --space-2/3, --plum, --star-soft, --nebula-cyan/rose/green, // --note-fg, --r-md, --fs-base, etc. Must come BEFORE components.css // and nibiru.css since both consume these vars. './src/styles/docs-system/tokens.css', // 3. Docs-system components — verbatim from the handoff. Provides the // .topnav / .sidebar / .toc / .prose / .code-block / .callout-* / // .doc-table / .tab-* / .api-* / .card / .search-modal / .fab styles. './src/styles/docs-system/components.css', // 4. Fonts (Starlight needs --sl-font set before its own theme runs) './src/styles/fonts.css', // 5. Site-specific styles + Starlight overrides (splash sections, // legacy aliases, oracle launcher, atelier-button shims). './src/styles/nibiru.css', // 6. Starlight × handoff bridge — translates Starlight's actual class // names (.top-level, a[aria-current='page'], starlight-toc, // .sl-markdown-content, .pagination-links, .starlight-aside-*) // into the handoff's visual rules. Loaded LAST so it can win the // cascade over both Starlight's defaults and earlier styles. './src/styles/starlight-docs-bridge.css', ], components: { Hero: './src/components/GalaxyHero.astro', Header: './src/components/BrandHeader.astro', // Article header — emits .breadcrumbs /