-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
58 lines (55 loc) · 1.46 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { readFileSync } from "node:fs";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";
import monkey from "vite-plugin-monkey";
const ICON_URL = `data:image/png;base64,${readFileSync("./assets/honkoku.png").toString("base64")}`;
// https://vitejs.dev/config/
export default defineConfig({
define: {
__ICON_URL__: JSON.stringify(ICON_URL),
},
plugins: [
svelte(),
{
name: "set-headers",
apply: "serve",
configureServer(server) {
server.middlewares.use((_, res, next) => {
res.setHeader("Access-Control-Allow-Private-Network", "true");
next();
});
},
},
monkey({
entry: "src/main.ts",
userscript: {
icon: ICON_URL,
namespace: "https://mkpo.li/",
match: [
"https://honkoku.org/app/*",
// "https://ja.wikisource.org/w/index.php?title=*&action=*",
"https://ja.wikisource.org/*",
],
license: "MIT",
grant: ["GM.setValue", "GM.getValue"],
description: {
en: "Convenient tools for transcribing Japanese classical texts",
ja: "日本の古典籍をデジタル翻刻する際の便利ツール",
zh: "日本古籍數字化翻印用的便利工具集成",
ko: "日本古典文獻을 디지털化할 때 便利한 道具",
},
name: {
en: "Honkoku Tools",
ja: "翻刻ツールボックス",
zh: "翻刻工具箱",
ko: "翻刻道具箱子",
},
},
}),
],
resolve: {
alias: {
$lib: "/src/lib",
},
},
});