diff --git a/_components/SidebarNav.tsx b/_components/SidebarNav/comp.tsx similarity index 96% rename from _components/SidebarNav.tsx rename to _components/SidebarNav/comp.tsx index bb1672499..ebc1153a6 100644 --- a/_components/SidebarNav.tsx +++ b/_components/SidebarNav/comp.tsx @@ -1,5 +1,5 @@ // deno-lint-ignore-file no-explicit-any -import ReferenceSidebarNav from "../reference/_components/ReferenceSidebarNav.tsx"; +import ReferenceSidebarNav from "../../reference/_components/ReferenceSidebarNav.tsx"; export default function (data: Lume.Data) { const sectionData = data.sectionData; @@ -129,5 +129,3 @@ function SidebarCategoryHeading(props: { ); } - -export const js = `import "/js/sidebar.client.js";`; diff --git a/static/js/sidebar.client.js b/_components/SidebarNav/script.js similarity index 100% rename from static/js/sidebar.client.js rename to _components/SidebarNav/script.js diff --git a/_components/ThemeToggle.tsx b/_components/ThemeToggle/comp.tsx similarity index 90% rename from _components/ThemeToggle.tsx rename to _components/ThemeToggle/comp.tsx index 5e6d4adb1..36d1f61f1 100644 --- a/_components/ThemeToggle.tsx +++ b/_components/ThemeToggle/comp.tsx @@ -20,8 +20,3 @@ export default function () { ); } - -export const js = ` -import "/js/darkmode.client.js"; -import "/js/darkmode-toggle.client.js"; -`; diff --git a/static/js/darkmode-toggle.client.js b/_components/ThemeToggle/darkmode-toggle.js similarity index 100% rename from static/js/darkmode-toggle.client.js rename to _components/ThemeToggle/darkmode-toggle.js diff --git a/static/js/darkmode.client.js b/_components/ThemeToggle/darkmode.js similarity index 100% rename from static/js/darkmode.client.js rename to _components/ThemeToggle/darkmode.js diff --git a/_components/ThemeToggle/script.js b/_components/ThemeToggle/script.js new file mode 100644 index 000000000..535171dc9 --- /dev/null +++ b/_components/ThemeToggle/script.js @@ -0,0 +1,2 @@ +import "./darkmode.js"; +import "./darkmode-toggle.js"; diff --git a/_components/VideoPlayer.tsx b/_components/VideoPlayer/comp.tsx similarity index 94% rename from _components/VideoPlayer.tsx rename to _components/VideoPlayer/comp.tsx index 61430a49c..a3a13617c 100644 --- a/_components/VideoPlayer.tsx +++ b/_components/VideoPlayer/comp.tsx @@ -32,7 +32,3 @@ function urlMatcher(url: string): string | undefined { const match = url.match(urlPattern); return match?.[3]; } - -export const js = ` - import "/js/youtube-lite.client.js"; -`; diff --git a/static/js/youtube-lite.client.js b/_components/VideoPlayer/script.js similarity index 100% rename from static/js/youtube-lite.client.js rename to _components/VideoPlayer/script.js diff --git a/_config.ts b/_config.ts index c07700368..ac88cb568 100644 --- a/_config.ts +++ b/_config.ts @@ -2,16 +2,13 @@ import "@std/dotenv/load"; import lume from "lume/mod.ts"; import esbuild from "lume/plugins/esbuild.ts"; -import jsx from "lume/plugins/jsx_preact.ts"; +import jsx from "lume/plugins/jsx.ts"; import mdx from "lume/plugins/mdx.ts"; import ogImages from "lume/plugins/og_images.ts"; -import postcss from "lume/plugins/postcss.ts"; import redirects from "lume/plugins/redirects.ts"; import search from "lume/plugins/search.ts"; import sitemap from "lume/plugins/sitemap.ts"; -import postcssNesting from "npm:@tailwindcss/nesting"; - -import tailwind from "@tailwindcss/postcss"; +import tailwind from "lume/plugins/tailwindcss.ts"; import Prism from "./prism.ts"; @@ -159,23 +156,25 @@ site.use(search()); site.use(jsx()); site.use(mdx()); -site.use( - postcss({ - includes: false, - plugins: [postcssNesting, tailwind()], - }), -); - +site.add("js"); site.use( esbuild({ - extensions: [".client.ts", ".client.js"], + extensions: [".ts"], options: { minify: false, splitting: true, + alias: { + "node:crypto": "./_node-crypto.js", + }, }, }), ); +site.add("style.css"); +site.use(tailwind({ + minify: true, +})); + site.use(toc({ anchor: false })); site.use(title()); site.use(sitemap()); @@ -209,7 +208,7 @@ site.addEventListener("afterBuild", async () => { Deno.writeTextFileSync(site.dest("llms-full.txt"), llmsFullTxt); log.info("Generated llms-full.txt in site root"); } catch (error) { - log.error("Error generating LLMs files:", error); + log.error("Error generating LLMs files:" + error); } } }); @@ -297,7 +296,7 @@ if (Deno.env.get("BUILD_TYPE") == "FULL") { site.data("openGraphLayout", "/open_graph/default.jsx"); site.use( ogImages({ - satori: { + options: { width: 1200, height: 630, fonts: [ @@ -326,13 +325,11 @@ if (Deno.env.get("BUILD_TYPE") == "FULL") { }, ], }, - cache: false, }), ); } site.scopedUpdates( - (path) => path == "/overrides.css", (path) => /\.(js|ts)$/.test(path), (path) => path.startsWith("/api/deno/"), ); diff --git a/_includes/doc.tsx b/_includes/doc.tsx index 3e47749be..07c521a34 100644 --- a/_includes/doc.tsx +++ b/_includes/doc.tsx @@ -36,25 +36,19 @@ export default function Doc(data: Lume.Data, helpers: Lume.Helpers) { function getTocCtx( d: Lume.Data, ): { document_navigation: unknown; document_navigation_str: string } | null { - const ch: unknown = (d as unknown as { children?: unknown })?.children; - if (ch && typeof ch === "object" && "props" in ch) { - const props: unknown = (ch as { props?: unknown }).props; - if (props && typeof props === "object" && "data" in props) { - const pdata: unknown = (props as { data?: unknown }).data; - if (pdata && typeof pdata === "object" && "toc_ctx" in pdata) { - const toc: unknown = (pdata as { toc_ctx?: unknown }).toc_ctx; - if ( - toc && typeof toc === "object" && - "document_navigation" in toc && - "document_navigation_str" in toc - ) { - const t = toc as { - document_navigation: unknown; - document_navigation_str: string; - }; - return t; - } - } + const pdata = d.data; + if (pdata && typeof pdata === "object" && "toc_ctx" in pdata) { + const toc: unknown = (pdata as { toc_ctx?: unknown }).toc_ctx; + if ( + toc && typeof toc === "object" && + "document_navigation" in toc && + "document_navigation_str" in toc + ) { + const t = toc as { + document_navigation: unknown; + document_navigation_str: string; + }; + return t; } } return null; diff --git a/_includes/layout.tsx b/_includes/layout.tsx index 210328e86..7aabf1906 100644 --- a/_includes/layout.tsx +++ b/_includes/layout.tsx @@ -31,7 +31,7 @@ export default function Layout(data: Lume.Data) { - - - - - - - + + + + + + +