@voidzero-dev/vitepress-theme 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +1 -0
- package/config.js +76 -0
- package/package.json +4 -2
package/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function extendConfig<T>(c: T): T
|
package/config.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
+
|
|
4
|
+
const __dirname = import.meta.dirname;
|
|
5
|
+
|
|
6
|
+
const aliases = {
|
|
7
|
+
"@assets": resolve(__dirname, "src/assets"),
|
|
8
|
+
"@components": resolve(__dirname, "src/components"),
|
|
9
|
+
"@vp-default": resolve(__dirname, "src/components/vitepress-default"),
|
|
10
|
+
"@vp-composables": resolve(
|
|
11
|
+
__dirname,
|
|
12
|
+
"src/composables/vitepress-default"
|
|
13
|
+
),
|
|
14
|
+
"@vp-support": resolve(__dirname, "src/support/vitepress-default"),
|
|
15
|
+
"@rive-app/canvas": import.meta.resolve("@rive-app/canvas")
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function extendConfig(c) {
|
|
19
|
+
const config = c;
|
|
20
|
+
|
|
21
|
+
// inject banner dismissal inline script in head
|
|
22
|
+
// so that the dismissed class is added before CSS is loaded
|
|
23
|
+
const bannerId = config.themeConfig.banner?.id;
|
|
24
|
+
if (bannerId) {
|
|
25
|
+
config.head ??= [];
|
|
26
|
+
config.head.unshift([
|
|
27
|
+
"script",
|
|
28
|
+
{},
|
|
29
|
+
`if (localStorage.getItem("banner-dismissed-${bannerId}") === 'true')
|
|
30
|
+
document.documentElement.classList.add("banner-dismissed")`,
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const v = (config.vite ??= {});
|
|
35
|
+
|
|
36
|
+
// inject fs allow so this can be linked locally
|
|
37
|
+
v.server ??= {}
|
|
38
|
+
v.server.fs ??= {}
|
|
39
|
+
v.server.fs.allow ??= []
|
|
40
|
+
v.server.fs.allow.push(__dirname)
|
|
41
|
+
|
|
42
|
+
// add riv file asset include
|
|
43
|
+
const a = (v.assetsInclude ??= []);
|
|
44
|
+
if (!Array.isArray(a)) {
|
|
45
|
+
v.assetsInclude = [a, "**/*.riv"];
|
|
46
|
+
} else {
|
|
47
|
+
a.push("**/*.riv");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// inject tailwind plugin
|
|
51
|
+
v.plugins ??= [];
|
|
52
|
+
v.plugins.unshift(tailwindcss());
|
|
53
|
+
|
|
54
|
+
// inject alias
|
|
55
|
+
v.resolve ??= {};
|
|
56
|
+
v.resolve.alias ??= {};
|
|
57
|
+
Object.assign(v.resolve.alias, aliases);
|
|
58
|
+
|
|
59
|
+
const pkg = "@voidzero-dev/vitepress-theme";
|
|
60
|
+
|
|
61
|
+
// inject optimize exclude
|
|
62
|
+
v.optimizeDeps ??= {};
|
|
63
|
+
v.optimizeDeps.exclude ??= [];
|
|
64
|
+
v.optimizeDeps.exclude.push(pkg);
|
|
65
|
+
|
|
66
|
+
// inject ssr no-external
|
|
67
|
+
v.ssr ??= {};
|
|
68
|
+
const e = (v.ssr.noExternal ??= []);
|
|
69
|
+
if (!Array.isArray(e)) {
|
|
70
|
+
if (e !== true) v.ssr.noExternal = [e, pkg];
|
|
71
|
+
} else {
|
|
72
|
+
e.push(pkg);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return c;
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voidzero-dev/vitepress-theme",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Shared VitePress theme for VoidZero projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "./src/index.ts",
|
|
8
8
|
"module": "./src/index.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"src"
|
|
10
|
+
"src",
|
|
11
|
+
"config.js",
|
|
12
|
+
"config.d.ts"
|
|
11
13
|
],
|
|
12
14
|
"sideEffects": [
|
|
13
15
|
"*.css"
|