hexo-theme-shokax 0.5.0-beta2-dev-9b68cc1 → 0.5.0-beta2-dev-ec59668

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.5.0-beta2-dev-9b68cc1",
3
+ "version": "0.5.0-beta2-dev-ec59668",
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",
@@ -24,6 +24,7 @@ var import_package = __toESM(require("../../package.json"));
24
24
  var import_promises = __toESM(require("node:fs/promises"));
25
25
  var import_esbuild = require("esbuild");
26
26
  var import_utils = require("../utils");
27
+ var import_hexo_util = require("hexo-util");
27
28
  hexo.extend.generator.register("script", async function(locals) {
28
29
  const config = hexo.config;
29
30
  const theme = hexo.theme.config;
@@ -153,6 +154,26 @@ hexo.extend.generator.register("script", async function(locals) {
153
154
  });
154
155
  }
155
156
  });
157
+ hexo.extend.helper.register("preloadjs", function() {
158
+ const { statics, js } = hexo.theme.config;
159
+ let resultHtml = "";
160
+ res.forEach((file) => {
161
+ if (file.path.endsWith(".js")) {
162
+ resultHtml += (0, import_hexo_util.htmlTag)("link", { rel: "modulepreload", href: import_hexo_util.url_for.call(this, `${statics}${js}/${file}`) }, "");
163
+ }
164
+ });
165
+ return resultHtml;
166
+ });
167
+ hexo.extend.helper.register("load_async_css", function() {
168
+ const { statics, css } = hexo.theme.config;
169
+ let resultHtml = "";
170
+ res.forEach((file) => {
171
+ if (file.path.endsWith(".css")) {
172
+ resultHtml += (0, import_hexo_util.htmlTag)("link", { rel: "stylesheet", href: import_hexo_util.url_for.call(this, `${statics}${css}/${file}`), media: "none", onload: "this.media='all'" }, "");
173
+ }
174
+ });
175
+ return resultHtml;
176
+ });
156
177
  if (theme.experiments.cloudflarePatch) {
157
178
  const resultCF = await (0, import_esbuild.build)({
158
179
  write: false,
@@ -1,28 +1,5 @@
1
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;
15
- };
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
2
  var import_hexo_util = require("hexo-util");
25
- var import_node_fs = __toESM(require("node:fs"));
26
3
  const randomBG = function(count = 1, image_server = null, image_list = []) {
27
4
  let i;
28
5
  if (image_server) {
@@ -68,26 +45,6 @@ const randomBG = function(count = 1, image_server = null, image_list = []) {
68
45
  hexo.extend.helper.register("shokax_inject", function(point) {
69
46
  return hexo.theme.config.injects[point].map((item) => this.partial(item.layout, item.locals, item.options)).join("");
70
47
  });
71
- hexo.extend.helper.register("preloadjs", function() {
72
- const { statics, js } = hexo.theme.config;
73
- let res = "";
74
- import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
75
- if (file.endsWith(".js")) {
76
- res += (0, import_hexo_util.htmlTag)("link", { rel: "modulepreload", href: import_hexo_util.url_for.call(this, `${statics}${js}/${file}`) }, "");
77
- }
78
- });
79
- return res;
80
- });
81
- hexo.extend.helper.register("load_async_css", function() {
82
- const { statics, css } = hexo.theme.config;
83
- let res = "";
84
- import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
85
- if (file.endsWith(".css")) {
86
- res += (0, import_hexo_util.htmlTag)("link", { rel: "stylesheet", href: import_hexo_util.url_for.call(this, `${statics}${css}/${file}`), media: "none", onload: "this.media='all'" }, "");
87
- }
88
- });
89
- return res;
90
- });
91
48
  hexo.extend.helper.register("_url", function(path, text, options = {}) {
92
49
  if (!path) {
93
50
  return;
@@ -25,7 +25,6 @@ var import_promises = require("node:fs/promises");
25
25
  var import_injects = __toESM(require("./lib/injects"));
26
26
  hexo.on("generateBefore", async () => {
27
27
  (0, import_injects.default)(hexo);
28
- await (0, import_promises.rm)("./shokaxTemp", { force: true, recursive: true });
29
28
  try {
30
29
  await (0, import_promises.unlink)("cf-patch.js");
31
30
  } catch (e) {