hexo-theme-shokax 0.4.12 → 0.4.14
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.yml +4 -0
- package/layout/_partials/layout.pug +19 -15
- package/layout/_partials/post/nav.pug +5 -1
- package/package.json +3 -2
- package/scripts/filters/locals.js +41 -48
- package/scripts/filters/post.js +2 -4
- package/scripts/generaters/archive.js +121 -125
- package/scripts/generaters/config.js +61 -49
- package/scripts/generaters/images.js +17 -20
- package/scripts/generaters/index.js +111 -100
- package/scripts/generaters/pages.js +14 -14
- package/scripts/generaters/script.js +161 -153
- package/scripts/helpers/asset.js +68 -59
- package/scripts/helpers/engine.js +145 -159
- package/scripts/helpers/list_categories.js +68 -73
- package/scripts/helpers/summary_ai.js +100 -94
- package/scripts/helpers/symbols_count_time.js +43 -51
- package/scripts/libtypes.d.js +15 -0
- package/scripts/plugin/check.js +26 -27
- package/scripts/plugin/index.js +64 -73
- package/scripts/plugin/lib/injects-point.js +40 -19
- package/scripts/plugin/lib/injects.js +89 -73
- package/scripts/tags/links.js +51 -34
- package/scripts/tags/media.js +33 -16
- package/scripts/utils.js +40 -18
- package/source/js/_app/page/search.ts +2 -3
- package/toolbox/compiler.mjs +30 -24
@@ -1,107 +1,118 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
var
|
5
|
-
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
10
|
+
for (let key of __getOwnPropNames(from))
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
+
}
|
14
|
+
return to;
|
6
15
|
};
|
7
|
-
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
+
mod
|
23
|
+
));
|
24
|
+
var import_hexo_pagination = __toESM(require("hexo-pagination"));
|
8
25
|
const fs = require("hexo-fs");
|
9
|
-
const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
|
10
26
|
hexo.config.index_generator = Object.assign({
|
11
|
-
|
12
|
-
|
27
|
+
per_page: typeof hexo.config.per_page === "undefined" ? 10 : hexo.config.per_page,
|
28
|
+
order_by: "-date"
|
13
29
|
}, hexo.config.index_generator);
|
14
|
-
hexo.extend.generator.register(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return cat;
|
31
|
-
}
|
32
|
-
};
|
33
|
-
if (categories && categories.length) {
|
34
|
-
categories.forEach((cat) => {
|
35
|
-
const cover = `source/_posts/${cat.slug}`;
|
36
|
-
if (fs.existsSync(cover + '/cover.avif')) {
|
37
|
-
covers.push({
|
38
|
-
path: cat.slug + '/cover.avif',
|
39
|
-
data: function () {
|
40
|
-
return fs.createReadStream(cover + '/cover.avif');
|
41
|
-
}
|
42
|
-
});
|
43
|
-
}
|
44
|
-
else if (fs.existsSync(cover + '/cover.webp')) {
|
45
|
-
covers.push({
|
46
|
-
path: cat.slug + '/cover.webp',
|
47
|
-
data: function () {
|
48
|
-
return fs.createReadStream(cover + '/cover.webp');
|
49
|
-
}
|
50
|
-
});
|
51
|
-
}
|
52
|
-
else if (fs.existsSync(cover + '/cover.jpg')) {
|
53
|
-
covers.push({
|
54
|
-
path: cat.slug + '/cover.jpg',
|
55
|
-
data: function () {
|
56
|
-
return fs.createReadStream(cover + '/cover.jpg');
|
57
|
-
}
|
58
|
-
});
|
59
|
-
const topcat = getTopcat(cat);
|
60
|
-
if (topcat._id !== cat._id) {
|
61
|
-
cat.top = topcat;
|
62
|
-
}
|
63
|
-
const child = categories.find({ parent: cat._id });
|
64
|
-
let pl = 6;
|
65
|
-
if (child.length !== 0) {
|
66
|
-
cat.child = child.length;
|
67
|
-
cat.subs = child.sort({ name: 1 }).limit(6).toArray();
|
68
|
-
pl = Math.max(0, pl - child.length);
|
69
|
-
if (pl > 0) {
|
70
|
-
cat.subs.push(...cat.posts.sort({ title: 1 })
|
71
|
-
.filter(function (item, i) { return item.categories.last()._id === cat._id; })
|
72
|
-
.limit(pl).toArray());
|
73
|
-
}
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
cat.subs = cat.posts.sort({ title: 1 }).limit(6).toArray();
|
77
|
-
}
|
78
|
-
catlist.push(cat);
|
79
|
-
}
|
80
|
-
});
|
30
|
+
hexo.extend.generator.register("index", function(locals) {
|
31
|
+
const covers = [];
|
32
|
+
const catlist = [];
|
33
|
+
let pages;
|
34
|
+
const config = hexo.config;
|
35
|
+
const sticky = locals.posts.find({ sticky: true }).sort(config.index_generator.order_by);
|
36
|
+
const posts = locals.posts.find({ sticky: { $in: [false, void 0] } }).sort(config.index_generator.order_by);
|
37
|
+
const paginationDir = config.pagination_dir || "page";
|
38
|
+
const path = config.index_generator.path || "";
|
39
|
+
const categories = locals.categories;
|
40
|
+
const getTopcat = function(cat) {
|
41
|
+
if (cat.parent) {
|
42
|
+
const pCat = categories.findOne({ _id: cat.parent });
|
43
|
+
return getTopcat(pCat);
|
44
|
+
} else {
|
45
|
+
return cat;
|
81
46
|
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
47
|
+
};
|
48
|
+
if (categories && categories.length) {
|
49
|
+
categories.forEach((cat) => {
|
50
|
+
const cover = `source/_posts/${cat.slug}`;
|
51
|
+
if (fs.existsSync(cover + "/cover.avif")) {
|
52
|
+
covers.push({
|
53
|
+
path: cat.slug + "/cover.avif",
|
54
|
+
data: function() {
|
55
|
+
return fs.createReadStream(cover + "/cover.avif");
|
56
|
+
}
|
92
57
|
});
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
58
|
+
} else if (fs.existsSync(cover + "/cover.webp")) {
|
59
|
+
covers.push({
|
60
|
+
path: cat.slug + "/cover.webp",
|
61
|
+
data: function() {
|
62
|
+
return fs.createReadStream(cover + "/cover.webp");
|
63
|
+
}
|
64
|
+
});
|
65
|
+
} else if (fs.existsSync(cover + "/cover.jpg")) {
|
66
|
+
covers.push({
|
67
|
+
path: cat.slug + "/cover.jpg",
|
68
|
+
data: function() {
|
69
|
+
return fs.createReadStream(cover + "/cover.jpg");
|
70
|
+
}
|
71
|
+
});
|
72
|
+
const topcat = getTopcat(cat);
|
73
|
+
if (topcat._id !== cat._id) {
|
74
|
+
cat.top = topcat;
|
75
|
+
}
|
76
|
+
const child = categories.find({ parent: cat._id });
|
77
|
+
let pl = 6;
|
78
|
+
if (child.length !== 0) {
|
79
|
+
cat.child = child.length;
|
80
|
+
cat.subs = child.sort({ name: 1 }).limit(6).toArray();
|
81
|
+
pl = Math.max(0, pl - child.length);
|
82
|
+
if (pl > 0) {
|
83
|
+
cat.subs.push(...cat.posts.sort({ title: 1 }).filter(function(item, i) {
|
84
|
+
return item.categories.last()._id === cat._id;
|
85
|
+
}).limit(pl).toArray());
|
86
|
+
}
|
87
|
+
} else {
|
88
|
+
cat.subs = cat.posts.sort({ title: 1 }).limit(6).toArray();
|
89
|
+
}
|
90
|
+
catlist.push(cat);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
}
|
94
|
+
if (posts.length > 0) {
|
95
|
+
pages = (0, import_hexo_pagination.default)(path, posts, {
|
96
|
+
perPage: config.index_generator.per_page,
|
97
|
+
layout: ["index", "archive"],
|
98
|
+
format: paginationDir + "/%d/",
|
99
|
+
data: {
|
100
|
+
__index: true,
|
101
|
+
catlist,
|
102
|
+
sticky
|
103
|
+
}
|
104
|
+
});
|
105
|
+
} else {
|
106
|
+
pages = [{
|
107
|
+
path,
|
108
|
+
layout: ["index", "archive"],
|
109
|
+
data: {
|
110
|
+
__index: true,
|
111
|
+
catlist,
|
112
|
+
sticky,
|
113
|
+
current: 1
|
114
|
+
}
|
115
|
+
}];
|
116
|
+
}
|
117
|
+
return [...covers, ...pages];
|
107
118
|
});
|
@@ -1,15 +1,15 @@
|
|
1
|
-
hexo.extend.generator.register(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
hexo.extend.generator.register("pages", function() {
|
2
|
+
const config = hexo.config;
|
3
|
+
return [
|
4
|
+
{
|
5
|
+
path: config.category_dir + "/index.html",
|
6
|
+
data: { type: "categories" },
|
7
|
+
layout: "page"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
path: config.tag_dir + "/index.html",
|
11
|
+
data: { type: "tags" },
|
12
|
+
layout: "page"
|
13
|
+
}
|
14
|
+
];
|
15
15
|
});
|
@@ -1,160 +1,168 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
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;
|
4
14
|
};
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
appID: config.algolia.appId,
|
74
|
-
apiKey: config.algolia.apiKey,
|
75
|
-
indexName: config.algolia.indexName,
|
76
|
-
hits: theme.search.hits
|
77
|
-
};
|
78
|
-
}
|
79
|
-
if (theme?.audio) {
|
80
|
-
siteConfig.audio = theme.audio;
|
81
|
-
}
|
82
|
-
let enterPoint;
|
83
|
-
if (node_fs_1.default.existsSync('themes/shokaX/source/js/_app/pjax/siteInit.ts')) {
|
84
|
-
enterPoint = 'themes/shokaX/source/js/_app/pjax/siteInit.ts';
|
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
|
+
));
|
23
|
+
var import_package = __toESM(require("../../package.json"));
|
24
|
+
var import_node_fs = __toESM(require("node:fs"));
|
25
|
+
var import_esbuild = require("esbuild");
|
26
|
+
var import_utils = require("../utils");
|
27
|
+
hexo.extend.generator.register("script", function(locals) {
|
28
|
+
const config = hexo.config;
|
29
|
+
const theme = hexo.theme.config;
|
30
|
+
const siteConfig = {
|
31
|
+
version: import_package.default.version,
|
32
|
+
hostname: config.url,
|
33
|
+
root: config.root,
|
34
|
+
statics: theme.statics,
|
35
|
+
favicon: {
|
36
|
+
normal: theme.assets + "/favicon.ico",
|
37
|
+
hidden: theme.assets + "/failure.ico"
|
38
|
+
},
|
39
|
+
darkmode: theme.darkmode,
|
40
|
+
auto_dark: theme.auto_dark,
|
41
|
+
auto_scroll: theme.auto_scroll,
|
42
|
+
js: {
|
43
|
+
copy_tex: (0, import_utils.getVendorLink)(hexo, theme.vendors.async_js.copy_tex),
|
44
|
+
fancybox: (0, import_utils.getVendorLink)(hexo, theme.vendors.async_js.fancybox)
|
45
|
+
},
|
46
|
+
css: {
|
47
|
+
katex: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.katex),
|
48
|
+
mermaid: {
|
49
|
+
url: theme.css + "/mermaid.css",
|
50
|
+
local: true,
|
51
|
+
sri: ""
|
52
|
+
},
|
53
|
+
fancybox: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.fancybox),
|
54
|
+
justifiedGallery: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.justifiedGallery)
|
55
|
+
},
|
56
|
+
loader: theme.loader,
|
57
|
+
search: null,
|
58
|
+
outime: {
|
59
|
+
enable: theme.outime.enable,
|
60
|
+
days: theme.outime.days
|
61
|
+
},
|
62
|
+
quicklink: {
|
63
|
+
timeout: theme.quicklink.timeout,
|
64
|
+
priority: theme.quicklink.priority
|
65
|
+
},
|
66
|
+
playerAPI: theme.playerAPI,
|
67
|
+
audio: void 0,
|
68
|
+
fireworks: theme.fireworks && theme.fireworks.enable && theme.fireworks.options ? theme.fireworks.options : void 0,
|
69
|
+
waline: {
|
70
|
+
serverURL: theme.waline.serverURL,
|
71
|
+
lang: theme.waline.lang,
|
72
|
+
locale: theme.waline.locale,
|
73
|
+
emoji: theme.waline.emoji,
|
74
|
+
meta: theme.waline.meta,
|
75
|
+
requiredMeta: theme.waline.requiredMeta,
|
76
|
+
wordLimit: theme.waline.wordLimit,
|
77
|
+
pageSize: theme.waline.pageSize,
|
78
|
+
pageview: theme.waline.pageview
|
79
|
+
},
|
80
|
+
twikoo: {
|
81
|
+
envId: theme.twikoo.envId,
|
82
|
+
region: theme.twikoo.region
|
85
83
|
}
|
86
|
-
|
87
|
-
|
84
|
+
};
|
85
|
+
if (config?.algolia) {
|
86
|
+
siteConfig.search = {
|
87
|
+
appID: config.algolia.appId,
|
88
|
+
apiKey: config.algolia.apiKey,
|
89
|
+
indexName: config.algolia.indexName,
|
90
|
+
hits: theme.search.hits
|
91
|
+
};
|
92
|
+
}
|
93
|
+
if (theme?.audio) {
|
94
|
+
siteConfig.audio = theme.audio;
|
95
|
+
}
|
96
|
+
let enterPoint;
|
97
|
+
if (import_node_fs.default.existsSync("themes/shokaX/source/js/_app/pjax/siteInit.ts")) {
|
98
|
+
enterPoint = "themes/shokaX/source/js/_app/pjax/siteInit.ts";
|
99
|
+
} else {
|
100
|
+
enterPoint = "node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.ts";
|
101
|
+
}
|
102
|
+
(0, import_esbuild.buildSync)({
|
103
|
+
entryPoints: [enterPoint],
|
104
|
+
bundle: true,
|
105
|
+
outdir: "shokaxTemp",
|
106
|
+
tsconfigRaw: {
|
107
|
+
compilerOptions: {
|
108
|
+
target: "ES2022",
|
109
|
+
esModuleInterop: true,
|
110
|
+
module: "ESNext",
|
111
|
+
moduleResolution: "Node",
|
112
|
+
skipLibCheck: true
|
113
|
+
}
|
114
|
+
},
|
115
|
+
platform: "browser",
|
116
|
+
format: "esm",
|
117
|
+
target: ["es2022"],
|
118
|
+
minify: true,
|
119
|
+
legalComments: "linked",
|
120
|
+
mainFields: ["module", "browser", "main"],
|
121
|
+
splitting: true,
|
122
|
+
define: {
|
123
|
+
__UNLAZY_LOGGING__: "false",
|
124
|
+
__UNLAZY_HASH_DECODING__: theme.modules.unlazyHash ? "true" : "false",
|
125
|
+
__shokax_player__: theme.modules.player ? "true" : "false",
|
126
|
+
__shokax_VL__: theme.modules.visibilityListener ? "true" : "false",
|
127
|
+
__shokax_fireworks__: theme.fireworks && theme.fireworks.enable && theme.fireworks.options && theme.modules.fireworks ? "true" : "false",
|
128
|
+
__shokax_search__: config?.algolia ? "true" : "false",
|
129
|
+
__shokax_outime__: theme.outime.enable ? "true" : "false",
|
130
|
+
__shokax_tabs__: theme.modules.tabs ? "true" : "false",
|
131
|
+
__shokax_quiz__: theme.modules.quiz ? "true" : "false",
|
132
|
+
__shokax_fancybox__: theme.modules.fancybox ? "true" : "false",
|
133
|
+
__shokax_waline__: theme.waline.enable ? "true" : "false",
|
134
|
+
__shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
|
135
|
+
shokax_CONFIG: JSON.stringify(siteConfig),
|
136
|
+
shokax_siteURL: "'" + config.url + "'"
|
88
137
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
skipLibCheck: true
|
100
|
-
}
|
101
|
-
},
|
102
|
-
platform: 'browser',
|
103
|
-
format: 'esm',
|
104
|
-
target: ['es2022'],
|
105
|
-
minify: true,
|
106
|
-
legalComments: 'linked',
|
107
|
-
mainFields: ['module', 'browser', 'main'],
|
108
|
-
splitting: true,
|
109
|
-
define: {
|
110
|
-
__UNLAZY_LOGGING__: 'false',
|
111
|
-
__UNLAZY_HASH_DECODING__: theme.modules.unlazyHash ? 'true' : 'false',
|
112
|
-
__shokax_player__: theme.modules.player ? 'true' : 'false',
|
113
|
-
__shokax_VL__: theme.modules.visibilityListener ? 'true' : 'false',
|
114
|
-
__shokax_fireworks__: (theme.fireworks && theme.fireworks.enable && theme.fireworks.options && theme.modules.fireworks) ? 'true' : 'false',
|
115
|
-
__shokax_search__: config?.algolia ? 'true' : 'false',
|
116
|
-
__shokax_outime__: theme.outime.enable ? 'true' : 'false',
|
117
|
-
__shokax_tabs__: theme.modules.tabs ? 'true' : 'false',
|
118
|
-
__shokax_quiz__: theme.modules.quiz ? 'true' : 'false',
|
119
|
-
__shokax_fancybox__: theme.modules.fancybox ? 'true' : 'false',
|
120
|
-
__shokax_waline__: theme.waline.enable ? 'true' : 'false',
|
121
|
-
__shokax_twikoo__: theme.twikoo.enable ? 'true' : 'false',
|
122
|
-
shokax_CONFIG: JSON.stringify(siteConfig),
|
123
|
-
shokax_siteURL: "'" + config.url + "'"
|
124
|
-
},
|
125
|
-
alias: {
|
126
|
-
'algoliasearch/lite': 'algoliasearch/dist/algoliasearch-lite.esm.browser.js'
|
127
|
-
}
|
128
|
-
});
|
129
|
-
const res = [];
|
130
|
-
node_fs_1.default.readdirSync('./shokaxTemp').forEach((file) => {
|
131
|
-
const fileText = node_fs_1.default.readFileSync(`./shokaxTemp/${file}`, { encoding: 'utf-8' });
|
132
|
-
if (file.endsWith('js')) {
|
133
|
-
const result = hexo.render.renderSync({ text: fileText, engine: 'js' });
|
134
|
-
res.push({
|
135
|
-
path: theme.js + '/' + file,
|
136
|
-
data: function () {
|
137
|
-
return result;
|
138
|
-
}
|
139
|
-
});
|
138
|
+
});
|
139
|
+
const res = [];
|
140
|
+
import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
|
141
|
+
const fileText = import_node_fs.default.readFileSync(`./shokaxTemp/${file}`, { encoding: "utf-8" });
|
142
|
+
if (file.endsWith("js")) {
|
143
|
+
const result = hexo.render.renderSync({ text: fileText, engine: "js" });
|
144
|
+
res.push({
|
145
|
+
path: theme.js + "/" + file,
|
146
|
+
data: function() {
|
147
|
+
return result;
|
140
148
|
}
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
});
|
149
|
+
});
|
150
|
+
} else if (file.endsWith("css")) {
|
151
|
+
const result = hexo.render.renderSync({ text: fileText, engine: "css" });
|
152
|
+
res.push({
|
153
|
+
path: theme.css + "/" + file,
|
154
|
+
data: function() {
|
155
|
+
return result;
|
149
156
|
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
});
|
157
|
+
});
|
158
|
+
} else {
|
159
|
+
res.push({
|
160
|
+
path: theme.js + "/" + file,
|
161
|
+
data: function() {
|
162
|
+
return fileText;
|
157
163
|
}
|
158
|
-
|
159
|
-
|
164
|
+
});
|
165
|
+
}
|
166
|
+
});
|
167
|
+
return res;
|
160
168
|
});
|