Update kjol website with C documentation

This commit is contained in:
2026-07-14 13:05:12 -04:00
parent 02a6dc6c48
commit 7d7b7354df
66 changed files with 23884 additions and 2551 deletions

67
.vscode/launch.json vendored
View File

@@ -1,45 +1,74 @@
{
// Debug configs for the gowasm example. cwd is the example dir because the
// dev server resolves ./wwwroot, ./app, ./wasm and the watched engine dirs
// relative to it.
// Debug configs for kjol-web (the website). cwd is the site dir because the dev server
// resolves ./wwwroot, ./app, ./wasm, ./frontend and the watched engine dirs relative
// to it.
//
// The dev-server configs preLaunchTask the prebuild (codegen + Tailwind). Codegen must
// run before the server is compiled — it writes app/*.gen.go, which the server imports —
// and under the debugger the binary is built by Delve, not by the server's own Build
// hook, so nothing else would generate it.
// Every dev-server config preLaunchTasks "kjol-web: prebuild" (codegen -> Tailwind ->
// Solid bundle). Codegen must run before the server is COMPILED — it writes
// app/*.gen.go, which the server imports — and under the debugger the binary is built
// by Delve, not by the server's own Build hook, so nothing else would generate it.
"version": "0.2.0",
"configurations": [
{
"name": "gowasm: dev server",
"name": "kjol-web: dev server",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/go/cmd/examples/go-wasm-web/server",
"cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web",
"program": "${workspaceFolder}/go/cmd/kjol-web/server",
"cwd": "${workspaceFolder}/go/cmd/kjol-web",
"args": ["-addr", ":8085"],
"preLaunchTask": "gowasm: prebuild"
"preLaunchTask": "kjol-web: prebuild"
},
{
"name": "gowasm: dev server (no watch)",
"name": "kjol-web: dev server (no watch)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/go/cmd/examples/go-wasm-web/server",
"cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web",
"program": "${workspaceFolder}/go/cmd/kjol-web/server",
"cwd": "${workspaceFolder}/go/cmd/kjol-web",
// -watch=false skips the server's own Build entirely, so wwwroot is served exactly
// as it sits on disk. The prebuild is what puts current CSS and generated code
// there; without it you would be debugging against stale artefacts.
// as it sits on disk. The prebuild is what puts current generated code, CSS and JS
// bundles there; without it you would be debugging against stale artefacts — and
// with no bundle at all, every /js/* page would come up blank.
"args": ["-watch=false"],
"preLaunchTask": "gowasm: prebuild"
"preLaunchTask": "kjol-web: prebuild"
},
{
"name": "gowasm: codegen (wasmgen)",
"name": "kjol-web: cold build (-build)",
"type": "go",
"request": "launch",
"mode": "auto",
// The same binary, with the flag that runs every build step once and exits. There is
// no separate ./build command: the steps are a library, because the server imports
// them and Go will not let you import a main.
"program": "${workspaceFolder}/go/cmd/kjol-web/server",
"cwd": "${workspaceFolder}/go/cmd/kjol-web",
"args": ["-build"]
},
{
"name": "kjol-web: codegen (wasmgen)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/go/cmd/wasmgen",
"cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web",
"cwd": "${workspaceFolder}/go/cmd/kjol-web",
"args": ["./app"]
},
{
"name": "kjol-web: bundle (Solid)",
"type": "go",
"request": "launch",
"mode": "auto",
// Debug the JS build itself — the Solid compiler, the Tailwind engine, the SSR bake.
// All of it is Go, so all of it takes a breakpoint.
"program": "${workspaceFolder}/go/cmd/bundle",
"cwd": "${workspaceFolder}/go/cmd/kjol-web",
"args": [
"-app", "frontend",
"-web", "../../jsruntime",
"-out", "wwwroot",
"-gen-ts", "frontend/src/ui/generated"
]
}
]
}

112
.vscode/tasks.json vendored
View File

