Skip to content

Commit

Permalink
perf(mermaid): remove unused references to mermaid
Browse files Browse the repository at this point in the history
  • Loading branch information
wallpants committed Oct 17, 2023
1 parent 3185389 commit 74f328f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 1,651 deletions.
Binary file modified app/bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"clsx": "^2.0.0",
"globby": "^13.2.2",
"isbinaryfile": "5.0.0",
"mermaid": "^10.5.0",
"opener": "^1.5.2",
"pantsdown": "1.4.1",
"react": "^18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions app/src/server/http.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export function httpHandler(host: string, port: number, root: string) {
if (pathname.startsWith(GP_STATIC_PREFIX)) {
const requested = pathname.slice(GP_STATIC_PREFIX.length);

// hydrate.js hydrates the server components generated and sent below
// hydrate.js is built from typescript files on request
// hydrate.js hydrates the server components generated and sent below.
// hydrate.js is built from hydrate.ts on request
if (requested === "hydrate.js") {
const { outputs } = await Bun.build({
entrypoints: [webRoot + "hydrate.tsx"],
Expand Down Expand Up @@ -68,7 +68,7 @@ export function httpHandler(host: string, port: number, root: string) {
return new Response(file);
}

// If none of the previous cases matches the request, the client (browser) is
// If none of the previous cases match the request, the client (browser) is
// probably making its first request to get the server rendered react app
const stream = await renderToReadableStream(<Index />, {
bootstrapModules: [`${GP_STATIC_PREFIX}hydrate.js`],
Expand Down
1 change: 0 additions & 1 deletion app/src/web/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const Index = ({
<head>
<meta charSet="UTF-8" />
<link rel="icon" type="image/svg+xml" href={`${GP_STATIC_PREFIX}github.svg`} />
{/* <script type="text/javascript" src={`${GP_STATIC_PREFIX}mermaid.min.js`}></script> */}
<link href={`${GP_STATIC_PREFIX}tailwind.css`} rel="stylesheet" />
<link href={`${GP_STATIC_PREFIX}${PANTSDOWN_CSS}`} rel="stylesheet" />
<link href={`${GP_STATIC_PREFIX}index.css`} rel="stylesheet" />
Expand Down
5 changes: 0 additions & 5 deletions app/src/web/markdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { type Mermaid } from "mermaid";
import { Pantsdown } from "pantsdown";
import { useContext, useEffect, useState } from "react";
import { websocketContext } from "../provider/context.ts";
Expand All @@ -12,7 +11,6 @@ const MARKDOWN_CONTAINER_ID = "markdown-container-id";
const MARKDOWN_ELEMENT_ID = "markdown-element-id";
export const GP_LOCALIMAGE_PREFIX = "/__localimage__/";

// declare const mermaid: Mermaid;
const pantsdown = new Pantsdown({
renderer: { relativeImageUrlPrefix: GP_LOCALIMAGE_PREFIX },
});
Expand All @@ -27,7 +25,6 @@ export const Markdown = ({ className }: { className: string }) => {
const [markdownContainerElement, setMarkdownContainerElement] = useState<HTMLElement>();

useEffect(() => {
// mermaid.initialize({ startOnLoad: false });
setMarkdownElement(document.getElementById(MARKDOWN_ELEMENT_ID)!);
setCursorLineElement(document.getElementById(CURSOR_LINE_ELEMENT_ID)!);
setLineNumbersElement(document.getElementById(LINE_NUMBERS_ELEMENT_ID)!);
Expand All @@ -45,8 +42,6 @@ export const Markdown = ({ className }: { className: string }) => {
const markdown = fileExt === "md" ? text : "```" + fileExt + `\n${text}`;
markdownElement.innerHTML = pantsdown.parse(markdown);

// void mermaid.run();

if (fileExt === "md") {
markdownElement.style.setProperty("padding", "44px");
markdownElement.style.setProperty("max-width", "1012px");
Expand Down
1,641 changes: 0 additions & 1,641 deletions app/src/web/mermaid.min.js

This file was deleted.

0 comments on commit 74f328f

Please sign in to comment.