hexo-theme-shokax 0.5.0-beta1 → 0.5.0-beta2-dev-9b68cc1
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/README.md +0 -1
- package/_config.yml +0 -8
- package/layout/_mixin/comment.pug +1 -0
- package/layout/_partials/footer.pug +3 -0
- package/layout/_partials/header.pug +1 -0
- package/layout/_partials/layout.pug +3 -1
- package/layout/_partials/post/footer.pug +2 -0
- package/layout/_partials/post/post.pug +2 -0
- package/layout/_partials/sidebar/overview.pug +2 -0
- package/package.json +16 -16
- package/scripts/generaters/script.js +14 -13
- package/scripts/generaters/summary_ai.js +1 -0
- package/scripts/helpers/engine.js +3 -0
- package/scripts/plugin/index.js +24 -0
- package/scripts/plugin/lib/injects-point.js +40 -0
- package/scripts/plugin/lib/injects.js +105 -0
- package/source/js/_app/player.ts +1 -1
package/README.md
CHANGED
package/_config.yml
CHANGED
@@ -354,10 +354,6 @@ vendors:
|
|
354
354
|
cdns:
|
355
355
|
cdnjs: https://s4.zstatic.net/ajax/libs
|
356
356
|
js:
|
357
|
-
pace:
|
358
|
-
source: cdnjs
|
359
|
-
url: pace/1.2.4/pace.min.js
|
360
|
-
sri: "sha384-k6YtvFUEIuEFBdrLKJ3YAUbBki333tj1CSUisai5Cswsg9wcLNaPzsTHDswp4Az8"
|
361
357
|
jquery:
|
362
358
|
source: cdnjs
|
363
359
|
url: jquery/3.5.1/jquery.min.js
|
@@ -388,10 +384,6 @@ vendors:
|
|
388
384
|
source: cdnjs
|
389
385
|
url: KaTeX/0.16.9/katex.min.css
|
390
386
|
sri: "sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV"
|
391
|
-
comment:
|
392
|
-
source: local
|
393
|
-
url: css/comment.css
|
394
|
-
sri: ""
|
395
387
|
fancybox:
|
396
388
|
source: cdnjs
|
397
389
|
url: fancybox/3.5.7/jquery.fancybox.min.css
|
@@ -37,4 +37,7 @@ div(class="status")
|
|
37
37
|
a(target="_blank" href=`https://beian.mps.gov.cn/#/query/webSearch?code=${RC}`)
|
38
38
|
img(loading="lazy" decoding="async" src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;" width="20" height="20" alt="备案")
|
39
39
|
!= beianN
|
40
|
+
!= shokax_inject('status')
|
41
|
+
|
42
|
+
!= shokax_inject('footer')
|
40
43
|
|
@@ -21,6 +21,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
21
21
|
link(rel="preload" href!=covers as="image" fetchpriority="high")
|
22
22
|
|
23
23
|
!= partial('_partials/head/head_com.pug')
|
24
|
+
!= shokax_inject('head')
|
24
25
|
block head
|
25
26
|
title
|
26
27
|
block title
|
@@ -130,7 +131,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
130
131
|
!= partial('_partials/third-party/clarity.pug', {}, {cache: true})
|
131
132
|
!= partial('_partials/third-party/google-analytics.pug', {}, {cache: true})
|
132
133
|
|
133
|
-
!= vendor_js('pace')
|
134
134
|
!= vendor_js('jquery')
|
135
135
|
!= vendor_js('justifiedGallery')
|
136
136
|
!= vendor_js('fancybox')
|
@@ -140,4 +140,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
140
140
|
|
141
141
|
!= _js('siteInit.js')
|
142
142
|
|
143
|
+
!= shokax_inject('bodyEnd')
|
144
|
+
|
143
145
|
|
@@ -36,5 +36,7 @@ div(class="social")
|
|
36
36
|
- var sidebarIcon = '<i class="ic i-' + link.split('||')[1].trim() + '"></i>'
|
37
37
|
!= _url(sidebarURL, sidebarIcon, {title: sidebarURL, class: 'item ' + name})
|
38
38
|
|
39
|
+
!= shokax_inject('sidebar')
|
40
|
+
|
39
41
|
div(class="menu")
|
40
42
|
!= partial('_partials/sidebar/menu.pug')
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.5.0-
|
3
|
+
"version": "0.5.0-beta2-dev-9b68cc1",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
|
7
7
|
"author": "zkz098",
|
8
8
|
"license": "AGPL-3.0-or-later",
|
9
|
-
"packageManager": "pnpm@10.
|
9
|
+
"packageManager": "pnpm@10.8.0",
|
10
10
|
"scripts": {
|
11
11
|
"test": "tsc --build --verbose",
|
12
12
|
"build": "node ./toolbox/compiler.mjs"
|
@@ -16,24 +16,24 @@
|
|
16
16
|
"@types/jquery": "^3.5.32",
|
17
17
|
"@types/js-yaml": "^4.0.9",
|
18
18
|
"@types/katex": "^0.16.7",
|
19
|
-
"@types/node": "^22.
|
19
|
+
"@types/node": "^22.14.0",
|
20
20
|
"@types/quicklink": "^2.3.4",
|
21
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
22
|
-
"@typescript-eslint/parser": "^8.
|
23
|
-
"eslint": "^9.
|
21
|
+
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
22
|
+
"@typescript-eslint/parser": "^8.29.1",
|
23
|
+
"eslint": "^9.24.0",
|
24
24
|
"eslint-config-standard": "~17",
|
25
25
|
"eslint-plugin-vue": "^10.0.0",
|
26
26
|
"glob": "^11.0.1",
|
27
|
-
"typescript": "^5.8.
|
27
|
+
"typescript": "^5.8.3"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"@algolia/client-search": "^5.
|
30
|
+
"@algolia/client-search": "^5.23.3",
|
31
31
|
"@common.js/p-limit": "^6.1.0",
|
32
32
|
"@waline/client": "^3.5.6",
|
33
|
-
"algoliasearch": "5.
|
34
|
-
"dompurify": "^3.2.
|
35
|
-
"es-toolkit": "^1.
|
36
|
-
"esbuild": "^0.25.
|
33
|
+
"algoliasearch": "5.23.3",
|
34
|
+
"dompurify": "^3.2.5",
|
35
|
+
"es-toolkit": "^1.34.1",
|
36
|
+
"esbuild": "^0.25.2",
|
37
37
|
"hexo": "^7.3.0",
|
38
38
|
"hexo-algoliasearch": "^2.0.1",
|
39
39
|
"hexo-feed": "^1.1.2",
|
@@ -41,14 +41,14 @@
|
|
41
41
|
"hexo-pagination": "^4.0.0",
|
42
42
|
"hexo-renderer-pug": "^3.0.0",
|
43
43
|
"hexo-util": "^3.3.0",
|
44
|
-
"instantsearch.js": "^4.78.
|
44
|
+
"instantsearch.js": "^4.78.1",
|
45
45
|
"js-yaml": "^4.1.0",
|
46
|
-
"katex": "^0.16.
|
46
|
+
"katex": "^0.16.22",
|
47
47
|
"mouse-firework": "^0.1.1",
|
48
|
-
"nyx-player": "^0.0.
|
48
|
+
"nyx-player": "^0.0.2",
|
49
49
|
"quicklink": "^2.3.0",
|
50
50
|
"theme-shokax-anime": "^0.0.8",
|
51
|
-
"twikoo": "^1.6.
|
51
|
+
"twikoo": "^1.6.42"
|
52
52
|
},
|
53
53
|
"engines": {
|
54
54
|
"node": ">=20.0.0"
|
@@ -97,7 +97,8 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
97
97
|
enterPoint = "node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.ts";
|
98
98
|
patchDir = "node_modules/hexo-theme-shokax/source/js/_app/components/cloudflare.ts";
|
99
99
|
}
|
100
|
-
await (0, import_esbuild.build)({
|
100
|
+
const resultApp = await (0, import_esbuild.build)({
|
101
|
+
write: false,
|
101
102
|
entryPoints: [enterPoint],
|
102
103
|
bundle: true,
|
103
104
|
outdir: "shokaxTemp",
|
@@ -134,27 +135,27 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
134
135
|
}
|
135
136
|
});
|
136
137
|
const res = [];
|
137
|
-
|
138
|
-
|
139
|
-
if (file.endsWith(".js")) {
|
138
|
+
resultApp.outputFiles.forEach((file) => {
|
139
|
+
if (file.path.endsWith(".js")) {
|
140
140
|
res.push({
|
141
|
-
path: theme.js + "/" + file,
|
142
|
-
data:
|
141
|
+
path: theme.js + "/" + file.path.split("/").pop(),
|
142
|
+
data: file.contents
|
143
143
|
});
|
144
|
-
} else if (file.endsWith(".css")) {
|
144
|
+
} else if (file.path.endsWith(".css")) {
|
145
145
|
res.push({
|
146
|
-
path: theme.css + "/" + file,
|
147
|
-
data:
|
146
|
+
path: theme.css + "/" + file.path.split("/").pop(),
|
147
|
+
data: file.contents
|
148
148
|
});
|
149
149
|
} else {
|
150
150
|
res.push({
|
151
|
-
path: theme.statics + "/" + file,
|
152
|
-
data:
|
151
|
+
path: theme.statics + "/" + file.path.split("/").pop(),
|
152
|
+
data: file.contents
|
153
153
|
});
|
154
154
|
}
|
155
155
|
});
|
156
156
|
if (theme.experiments.cloudflarePatch) {
|
157
|
-
await (0, import_esbuild.build)({
|
157
|
+
const resultCF = await (0, import_esbuild.build)({
|
158
|
+
write: false,
|
158
159
|
entryPoints: [patchDir],
|
159
160
|
bundle: true,
|
160
161
|
platform: "browser",
|
@@ -174,7 +175,7 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
174
175
|
});
|
175
176
|
res.push({
|
176
177
|
path: theme.js + "/cf-patch.js",
|
177
|
-
data:
|
178
|
+
data: resultCF.outputFiles[0].contents
|
178
179
|
});
|
179
180
|
}
|
180
181
|
return res;
|
@@ -90,6 +90,7 @@ class SummaryDatabase {
|
|
90
90
|
if (this.data.summaries[pathHash]?.sha256 === contentHash) {
|
91
91
|
return this.data.summaries[pathHash].summary;
|
92
92
|
} else {
|
93
|
+
hexo.log.info(`[ShokaX Summary AI] \u6B63\u5728\u5411 API \u8BF7\u6C42 ${path} \u7684\u6458\u8981`);
|
93
94
|
const summaryContent = await getSummaryByAPI(content);
|
94
95
|
this.data.summaries[pathHash] = {
|
95
96
|
summary: summaryContent,
|
@@ -65,6 +65,9 @@ const randomBG = function(count = 1, image_server = null, image_list = []) {
|
|
65
65
|
}
|
66
66
|
return parseImage(image_list[Math.floor(Math.random() * image_list.length)], "mw690");
|
67
67
|
};
|
68
|
+
hexo.extend.helper.register("shokax_inject", function(point) {
|
69
|
+
return hexo.theme.config.injects[point].map((item) => this.partial(item.layout, item.locals, item.options)).join("");
|
70
|
+
});
|
68
71
|
hexo.extend.helper.register("preloadjs", function() {
|
69
72
|
const { statics, js } = hexo.theme.config;
|
70
73
|
let res = "";
|
package/scripts/plugin/index.js
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
9
|
+
for (let key of __getOwnPropNames(from))
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
12
|
+
}
|
13
|
+
return to;
|
14
|
+
};
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
1
23
|
var import_package = require("../../package.json");
|
2
24
|
var import_promises = require("node:fs/promises");
|
25
|
+
var import_injects = __toESM(require("./lib/injects"));
|
3
26
|
hexo.on("generateBefore", async () => {
|
27
|
+
(0, import_injects.default)(hexo);
|
4
28
|
await (0, import_promises.rm)("./shokaxTemp", { force: true, recursive: true });
|
5
29
|
try {
|
6
30
|
await (0, import_promises.unlink)("cf-patch.js");
|
@@ -0,0 +1,40 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var injects_point_exports = {};
|
19
|
+
__export(injects_point_exports, {
|
20
|
+
default: () => injects_point_default
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(injects_point_exports);
|
23
|
+
var injects_point_default = {
|
24
|
+
views: [
|
25
|
+
"head",
|
26
|
+
"sidebar",
|
27
|
+
"rightNav",
|
28
|
+
"postMeta",
|
29
|
+
"postBodyEnd",
|
30
|
+
"footer",
|
31
|
+
"bodyEnd",
|
32
|
+
"comment",
|
33
|
+
"status"
|
34
|
+
],
|
35
|
+
styles: [
|
36
|
+
"variable",
|
37
|
+
"mixin",
|
38
|
+
"style"
|
39
|
+
]
|
40
|
+
};
|
@@ -0,0 +1,105 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
var injects_exports = {};
|
29
|
+
__export(injects_exports, {
|
30
|
+
default: () => injects_default
|
31
|
+
});
|
32
|
+
module.exports = __toCommonJS(injects_exports);
|
33
|
+
var import_node_fs = __toESM(require("node:fs"));
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
35
|
+
var import_injects_point = __toESM(require("./injects-point"));
|
36
|
+
/*!
|
37
|
+
inject.js in next-theme/hexo-theme-next by next-theme
|
38
|
+
under GNU AFFERO GENERAL PUBLIC LICENSE v3.0 OR LATER
|
39
|
+
https://github.com/next-theme/hexo-theme-next/blob/master/LICENSE.md
|
40
|
+
*/
|
41
|
+
const defaultExtname = ".pug";
|
42
|
+
class StylusInject {
|
43
|
+
files;
|
44
|
+
base_dir;
|
45
|
+
constructor(base_dir) {
|
46
|
+
this.base_dir = base_dir;
|
47
|
+
this.files = [];
|
48
|
+
}
|
49
|
+
push(file) {
|
50
|
+
this.files.push(import_node_path.default.resolve(this.base_dir, file));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
class ViewInject {
|
54
|
+
base_dir;
|
55
|
+
raws;
|
56
|
+
constructor(base_dir) {
|
57
|
+
this.base_dir = base_dir;
|
58
|
+
this.raws = [];
|
59
|
+
}
|
60
|
+
raw(name, raw, ...args) {
|
61
|
+
if (import_node_path.default.extname(name) === "") {
|
62
|
+
name += defaultExtname;
|
63
|
+
}
|
64
|
+
this.raws.push({ name, raw, args });
|
65
|
+
}
|
66
|
+
file(name, file, ...args) {
|
67
|
+
if (import_node_path.default.extname(name) === "") {
|
68
|
+
name += import_node_path.default.extname(file);
|
69
|
+
}
|
70
|
+
this.raw(name, import_node_fs.default.readFileSync(import_node_path.default.resolve(this.base_dir, file), "utf8"), ...args);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
function initInject(base_dir) {
|
74
|
+
const injects = {};
|
75
|
+
import_injects_point.default.styles.forEach((item) => {
|
76
|
+
injects[item] = new StylusInject(base_dir);
|
77
|
+
});
|
78
|
+
import_injects_point.default.views.forEach((item) => {
|
79
|
+
injects[item] = new ViewInject(base_dir);
|
80
|
+
});
|
81
|
+
return injects;
|
82
|
+
}
|
83
|
+
var injects_default = (hexo) => {
|
84
|
+
const injects = initInject(hexo.base_dir);
|
85
|
+
hexo.execFilterSync("theme_inject", injects);
|
86
|
+
hexo.theme.config.injects = {};
|
87
|
+
import_injects_point.default.styles.forEach((type) => {
|
88
|
+
hexo.theme.config.injects[type] = injects[type].files;
|
89
|
+
});
|
90
|
+
import_injects_point.default.views.forEach((type) => {
|
91
|
+
const configs = /* @__PURE__ */ Object.create(null);
|
92
|
+
hexo.theme.config.injects[type] = [];
|
93
|
+
injects[type].raws.forEach((injectObj, index) => {
|
94
|
+
const name = `inject/${type}/${injectObj.name}`;
|
95
|
+
hexo.theme.setView(name, injectObj.raw);
|
96
|
+
configs[name] = {
|
97
|
+
layout: name,
|
98
|
+
locals: injectObj.args[0],
|
99
|
+
options: injectObj.args[1],
|
100
|
+
order: injectObj.args[2] || index
|
101
|
+
};
|
102
|
+
});
|
103
|
+
hexo.theme.config.injects[type] = Object.values(configs).sort((x, y) => x.order - y.order);
|
104
|
+
});
|
105
|
+
};
|
package/source/js/_app/player.ts
CHANGED
@@ -10,5 +10,5 @@ export const initAudioPlayer = async function () {
|
|
10
10
|
})
|
11
11
|
})
|
12
12
|
const { initPlayer } = await import('nyx-player')
|
13
|
-
initPlayer("#player","#showBtn", urls, "#playBtn")
|
13
|
+
initPlayer("#player","#showBtn", urls, "#playBtn", "html[data-theme="dark"]", "shokax")
|
14
14
|
}
|