@@ -1,63 +1,95 @@
{
// Tasks for the kjol repo. The gowasm example is a nested module at
// go/cmd/examples/go-wasm-web, so its tasks set cwd there; the module-wide
// Go tasks run in go/.
// Tasks for the kjol repo.
//
// The example's build pipeline is Go, not a shell script — see
// go/cmd/examples/go-wasm-web/buildsteps. The dev server calls the same steps on every
// save, and a bash script would not run for anyone on Windows. "gowasm: prebuild" is
// codegen + Tailwind, and everything that runs the app depends on it; the two steps are
// also exposed on their own so you can rerun just the one you need.
// kjol-web — the website, and the runnable example of both web layers — is a nested
// module at go/cmd/kjol-web, so its tasks set cwd there; the module-wide Go tasks run
// in go/.
//
// These used to be called "gowasm: ...", which stopped being true: the site is two
// front-ends now, and one build compiles Go to WebAssembly AND bundles a Solid app.
// They are "kjol-web: ..." to match the directory they act on.
//
// The build pipeline is Go, not a shell script — see go/cmd/kjol-web/build. The dev
// server calls the same functions on every save, and a bash script would not run for
// anyone on Windows. Note there is no `./build` COMMAND any more: the steps are a
// library (the server imports them, and Go will not let you import a main), so a cold
// build is `go run ./server -build`.
//
// "kjol-web: prebuild" is what every run/debug config depends on. Codegen has to happen
// before the server is COMPILED — it writes app/*.gen.go, which the server imports — and
// under the debugger the binary is built by Delve, not by the server's own Build hook,
// so nothing else would generate it. Tailwind and the Solid bundle are in there too, so
// that a -watch=false session serves current artefacts instead of stale ones. Each step
// is also exposed on its own, so you can rerun just the one you need.
"version": "2.0.0",
"tasks": [
{
"label": "gowasm: prebuild",
"detail": "Codegen (pages/layouts/server components) then Tailwind. Dependency of the run + debug configs.",
"label": "kjol-web: prebuild",
"detail": "Codegen -> Tailwind -> Solid bundle. Dependency of the run + debug configs.",
"dependsOrder": "sequence",
"dependsOn": ["gowasm: codegen", "gowasm: tailwind"],
"dependsOn": ["kjol-web: codegen", "kjol-web: tailwind", "kjol-web: bundle (Solid)"],
"problemMatcher": [],
"group": "build"
},
{
"label": "gowasm: codegen",
"label": "kjol-web: codegen",
"detail": "Regenerate app/*.gen.go from the //gowasm: directives (pages, layouts, server components)",
"type": "shell",
"command": "go",
"args": ["run", "kjol/cmd/wasmgen", "./app"],
"options": { "cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web" },
"options": { "cwd": "${workspaceFolder}/go/cmd/kjol-web" },
"problemMatcher": ["$go"],
"presentation": { "reveal": "silent", "panel": "shared" },
"group": "build"
},
{
"label": "gowasm: tailwind",
"detail": "Compile css/app.css -> wwwroot/app.css, scanning the webui kit + the example's Go markup",
"label": "kjol-web: tailwind",
"detail": "Compile css/app.css -> wwwroot/app.css, scanning the webui kit + the site's Go markup",
"type": "shell",
"command": "go",
"args": [
"run", "./cmd/twcss",
"-entry", "cmd/examples/go-wasm-web/css/app.css",
"-out", "cmd/examples/go-wasm-web/wwwroot/app.css",
"-entry", "cmd/kjol-web/css/app.css",
"-out", "cmd/kjol-web/wwwroot/app.css",
"-base", ".",
"webui/**/*.go",
"cmd/examples/go-wasm-web/app/**/*.go",
"cmd/examples/go-wasm-web/server/**/*.go"
"cmd/kjol-web/app/**/*.go",
"cmd/kjol-web/server/**/*.go"
],
// Run from the kjol module root so the Tailwind engine's deps resolve in kjol's
// go.mod, not the example's.
// go.mod, not the site's.
"options": { "cwd": "${workspaceFolder}/go" },
"problemMatcher": ["$go"],
"presentation": { "reveal": "silent", "panel": "shared" },
"group": "build"
},
{
"label": "gowasm: dev server (hot reload)",
"detail": "SSR + hot reload on :8085. Rebuilds Go on save; a .css save recompiles Tailwind only and swaps the stylesheet in place.",
"label": "kjol-web: bundle (Solid)",
"detail": "TSX -> Solid -> esbuild, plus the SSR bake: wwwroot/bundle.min.{js,css} + public.bundle.min.*",
"type": "shell",
"command": "go",
"args": [
"run", "kjol/cmd/bundle",
"-app", "frontend",
// The shared JS tree: the Solid kit, the vendored runtime, the icon SVGs and the
// @theme scaffold all live there.
"-web", "../../jsruntime",
"-out", "wwwroot",
"-gen-ts", "frontend/src/ui/generated"
],
"options": { "cwd": "${workspaceFolder}/go/cmd/kjol-web" },
"problemMatcher": ["$go"],
"presentation": { "reveal": "silent", "panel": "shared" },
"group": "build"
},
{
"label": "kjol-web: dev server (hot reload)",
"detail": "SSR + /rsc + hot reload on :8085. Rebuilds on save; a .css save recompiles Tailwind only and swaps the stylesheet in place.",
"type": "shell",
"command": "go",
"args": ["run", "./server"],
"options": { "cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web" },
"dependsOn": ["gowasm: prebuild"],
"options": { "cwd": "${workspaceFolder}/go/cmd/kjol-web" },
"dependsOn": ["kjol-web: prebuild"],
"isBackground": true,
"problemMatcher": {
"owner": "go",
@@ -75,18 +107,18 @@
"group": { "kind": "build", "isDefault": true }
},
{
"label": "gowasm: build",
"detail": "One-off cold build of the example: codegen + Tailwind + wasm + stage wasm_exec.js",
"label": "kjol-web: build (cold)",
"detail": "Cold build, then exit: codegen + Tailwind + wasm + Solid bundle + wasm_exec.js.",
"type": "shell",
"command": "go",
"args": ["run", "./build"],
"options": { "cwd": "${workspaceFolder}/go/cmd/examples/go-wasm-web" },
"args": ["run", "./server", "-build"],
"options": { "cwd": "${workspaceFolder}/go/cmd/kjol-web" },
"problemMatcher": ["$go"],
"group": "build"
},
{
"label": "kjol: build ./...",
"detail": "Build the whole kjol module (excludes the nested example)",
"detail": "Build the whole kjol module (does not descend into the nested kjol-web module)",
"type": "shell",
"command": "go build ./...",
"options": { "cwd": "${workspaceFolder}/go" },
@@ -108,6 +140,28 @@
"options": { "cwd": "${workspaceFolder}/go" },
"problemMatcher": ["$go"],
"group": { "kind": "test", "isDefault": true }
},
{
"label": "kjol: test the reconciler (wasm)",
"detail": "The reconciler needs a DOM, so `go test ./...` cannot reach it. This runs it under node, against a minimal DOM shim.",
"type": "shell",
"command": "go",
"args": ["test", "-exec=node testdata/domexec.js", "./wasmruntime"],
"options": {
"cwd": "${workspaceFolder}/go",
"env": { "GOOS": "js", "GOARCH": "wasm" }
},
"problemMatcher": ["$go"],
"group": "test"
},
{
"label": "kjol-web: test",
"detail": "The site's own tests (SSR, the icon registry, the AutoTable export bytes). Its own module, so `kjol: test ./...` does not reach it.",
"type": "shell",
"command": "go test ./...",
"options": { "cwd": "${workspaceFolder}/go/cmd/kjol-web" },
"problemMatcher": ["$go"],
"group": "test"
}
]
}