v0.20.1 d9a391f

vite.config.ts RawHistoryFolder

1import { defineConfig } from "vite";
2import { svelte } from "@sveltejs/vite-plugin-svelte";
3import { resolve } from "path";
4import { pageGenerator } from "./vite-plugin-pages";
5
6// Page configurations for dumb:// protocol pages
7const pages = {
8  homepage: {
9    entry: "src/pages/homepage.ts",
10    output: "homepage.min.js",
11    global: "DumberHomepage",
12    html: {
13      name: "homepage",
14      title: "Dumber Browser",
15      script: "homepage.min.js",
16      css: "style.css",
17      filename: "index.html",
18    },
19  },
20  error: {
21    entry: "src/pages/error.ts",
22    output: "error.min.js",
23    global: "DumberError",
24    html: {
25      name: "error",
26      title: "Error",
27      script: "error.min.js",
28      css: "style.css",
29      filename: "error.html",
30    },
31  },
32  config: {
33    entry: "src/pages/config.ts",
34    output: "config.min.js",
35    global: "DumberConfig",
36    html: {
37      name: "config",
38      title: "Settings",
39      script: "config.min.js",
40      css: "style.css",
41      filename: "config.html",
42    },
43  },
44} as const;
45
46// Get page from VITE_PAGE env var, default to building all
47const targetPage = process.env.VITE_PAGE as keyof typeof pages | undefined;
48
49// Build single page config
50function buildPageConfig(pageName: keyof typeof pages) {
51  const page = pages[pageName];
52  return defineConfig({
53    plugins: [
54      svelte({
55        emitCss: false, // Inline component CSS for shadow DOM compatibility
56      }),
57      pageGenerator([page.html]),
58    ],
59    build: {
60      rollupOptions: {
61        input: resolve(__dirname, page.entry),
62        output: {
63          dir: "../assets/webui",
64          entryFileNames: page.output,
65          chunkFileNames: "[name].js",
66          assetFileNames: "[name].[ext]",
67          manualChunks: undefined,
68          format: "iife",
69          name: page.global,
70        },
71      },
72      emptyOutDir: false,
73      target: ["es2020", "chrome91", "firefox90"],
74      minify: true,
75      sourcemap: false,
76      cssCodeSplit: false,
77      assetsInlineLimit: 4096,
78    },
79    resolve: {
80      alias: {
81        $lib: resolve(__dirname, "src/lib"),
82        $components: resolve(__dirname, "src/components"),
83      },
84    },
85  });
86}
87
88// Export config for specified page or default to homepage
89// Use VITE_PAGE=homepage or VITE_PAGE=blocked to select
90export default buildPageConfig(targetPage || "homepage");

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close