hexo-theme-shokax 0.5.0-dev-5c5076b → 0.5.0-dev-f96faf9

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 CHANGED
@@ -5,12 +5,11 @@
5
5
  - [x] 移除 pjax
6
6
  - [x] 移除 quicklink
7
7
  - [x] 移除 assetUrl 为基的动态 Vendor 机制
8
- - [ ] 移除 ShokaX Inject
8
+ - [x] 移除 ShokaX Inject
9
9
  - [ ] 引入新的 Inject 类技术 (长期)
10
10
  - [ ] 引入新的工作流程
11
- - [ ] 引入 CI 自动测试
12
- - [ ] 进行组件化重构 & 引入 Vue
13
11
  - [ ] 重构 player (暂时移除)
12
+ - [ ] 重构并修改代码块
14
13
  - [ ] 优化 menu 配置格式
15
14
  - [ ] 优化和异步化 Smart Bundle 技术
16
15
  - [ ] 优化 CSS 结构和加载
package/_config.yml CHANGED
@@ -34,11 +34,15 @@ experiments:
34
34
  enablePreload: true #是否开启预加载头图
35
35
  enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面
36
36
  copyrightLength: 50 # 自定义复制时显示copyright的长度
37
+ antiFakeWebsite: true # 防止恶意网站伪装
37
38
 
38
39
  homeConfig:
39
40
  gradient: false # 使用CSS渐变作为文章封面
40
- # fixedCover 性能比默认的更好,且开启时将启用LCP优化和预加载 TODO
41
+ # fixedCover 性能比默认的更好,且开启时将启用LCP优化和预加载
41
42
  fixedCover: "" # 主页面cover(为空则使用bing随机图片)
43
+ cateCards:
44
+ - slug: # 分类 slug
45
+ cover: # 分类封面
42
46
 
43
47
  # ShokaX 模块化分包引入设置
44
48
  # 请关闭所有不使用的模块以优化主题 js 体积和性能
@@ -202,12 +206,12 @@ waline:
202
206
  lang: "zh-CN"
203
207
  locale: {} # https://waline.js.org/guide/features/i18n.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AF%AD%E8%A8%80
204
208
  emoji: # 表情包
205
- - https://unpkg.com/@waline/emojis@1.0.1/weibo
206
- - https://unpkg.com/@waline/emojis@1.0.1/alus
207
- - https://unpkg.com/@waline/emojis@1.0.1/bilibili
208
- - https://unpkg.com/@waline/emojis@1.0.1/qq
209
- - https://unpkg.com/@waline/emojis@1.0.1/tieba
210
- - https://unpkg.com/@waline/emojis@1.0.1/tw-emoji
209
+ # - https://unpkg.com/@waline/emojis@1.0.1/weibo
210
+ # - https://unpkg.com/@waline/emojis@1.0.1/alus
211
+ # - https://unpkg.com/@waline/emojis@1.0.1/bilibili
212
+ # - https://unpkg.com/@waline/emojis@1.0.1/qq
213
+ # - https://unpkg.com/@waline/emojis@1.0.1/tieba
214
+ # - https://unpkg.com/@waline/emojis@1.0.1/tw-emoji
211
215
  meta: # 可以填写的内容
212
216
  - nick
213
217
  - mail
@@ -221,12 +225,13 @@ waline:
221
225
 
222
226
  summary:
223
227
  enable: false
224
- introduce: "我是基于ChatGPT-turbo-3.5实现的AI助手,在此网站上负责整理和概括文章" # AI自我介绍
225
- mode: openai # openai/custom
226
- pricing: "trial" # trial为试用模板(3 RPM);pay为即用即付模板(60 RPM)
227
- openai:
228
- remote: "https://api.openai.com"
229
- apikey: "key"
228
+ introduce: "" # AI自我介绍
229
+ model:
230
+ apiKey:
231
+ apiUrl:
232
+ temperature:
233
+ initalPrompt:
234
+ concurrency: 5
230
235
 
231
236
  # Social Links
232
237
  # Usage: `Key: permalink || icon || color`
package/languages/en.yml CHANGED
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "Powered by %s"
68
68
  total_views: Total Views
