Skip to content

Commit 81f199b

Browse files
thisisjofrankoscaroterophilhawksworthjespertheendfrou
authored
Oscarotero/main (#2787)
Co-authored-by: Oscar Otero <oom@oscarotero.com> Co-authored-by: Phil Hawksworth <phil@deno.com> Co-authored-by: Jesper van den Ende <jespertheend@users.noreply.github.com> Co-authored-by: Duncan Holm <duncan@holm.scot>
1 parent f769e3d commit 81f199b

30 files changed

+446
-1626
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// deno-lint-ignore-file no-explicit-any
2-
import ReferenceSidebarNav from "../reference/_components/ReferenceSidebarNav.tsx";
2+
import ReferenceSidebarNav from "../../reference/_components/ReferenceSidebarNav.tsx";
33

44
export default function (data: Lume.Data) {
55
const sectionData = data.sectionData;
@@ -129,5 +129,3 @@ function SidebarCategoryHeading(props: {
129129
</h2>
130130
);
131131
}
132-
133-
export const js = `import "/js/sidebar.client.js";`;
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@ export default function () {
2020
</button>
2121
);
2222
}
23-
24-
export const js = `
25-
import "/js/darkmode.client.js";
26-
import "/js/darkmode-toggle.client.js";
27-
`;
File renamed without changes.

_components/ThemeToggle/script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import "./darkmode.js";
2+
import "./darkmode-toggle.js";
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@ function urlMatcher(url: string): string | undefined {
3232
const match = url.match(urlPattern);
3333
return match?.[3];
3434
}
35-
36-
export const js = `
37-
import "/js/youtube-lite.client.js";
38-
`;

_config.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ import "@std/dotenv/load";
22

33
import lume from "lume/mod.ts";
44
import esbuild from "lume/plugins/esbuild.ts";
5-
import jsx from "lume/plugins/jsx_preact.ts";
5+
import jsx from "lume/plugins/jsx.ts";
66
import mdx from "lume/plugins/mdx.ts";
77
import ogImages from "lume/plugins/og_images.ts";
8-
import postcss from "lume/plugins/postcss.ts";
98
import redirects from "lume/plugins/redirects.ts";
109
import search from "lume/plugins/search.ts";
1110
import sitemap from "lume/plugins/sitemap.ts";
12-
import postcssNesting from "npm:@tailwindcss/nesting";
13-
14-
import tailwind from "@tailwindcss/postcss";
11+
import tailwind from "lume/plugins/tailwindcss.ts";
1512

1613
import Prism from "./prism.ts";
1714

@@ -160,23 +157,25 @@ site.use(search());
160157
site.use(jsx());
161158
site.use(mdx());
162159

163-
site.use(
164-
postcss({
165-
includes: false,
166-
plugins: [postcssNesting, tailwind()],
167-
}),
168-
);
169-
160+
site.add("js");
170161
site.use(
171162
esbuild({
172-
extensions: [".client.ts", ".client.js"],
163+
extensions: [".ts"],
173164
options: {
174165
minify: false,
175166
splitting: true,
167+
alias: {
168+
"node:crypto": "./_node-crypto.js",
169+
},
176170
},
177171
}),
178172
);
179173

174+
site.add("style.css");
175+
site.use(tailwind({
176+
minify: true,
177+
}));
178+
180179
site.use(toc({ anchor: false }));
181180
site.use(title());
182181
site.use(sitemap());
@@ -210,7 +209,7 @@ site.addEventListener("afterBuild", async () => {
210209
Deno.writeTextFileSync(site.dest("llms-full.txt"), llmsFullTxt);
211210
log.info("Generated llms-full.txt in site root");
212211
} catch (error) {
213-
log.error("Error generating LLMs files:", error);
212+
log.error("Error generating LLMs files:" + error);
214213
}
215214
}
216215
});
@@ -298,7 +297,7 @@ if (Deno.env.get("BUILD_TYPE") == "FULL") {
298297
site.data("openGraphLayout", "/open_graph/default.jsx");
299298
site.use(
300299
ogImages({
301-
satori: {
300+
options: {
302301
width: 1200,
303302
height: 630,
304303
fonts: [
@@ -327,13 +326,11 @@ if (Deno.env.get("BUILD_TYPE") == "FULL") {
327326
},
328327
],
329328
},
330-
cache: false,
331329
}),
332330
);
333331
}
334332

335333
site.scopedUpdates(
336-
(path) => path == "/overrides.css",
337334
(path) => /\.(js|ts)$/.test(path),
338335
(path) => path.startsWith("/api/deno/"),
339336
);

_includes/doc.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,24 @@ export default function Doc(data: Lume.Data, helpers: Lume.Helpers) {
2828
}
2929

3030
function getTocCtx(
31-
d: unknown,
31+
d: Lume.Data,
3232
): { document_navigation: unknown; document_navigation_str: string } | null {
33-
type Toc = {
34-
document_navigation: unknown;
35-
document_navigation_str: string;
36-
};
37-
const tocCtx: unknown = (d as {
38-
children?: { props?: { data?: { toc_ctx?: unknown } } };
39-
})?.children?.props?.data?.toc_ctx;
33+
const tocCandidate =
34+
(d.data as { toc_ctx?: unknown } | undefined)?.toc_ctx ??
35+
(d as {
36+
children?: { props?: { data?: { toc_ctx?: unknown } } };
37+
})?.children?.props?.data?.toc_ctx;
38+
4039
if (
41-
tocCtx &&
42-
typeof tocCtx === "object" &&
43-
"document_navigation" in tocCtx &&
44-
"document_navigation_str" in tocCtx
40+
tocCandidate &&
41+
typeof tocCandidate === "object" &&
42+
"document_navigation" in tocCandidate &&
43+
"document_navigation_str" in tocCandidate
4544
) {
46-
return tocCtx as Toc;
45+
return tocCandidate as {
46+
document_navigation: unknown;
47+
document_navigation_str: string;
48+
};
4749
}
4850
return null;
4951
}

0 commit comments

Comments
 (0)