v0.26.1 75cd777

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";
5import { copyFileSync, existsSync, mkdirSync } from "fs";
6
7// Page configurations for dumb:// protocol pages
8const pages = {
9  homepage: {
10    entry: "src/pages/homepage.ts",
11    output: "homepage.min.js",
12    global: "DumberHomepage",
13    html: {
14      name: "homepage",
15      title: "Dumber Browser",
16      script: "homepage.min.js",
17      css: "style.css",
18      filename: "index.html",
19    },
20  },
21  error: {
22    entry: "src/pages/error.ts",
23    output: "error.min.js",
24    global: "DumberError",
25    html: {
26      name: "error",
27      title: "Error",
28      script: "error.min.js",
29      css: "style.css",
30      filename: "error.html",
31    },
32  },
33  config: {
34    entry: "src/pages/config.ts",
35    output: "config.min.js",
36    global: "DumberConfig",
37    html: {
38      name: "config",
39      title: "Settings",
40      script: "config.min.js",
41      css: "style.css",
42      filename: "config.html",
43    },
44  },
45} as const;
46
47// Get page from VITE_PAGE env var, default to building all
48const targetPage = process.env.VITE_PAGE as keyof typeof pages | undefined;
49
50// Copy public assets to output directory
51function copyPublicAssets() {
52  const outDir = resolve(__dirname, "../assets/webui");
53  const publicDir = resolve(__dirname, "public");
54  if (!existsSync(outDir)) {
55    mkdirSync(outDir, { recursive: true });
56  }
57  // Copy favicon.png for dumb:// URL favicons
58  const faviconSrc = resolve(publicDir, "favicon.png");
59  if (existsSync(faviconSrc)) {
60    copyFileSync(faviconSrc, resolve(outDir, "favicon.png"));
61  }
62}
63
64// Build single page config
65function buildPageConfig(pageName: keyof typeof pages) {
66  const page = pages[pageName];
67  return defineConfig({
68    plugins: [
69      svelte({
70        emitCss: false, // Inline component CSS for shadow DOM compatibility
71      }),
72      pageGenerator([page.html]),
73      {
74        name: "copy-public-assets",
75        closeBundle() {
76          copyPublicAssets();
77        },
78      },
79    ],
80    build: {
81      rollupOptions: {
82        input: resolve(__dirname, page.entry),
83        output: {
84          dir: "../assets/webui",
85          entryFileNames: page.output,
86          chunkFileNames: "[name].js",
87          assetFileNames: "[name].[ext]",
88          manualChunks: undefined,
89          format: "iife",
90          name: page.global,
91        },
92      },
93      emptyOutDir: false,
94      target: ["es2020", "chrome91", "firefox90"],
95      minify: true,
96      sourcemap: false,
97      cssCodeSplit: false,
98      assetsInlineLimit: 4096,
99    },
100    resolve: {
101      alias: {
102        $lib: resolve(__dirname, "src/lib"),
103        $components: resolve(__dirname, "src/components"),
104      },
105    },
106  });
107}
108
109// Export config for specified page or default to homepage
110// Use VITE_PAGE=homepage or VITE_PAGE=blocked to select
111export 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