69
69
  total_visitors: Total Visitors
70
+ loading: "Loading..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ", "
110
111
  period: ". "
111
112
  colon: ": "
113
+ space: " "
112
114
  year: "Y"
113
115
  month: "M"
114
116
 
package/languages/ja.yml CHANGED
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "Powered by %s"
68
68
  total_views: 閲覧合計数
69
69
  total_visitors: 合計閲覧者数
70
+ loading: "ローディング..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: "、"
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基于 %s"
68
68
  total_views: 总访问量
69
69
  total_visitors: 总访客量
70
+ loading: "加载中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基於 %s"
68
68
  total_views: 總瀏覽次數
69
69
  total_visitors: 訪客總數
70
+ loading: "載入中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基於 %s"
68
68
  total_views: 總瀏覽次數
69
69
  total_visitors: 訪客總數
70
+ loading: "載入中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -1,5 +1,5 @@
1
1
  mixin CardRender(item)
2
- - cover = url_for(theme.statics + item.slug + '/cover.jpg')
2
+ - cover = url_for(theme.statics + item.slug + this.getCoverExt(item.slug))
3
3
  - itemname = item.name
4
4
 
5
5
  section(class="item")
@@ -14,9 +14,11 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
14
14
  if enablePreload && enableCover
15
15
  if enableFixedCover
16
16
  link(rel="preload" href=theme.homeConfig.fixedCover as="image" fetchpriority="high")
17
- else
17
+ else if Array.isArray(covers)
18
18
  each image in covers
19
- link(rel="preload" href=image as="image" fetchpriority="high")
19
+ link(rel="preload" href!=image as="image" fetchpriority="high")
20
+ else
21
+ link(rel="preload" href!=covers as="image" fetchpriority="high")
20
22
 
21
23
  != partial('_partials/head/head_com.pug')
22
24
  != shokax_inject('head')
@@ -89,11 +91,13 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
89
91
  else
90
92
  - audioValue = "undefined"
91
93
 
94
+ - var ccIcon = '<i class="ic i-creative-commons"></i>'
95
+ - var ccText = theme.creative_commons.license.toUpperCase()
92
96
  script(data-config type="text/javascript").
