148 lines
4.6 KiB
TypeScript
148 lines
4.6 KiB
TypeScript
import type { AppConfig } from "@wrnexus/styles";
|
|
|
|
const config: AppConfig = {
|
|
// Repair clients that are still controlled by an older cached service worker.
|
|
// This can be removed after every preview client has advanced beyond v3.
|
|
head: '<script src="/pwa-recover.js" defer></script>',
|
|
mobile: {
|
|
enabled: true,
|
|
appId: "com.example.wrnexusjs",
|
|
appName: "WRNexusJS",
|
|
userAgent: "WRNexusJSMobile",
|
|
backgroundColor: "#0f172a",
|
|
// layout: "mobile", // app/layouts/mobile.wrn
|
|
// icon: "resources/icon.png",
|
|
},
|
|
|
|
// PWA support is enabled automatically. Override any install metadata here.
|
|
pwa: {
|
|
name: "WRNexusJS Documentation",
|
|
shortName: "WRNexusJS Docs",
|
|
cacheName: "wrnexus-pwa-v3",
|
|
runtimeCaching: [
|
|
{
|
|
pattern: "^https://wrnexusjs\\.dev/",
|
|
strategy: "network-first",
|
|
methods: ["GET"],
|
|
},
|
|
],
|
|
display: "standalone",
|
|
themeColor: "#6366f1",
|
|
backgroundColor: "#0f172a",
|
|
},
|
|
|
|
seo: {
|
|
title: "WRNexusJS Documentation",
|
|
titleTemplate: "%s | WRNexusJS",
|
|
description: "Complete documentation for every WRNexusJS package, API, function, and workflow.",
|
|
robots: "index,follow",
|
|
themeColor: "#6366f1",
|
|
},
|
|
|
|
security: {
|
|
headers: {
|
|
hsts: true,
|
|
noSniff: true,
|
|
referrerPolicy: "strict-origin-when-cross-origin",
|
|
permissionsPolicy: "camera=(), microphone=(), geolocation=()",
|
|
},
|
|
contentSecurityPolicy: {
|
|
enabled: true,
|
|
directives: {
|
|
"default-src": ["'self'"],
|
|
"img-src": ["'self'", "data:", "https:"],
|
|
"font-src": ["'self'", "data:", "https://fonts.gstatic.com"],
|
|
// WRNexus 0.8 components and the reactive runtime use style attributes
|
|
// for initial visibility and state changes. CSP nonces do not authorize
|
|
// style attributes, so unsafe-inline remains required for this release.
|
|
"style-src": ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
|
|
// The service worker fetches and caches the configured Google Font.
|
|
// Service-worker fetch() is governed by connect-src as well as font-src.
|
|
"connect-src": ["'self'", "https://fonts.gstatic.com"],
|
|
},
|
|
},
|
|
},
|
|
|
|
styles: {
|
|
entry: "app/styles/global.css",
|
|
|
|
// Tailwind v4 build. Runs once at dev-serve time (cached; re-run on restart)
|
|
// and at `wrnexus build`. `@tailwindcss/cli` writes to stdout, so we capture
|
|
// and return the final CSS. Delete this hook to drop Tailwind — global.css is
|
|
// still bundled and served as-is.
|
|
process: async ({ entryPath, mode }) => {
|
|
const args = ["@tailwindcss/cli", "-i", entryPath!];
|
|
if (mode === "production") args.push("--minify");
|
|
return await Bun.$`bunx ${args}`.text();
|
|
},
|
|
},
|
|
|
|
fonts: {
|
|
sans: '"Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif',
|
|
google: [{ family: "Plus Jakarta Sans", weights: [400, 500, 600, 700, 800] }],
|
|
},
|
|
|
|
// Fonts — the framework emits optimized <head> markup (preconnect, subsetted
|
|
// Google Fonts with font-display, self-hosted @font-face with preload) and
|
|
// auto-extends the CSP for Google Fonts. Uncomment to use a custom font:
|
|
//
|
|
// fonts: {
|
|
// sans: '"Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif',
|
|
// google: [{ family: "Plus Jakarta Sans", weights: [400, 500, 600, 700] }],
|
|
// // Or self-host (fastest, no third party) — drop files in public/fonts/:
|
|
// // local: [{ family: "Plus Jakarta Sans", src: "/fonts/jakarta.woff2", weight: "100 900", preload: true }],
|
|
// },
|
|
|
|
// security: {
|
|
// cors: {
|
|
// enabled: true,
|
|
// origin: ["http://localhost:5173"],
|
|
// },
|
|
// },
|
|
imports: { mode: "compatible", autoImport: true, aliases: { "@": "./app" } },
|
|
types: {
|
|
strict: false,
|
|
noImplicitAny: false,
|
|
strictNullChecks: true,
|
|
checkTemplates: true,
|
|
checkComponentProps: true,
|
|
generateDeclarations: true,
|
|
globalTypes: "./app/types/global.d.ts",
|
|
},
|
|
functions: { legacyDefaultRuntime: "current" },
|
|
stores: { strictMutations: true, persistence: true },
|
|
compatibility: {
|
|
legacyEmit: true,
|
|
legacyEventProps: true,
|
|
legacyComponentDiscovery: true,
|
|
stringLayouts: true,
|
|
},
|
|
navigation: {
|
|
mode: "auto",
|
|
},
|
|
performance: {
|
|
enforcement: "warn",
|
|
analyze: true,
|
|
budgets: {
|
|
routeJsBytes: 51200,
|
|
routeCssBytes: 25600,
|
|
htmlBytes: 204800,
|
|
hydrationMs: 200,
|
|
serverRenderMs: 500,
|
|
lcpMs: 2500,
|
|
inpMs: 200,
|
|
cls: 0.1,
|
|
ttfbMs: 800,
|
|
},
|
|
},
|
|
observability: {
|
|
enabled: true,
|
|
serverTiming: true,
|
|
sampleRate: 0.1,
|
|
exporter: "none",
|
|
webVitals: true,
|
|
},
|
|
};
|
|
|
|
export default config;
|