Skip to content

Commit 7bfcf62

Browse files
authored
Merge pull request #48 from tmr232/render-page
Add Render Page
2 parents 9601119 + 14f9167 commit 7bfcf62

24 files changed

+460
-83
lines changed

.github/workflows/pages.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
- name: "Build Demo Website"
1818
run: bun build-demo
1919

20+
- name: "Build Render Website"
21+
run: bun build-render
22+
2023
- name: "Build docs"
2124
run: bun typedoc --out ./dist/demo/docs
2225

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
99
### Added
1010

1111
- The JetBrains plugin can now change settings: flat switch, simplification, highlighting, and color scheme
12+
- `/render` page to render code directly from GitHub, given a URL with a line number.
1213

1314
## [0.0.12] - 2024-12-18
1415

bun.lockb

359 Bytes
Binary file not shown.

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default tseslint.config(
1212
"webview-content",
1313
"src/frontend",
1414
"src/jetbrains",
15+
"src/render",
1516
"src/demo",
1617
"src/components",
1718
".vscode-test.mjs",

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@codemirror/lang-python": "^6.1.6",
2222
"@codemirror/theme-one-dark": "^6.1.2",
2323
"@eslint/js": "^9.12.0",
24+
"@panzoom/panzoom": "^4.5.1",
2425
"@rollup/plugin-wasm": "^6.2.2",
2526
"@sveltejs/vite-plugin-svelte": "^3.1.2",
2627
"@types/bun": "latest",
@@ -57,14 +58,18 @@
5758
"publish": "bun run package && bun run vsce-publish",
5859
"clean": "rm -r ./dist",
5960
"web": "bun run --cwd ./src/frontend/ vite",
61+
"render": "bun run --cwd src/render/ vite",
6062
"web-tests": "bun run ./scripts/collect-comment-tests.ts",
6163
"demo": "bun run --cwd ./src/demo/ vite",
62-
"build-demo": "bun run --cwd ./src/demo/ vite build --outDir ../../dist/demo --base '/function-graph-overview/'",
64+
"build-demo": "bun run --cwd ./src/demo/ vite build",
65+
"build-render": "bun run --cwd ./src/render/ vite build",
6366
"build-jetbrains": "bun run --cwd ./src/jetbrains/ vite build",
6467
"oxlint-fix": "bunx oxlint --ignore-path=oxlint-ignore.txt --fix -D correctness -D perf -D suspicious -A no-await-in-loop",
6568
"oxlint-ci": "bunx oxlint --ignore-path=oxlint-ignore.txt -D correctness -D perf -D suspicious -A no-await-in-loop",
66-
"lint": "bunx biome check --fix && bun oxlint-fix && bunx eslint --fix && bunx tsc --noEmit",
67-
"ci": "bunx biome ci && bun oxlint-ci && bunx eslint && bunx tsc --noEmit",
69+
"prettier-format": "bunx prettier **/*.svelte --write",
70+
"prettier-check": "bunx prettier **/*.svelte --check",
71+
"lint": "bunx biome check --fix && bun oxlint-fix && bun prettier-format && bunx eslint --fix && bunx tsc --noEmit",
72+
"ci": "bunx biome ci && bun oxlint-ci && bun prettier-check && bunx eslint && bunx tsc --noEmit",
6873
"generate-parsers": "bun run ./scripts/generate-parsers.ts",
6974
"typedoc": "bunx typedoc --treatWarningsAsErrors"
7075
},

scripts/file-parsing.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

scripts/render-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "../src/control-flow/cfg.ts";
1111
import { simplifyCFG, trimFor } from "../src/control-flow/graph-ops.ts";
1212
import { graphToDot } from "../src/control-flow/render.ts";
13-
import { getLanguage, iterFunctions } from "./file-parsing.ts";
13+
import { getLanguage, iterFunctions } from "../src/file-parsing/bun.ts";
1414

1515
function isLanguage(language: string): language is Language {
1616
return supportedLanguages.includes(language as Language);

scripts/scan-codebase.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import * as path from "node:path";
99
import { parseArgs } from "node:util";
1010
import { Glob } from "bun";
1111
import { newCFGBuilder } from "../src/control-flow/cfg";
12-
import { fileTypes, getLanguage, iterFunctions } from "./file-parsing.ts";
12+
import {
13+
fileTypes,
14+
getLanguage,
15+
iterFunctions,
16+
} from "../src/file-parsing/bun.ts";
1317

1418
function iterSourceFiles(root: string): IterableIterator<string> {
1519
const sourceGlob = new Glob(

src/components/Demo.svelte

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { go } from "@codemirror/lang-go";
33
import { cpp } from "@codemirror/lang-cpp";
44
import { python } from "@codemirror/lang-python";
5-
import {javascript} from "@codemirror/lang-javascript";
5+
import { javascript } from "@codemirror/lang-javascript";
66
import Graph from "./Graph.svelte";
77
import type { Language } from "../control-flow/cfg";
88
import * as LZString from "lz-string";
@@ -20,7 +20,8 @@
2020
"C++": "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}",
2121
Python: "def example():\n if x:\n return",
2222
TypeScript: "function main() {\n\tif (x) {\n\t\treturn;\n\t}\n}",
23-
TSX: "function getGreeting(user) {\n" +
23+
TSX:
24+
"function getGreeting(user) {\n" +
2425
" if (user) {\n" +
2526
" return <h1>Hello, {formatName(user)}!</h1>; }\n" +
2627
" return <h1>Hello, Stranger.</h1>;}",
@@ -50,8 +51,16 @@
5051
text: "C++",
5152
codeMirror: cpp,
5253
},
53-
{language:"TypeScript" as Language, text:"TypeScript (experimental)", codeMirror: ()=>javascript({typescript:true})},
54-
{language:"TSX" as Language, text:"TSX (experimental)", codeMirror: ()=>javascript({typescript:true, jsx:true})},
54+
{
55+
language: "TypeScript" as Language,
56+
text: "TypeScript (experimental)",
57+
codeMirror: () => javascript({ typescript: true }),
58+
},
59+
{
60+
language: "TSX" as Language,
61+
text: "TSX (experimental)",
62+
codeMirror: () => javascript({ typescript: true, jsx: true }),
63+
},
5564
] as const;
5665
5766
const urlParams = new URLSearchParams(window.location.search);

src/demo/src/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import demoCodeC from "./assets/demo.c?raw";
55
import demoCodePython from "./assets/demo.py?raw";
66
import demoCodeCpp from "./assets/demo.cpp?raw";
7-
import demoCodeTypeScript from "./assets/demo.ts?raw"
7+
import demoCodeTypeScript from "./assets/demo.ts?raw";
88
import { isDark } from "../../components/lightdark";
99
import { onDestroy } from "svelte";
1010
import type { Language } from "../../control-flow/cfg.ts";

0 commit comments

Comments
 (0)