93
97
  var LOCAL = {
94
98
  ispost: !{is_post()},
95
- path: `#{_permapath(page.path)}`,
96
- favicon: {
99
+ path: `#{_permapath(page.path)}`,
100
+ favicon: {
97
101
  show: `#{__('favicon.show')}`,
98
102
  hide: `#{__('favicon.hide')}`
99
103
  },
@@ -102,6 +106,8 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
102
106
  empty: "!{__('search.empty')}",
103
107
  stats: "!{__('search.stats')}"
104
108
  },
109
+ nocopy: "!{!!page.nocopy}",
110
+ copyright: `!{page.copyright !== false ? (page.nocopy === true ? __("tips.nocopy") : __("tips.copyright", ccIcon + ccText)) : undefined}`,
105
111
  copy_tex: #{!!page.math},
106
112
  katex: #{!!page.math},
107
113
  mermaid: #{!!page.mermaid},
@@ -137,4 +143,3 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
137
143
  != shokax_inject('bodyEnd')
138
144
 
139
145
 
140
-
@@ -1,16 +1,19 @@
1
1
  div(class="meta")
2
- if date(post.date) !== date(post.updated) || time(post.date) !== time(post.updated)
3
- if theme.twikoo.enable || theme.waline.pageview
2
+ if theme.twikoo.enable || theme.waline.pageview
3
+ span(class="item")
4
4
  span(class="icon")
5
5
  i(class="ic i-eye")
6
- span 此文章已被阅读次数:
6
+ span(class="text")
7
+ !=__('footer.total_views') + __('symbol.colon')
7
8
  - var prefixedPath = post.path.startsWith('/') ? post.path : '/' + post.path
8
- span(id="twikoo_visitors" class="waline-pageview-count" data-path=prefixedPath) 正在加载...
9
+ span(id="twikoo_visitors" class="waline-pageview-count" data-path=prefixedPath)
10
+ !=__('footer.loading')
11
+ if date(post.date) !== date(post.updated) || time(post.date) !== time(post.updated)
9
12
  span(class="item")
10
13
  span(class="icon")
11
14
  i(class="ic i-calendar-check")
12
15
  span(class="text")
13
- != __('post.edited')
16
+ != __('post.edited') + __('symbol.space')
14
17
  time(title=__('post.modified') + __('symbol.colon') + full_date(post.updated) itemprop="dateModified" datetime=moment(post.updated).format())
15
18
  != date(post.updated)
16
19
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.5.0-dev-5c5076b",
3
+ "version": "0.5.0-dev-f96faf9",
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@9.5.0",
9
+ "packageManager": "pnpm@10.6.5",
10
10
  "scripts": {
11
11
  "test": "tsc --build --verbose",
12
12
  "build": "node ./toolbox/compiler.mjs"
@@ -16,34 +16,40 @@
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.8.6",
20
- "@typescript-eslint/eslint-plugin": "^8.12.2",
21
- "@typescript-eslint/parser": "^8.12.2",
22
- "eslint": "^9.13.0",
19
+ "@types/node": "^22.13.10",
20
+ "@types/quicklink": "^2.3.4",
21
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
22
+ "@typescript-eslint/parser": "^8.27.0",
23
+ "eslint": "^9.22.0",
23
24
  "eslint-config-standard": "~17",
24
- "eslint-plugin-vue": "^9.30.0",
25
- "glob": "^11.0.0",
26
- "typescript": "^5.6.3"
25
+ "eslint-plugin-vue": "^10.0.0",
26
+ "glob": "^11.0.1",
27
+ "typescript": "^5.8.2"
27
28
  },
28
29
  "dependencies": {
29
- "@algolia/client-search": "^5.12.0",
30
- "@waline/client": "^3.3.2",
31
- "algoliasearch": "5.12.0",
32
- "esbuild": "^0.24.0",
30
+ "@algolia/client-search": "^5.21.0",
31
+ "@common.js/p-limit": "^6.1.0",
32
+ "@waline/client": "^3.5.6",
33
+ "algoliasearch": "5.21.0",
34
+ "dompurify": "^3.2.4",
35
+ "es-toolkit": "^1.33.0",
36
+ "esbuild": "^0.25.1",
33
37
  "hexo": "^7.3.0",
34
38
  "hexo-algoliasearch": "^2.0.1",
35
39
  "hexo-feed": "^1.1.2",
36
- "hexo-fs": "^4.1.3",
40
+ "hexo-fs": "^5.0.0",
37
41
  "hexo-pagination": "^4.0.0",
38
42
  "hexo-renderer-pug": "^3.0.0",
39
43
  "hexo-util": "^3.3.0",
40
- "instantsearch.js": "^4.75.3",
44
+ "instantsearch.js": "^4.78.0",
41
45
  "js-yaml": "^4.1.0",
42
- "katex": "^0.16.11",
43
- "mouse-firework": "^0.0.6",
44
- "theme-shokax-anime": "^0.0.7",
45
- "twikoo": "^1.6.39",
46
- "unlazy": "^0.11.3"
46
+ "katex": "^0.16.21",
47
+ "mouse-firework": "^0.1.1",
48
+ "quicklink": "^2.3.0",
49
+ "theme-shokax-anime": "^0.0.8",
50
+ "theme-shokax-pjax": "^0.0.3",
51
+ "twikoo": "^1.6.41",
52
+ "unlazy": "^0.12.3"
47
53
  },
48
54
  "engines": {
49
55
  "node": ">=20.0.0"
@@ -60,6 +66,10 @@
60
66
  "object.fromentries": "npm:@nolyfill/object.fromentries@latest",
61
67
  "object.groupby": "npm:@nolyfill/object.groupby@latest",
62
68
  "object.values": "npm:@nolyfill/object.values@latest"
63
- }
69
+ },
70
+ "onlyBuiltDependencies": [
71
+ "esbuild",
72
+ "hexo-util"
73
+ ]
64
74
  }
65
75
  }
@@ -22,10 +22,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  var import_hexo_util = require("hexo-util");
25
- var import_node_fs = __toESM(require("node:fs"));
25
+ var import_promises = __toESM(require("node:fs/promises"));
26
26
  var import_path = __toESM(require("path"));
