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.
@@ -1,105 +0,0 @@
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
- };