27
27
  var import_js_yaml = __toESM(require("js-yaml"));
28
- hexo.extend.filter.register("before_generate", () => {
28
+ hexo.extend.filter.register("before_generate", async () => {
29
29
  if (hexo.config.theme_config) {
30
30
  hexo.theme.config = (0, import_hexo_util.deepMerge)(hexo.theme.config, hexo.config.theme_config);
31
31
  }
@@ -44,20 +44,25 @@ hexo.extend.filter.register("before_generate", () => {
44
44
  hexo.theme.config.style = {};
45
45
  for (const style of ["iconfont", "colors", "custom"]) {
46
46
  const custom_file = "source/_data/" + style + ".styl";
47
- if (import_node_fs.default.existsSync(custom_file)) {
47
+ try {
48
+ await import_promises.default.readFile(custom_file);
48
49
  hexo.theme.config.style[style] = import_path.default.resolve(hexo.base_dir, custom_file);
50
+ } catch {
49
51
  }
50
52
  }
51
53
  if (data.images && data.images.length > 0) {
52
54
  hexo.theme.config.image_list = data.images;
53
55
  } else {
54
- hexo.theme.config.image_list = import_js_yaml.default.load(import_node_fs.default.readFileSync(import_path.default.join(__dirname, "../../_images.yml"), { encoding: "utf-8" }));
56
+ hexo.theme.config.image_list = import_js_yaml.default.load(await import_promises.default.readFile(import_path.default.join(__dirname, "../../_images.yml"), { encoding: "utf-8" }));
55
57
  }
56
58
  if (data.images_index && data.images_index.length > 0) {
57
59
  hexo.theme.config.index_images = data.images_index;
58
- } else if (import_node_fs.default.existsSync(import_path.default.join(__dirname, "../../_images_index.yml"))) {
59
- hexo.theme.config.index_images = import_js_yaml.default.load(import_node_fs.default.readFileSync(import_path.default.join(__dirname, "../../_images_index.yml"), { encoding: "utf-8" }));
60
60
  } else {
61
- hexo.theme.config.index_images = data.index_images || [];
61
+ try {
62
+ const fileContent = await import_promises.default.readFile(import_path.default.join(__dirname, "../../_images_index.yml"), "utf-8");
63
+ hexo.theme.config.index_images = import_js_yaml.default.load(fileContent);
64
+ } catch (e) {
65
+ hexo.theme.config.index_images = data.index_images || [];
66
+ }
62
67
  }
63
68
  });
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
- const fs = require("hexo-fs");
3
- hexo.extend.generator.register("images", function(locals) {
2
+ var import_promises = require("node:fs/promises");
3
+ hexo.extend.generator.register("images", async function(locals) {
4
4
  const theme = hexo.theme.config;
5
5
  const dir = "source/_data/" + theme.assets + "/";
6
- if (!fs.existsSync(dir)) {
6
+ try {
7
+ await (0, import_promises.readdir)(dir);
8
+ } catch (e) {
7
9
  return;
8
10
  }
9
11
  const result = [];
10
- const files = fs.listDirSync(dir);
11
- files.forEach((file) => {
12
+ const files = await (0, import_promises.readdir)(dir);
13
+ files.forEach(async (file) => {
14
+ const fileContent = await (0, import_promises.readFile)(dir + file);
12
15
  result.push({
13
16
  path: theme.assets + "/" + file,
14
- data: function() {
15
- return fs.createReadStream(dir + file);
16
- }
17
+ data: fileContent
17
18
  });
18
19
  });
19
20
  return result;
@@ -21,12 +21,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
22
  mod
23
23
  ));
24
+ var import_promises = require("node:fs/promises");
24
25
  var import_hexo_pagination = __toESM(require("hexo-pagination"));
25
- const fs = require("hexo-fs");
26
+ function getFileExtension(path) {
27
+ const filename = path.split(/[\\/]/).pop() || "";
28
+ const lastDotIndex = filename.lastIndexOf(".");
29
+ return lastDotIndex > 0 ? filename.slice(lastDotIndex + 1) : "";
30
+ }
26
31
  hexo.config.index_generator = Object.assign({
27
32
  per_page: typeof hexo.config.per_page === "undefined" ? 10 : hexo.config.per_page,
28
33
  order_by: "-date"
29
34
  }, hexo.config.index_generator);
35
+ hexo.extend.helper.register("getCoverExt", function(path) {
36
+ if (theme.homeConfig.cateCards.length > 0) {
37
+ const cardMap = /* @__PURE__ */ new Map();
38
+ theme.homeConfig.cateCards.forEach((card) => {
39
+ cardMap.set(card.slug, card.cover);
40
+ });
41
+ if (cardMap.has(path)) {
42
+ const cover = cardMap.get(path);
43
+ return getFileExtension(cover);
44
+ }
45
+ }
46
+ });
30
47
  hexo.extend.generator.register("index", function(locals) {
31
48
  const covers = [];
32
49
  const catlist = [];
@@ -37,6 +54,7 @@ hexo.extend.generator.register("index", function(locals) {
37
54
  const paginationDir = config.pagination_dir || "page";
38
55
  const path = config.index_generator.path || "";
39
56
  const categories = locals.categories;
57
+ const theme2 = hexo.theme.config;
40
58
  const getTopcat = function(cat) {
41
59
  if (cat.parent) {
42
60
  const pCat = categories.findOne({ _id: cat.parent });
@@ -46,48 +64,40 @@ hexo.extend.generator.register("index", function(locals) {
46
64
  }
47
65
  };
48
66
  if (categories && categories.length) {
49
- categories.forEach((cat) => {
67
+ categories.forEach(async (cat) => {
50
68
  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
- }
69
+ if (theme2.homeConfig.cateCards.length > 0) {
70
+ const cardMap = /* @__PURE__ */ new Map();
71
+ theme2.homeConfig.cateCards.forEach((card) => {
72
+ cardMap.set(card.slug, card.cover);
57
73
  });
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");
74
+ if (cardMap.has(cat.slug)) {
75
+ const cover2 = cardMap.get(cat.slug);
76
+ const coverData = await (0, import_promises.readFile)(`source/_posts/${cover2}`);
77
+ covers.push({
78
+ path: `${cat.slug}/cover.${getFileExtension(cover2)}`,
79
+ data: coverData
80
+ });
81
+ const topcat = getTopcat(cat);
82
+ if (topcat._id !== cat._id) {
83
+ cat.top = topcat;
63
84
  }
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());
85
+ const child = categories.find({ parent: cat._id });
86
+ let pl = 6;
87
+ if (child.length !== 0) {
88
+ cat.child = child.length;
89
+ cat.subs = child.sort({ name: 1 }).limit(6).toArray();
90
+ pl = Math.max(0, pl - child.length);
91
+ if (pl > 0) {
92
+ cat.subs.push(...cat.posts.sort({ title: 1 }).filter(function(item, i) {
93
+ return item.categories.last()._id === cat._id;
94
+ }).limit(pl).toArray());
95
+ }
96
+ } else {
97
+ cat.subs = cat.posts.sort({ title: 1 }).limit(6).toArray();
86
98
  }
87
- } else {
88
- cat.subs = cat.posts.sort({ title: 1 }).limit(6).toArray();
99
+ catlist.push(cat);
89
100
  }
90
- catlist.push(cat);
91
101
  }
92
102
  });
93
103
  }
@@ -21,10 +21,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  mod
22
22
  ));
23
23
  var import_package = __toESM(require("../../package.json"));
24
- var import_node_fs = __toESM(require("node:fs"));
24
+ var import_promises = __toESM(require("node:fs/promises"));
25
25
  var import_esbuild = require("esbuild");
26
26
  var import_utils = require("../utils");
27
- hexo.extend.generator.register("script", function(locals) {
27
+ hexo.extend.generator.register("script", async function(locals) {
28
28
  const config = hexo.config;
29
29
  const theme = hexo.theme.config;
30
30
  const siteConfig = {
@@ -39,10 +39,6 @@ hexo.extend.generator.register("script", function(locals) {
39
39
  darkmode: theme.darkmode,
40
40
  auto_dark: theme.auto_dark,
41
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
42
  css: {
47
43
  katex: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.katex),
48
44
  mermaid: {
@@ -93,14 +89,15 @@ hexo.extend.generator.register("script", function(locals) {
93
89
  siteConfig.audio = theme.audio;
94
90
  }
95
91
  let enterPoint, patchDir;
96
- if (import_node_fs.default.existsSync("themes/shokaX/source/js/_app/pjax/siteInit.ts")) {
97
- patchDir = "themes/shokaX/source/js/_app/components/cloudflare.ts";
92
+ try {
93
+ await import_promises.default.readFile("themes/shokaX/source/js/_app/pjax/siteInit.ts", "utf-8");
98
94
  enterPoint = "themes/shokaX/source/js/_app/pjax/siteInit.ts";
99
- } else {
100
- patchDir = "node_modules/hexo-theme-shokax/source/js/_app/components/cloudflare.ts";
95
+ patchDir = "themes/shokaX/source/js/_app/components/cloudflare.ts";
96
+ } catch (e) {
101
97
  enterPoint = "node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.ts";
98
+ patchDir = "node_modules/hexo-theme-shokax/source/js/_app/components/cloudflare.ts";
102
99
  }
103
- (0, import_esbuild.buildSync)({
100
+ await (0, import_esbuild.build)({
104
101
  entryPoints: [enterPoint],
105
102
  bundle: true,
106
103
  outdir: "shokaxTemp",
@@ -133,40 +130,33 @@ hexo.extend.generator.register("script", function(locals) {
133
130
  __shokax_fancybox__: theme.modules.fancybox ? "true" : "false",
134
131
  __shokax_waline__: theme.waline.enable ? "true" : "false",
135
132
  __shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
133
+ __shokax_antiFakeWebsite__: theme.experiments.antiFakeWebsite ? "true" : "false",
136
134
  shokax_CONFIG: JSON.stringify(siteConfig),
137
135
  shokax_siteURL: "'" + config.url + "'"
138
136
  }
139
137
  });
140
138
  const res = [];
141
- import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
142
- const fileText = import_node_fs.default.readFileSync(`./shokaxTemp/${file}`, { encoding: "utf-8" });
143
- if (file.endsWith("js")) {
144
- const result = hexo.render.renderSync({ text: fileText, engine: "js" });
139
+ (await import_promises.default.readdir("shokaxTemp")).forEach(async (file) => {
140
+ const fileContent = await import_promises.default.readFile("shokaxTemp/" + file);
141
+ if (file.endsWith(".js")) {
145
142
  res.push({
146
143
  path: theme.js + "/" + file,
147
- data: function() {
148
- return result;
149
- }
144
+ data: fileContent
150
145
  });
151
- } else if (file.endsWith("css")) {
152
- const result = hexo.render.renderSync({ text: fileText, engine: "css" });
146
+ } else if (file.endsWith(".css")) {
153
147
  res.push({
154
148
  path: theme.css + "/" + file,
155
- data: function() {
156
- return result;
157
- }
149
+ data: fileContent
158
150
  });
159
151
  } else {
160
152
  res.push({
161
- path: theme.js + "/" + file,
162
- data: function() {
163
- return fileText;
164
- }
153
+ path: theme.statics + "/" + file,
154
+ data: fileContent
165
155
  });
166
156
  }
167
157
  });
168
158
  if (theme.experiments.cloudflarePatch) {
169
- const result = (0, import_esbuild.buildSync)({
159
+ await (0, import_esbuild.build)({
170
160
  entryPoints: [patchDir],
171
161
  bundle: true,
172
162
  platform: "browser",
@@ -186,9 +176,7 @@ hexo.extend.generator.register("script", function(locals) {
186
176
  });
187
177
  res.push({
188
178
  path: theme.js + "/cf-patch.js",
189
- data: function() {
190
- return import_node_fs.default.readFileSync("./cf-patch.js", { encoding: "utf-8" });
191
- }
179
+ data: await import_promises.default.readFile("cf-patch.js")
192
180
  });
193
181
  }
194
182
  return res;