hexo-theme-shokax 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
package/.eslintrc.cjs ADDED
@@ -0,0 +1,30 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ env: {
4
+ browser: true,
5
+ commonjs: true,
6
+ es6: true,
7
+ node: true
8
+ },
9
+ extends: [
10
+ 'standard',
11
+ 'plugin:@typescript-eslint/recommended',
12
+ 'plugin:vue/vue3-recommended'
13
+ ],
14
+ plugins: [
15
+ '@typescript-eslint',
16
+ 'vue'
17
+ ],
18
+ parserOptions: {
19
+ ecmaVersion: 12
20
+ },
21
+ rules: {
22
+ camelcase: 'off',
23
+ 'n/no-callback-literal': 'off',
24
+ '@typescript-eslint/ban-types': 'off',
25
+ '@typescript-eslint/ban-ts-comment': 'off',
26
+ '@typescript-eslint/no-var-requires': 'off',
27
+ '@typescript-eslint/no-unused-vars': 'off',
28
+ 'prefer-const': 'warn'
29
+ }
30
+ }
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
+ 如果你访问的仓库地址是**zkz098/hexo-theme-shokaX**,请转为访问最新地址: [theme-shoka-x/hexo-theme-shokaX](https://github.com/theme-shoka-x/hexo-theme-shokaX)
2
+
1
3
  # hexo-theme-shokaX
2
4
  [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX?ref=badge_shield)
3
- ![LICENSE]( https://img.shields.io/github/license/zkz098/hexo-theme-shokaX)
4
- ![stars](https://img.shields.io/github/stars/zkz098/hexo-theme-shokaX)
5
+ ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
6
+ ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
5
7
  ![version](https://shields.io/npm/v/hexo-theme-shokax)
6
8
 
7
9
  语言(language): 简体中文 | [English](./README_en.md) \
@@ -73,4 +75,4 @@ GPL许可证主要目的是限制修改后的分发行为,避免未经许可
73
75
  [![](https://contributors-img.web.app/image?repo=zkz098/hexo-theme-shokaX)](https://github.com/zkz098/hexo-theme-shokaX/graphs/contributors)
74
76
 
75
77
  ## 特别鸣谢
76
- [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
78
+ [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/zkz098/hexo-theme-shokaX",
@@ -33,6 +33,8 @@
33
33
  "eslint-plugin-n": "^15.6.1",
34
34
  "eslint-plugin-promise": "^6.1.1",
35
35
  "eslint-plugin-vue": "^9.10.0",
36
+ "hexo-fs": "^4.1.1",
37
+ "hexo-util": "^3.0.1",
36
38
  "instantsearch.js": "^4.53.0",
37
39
  "pjax": "^0.2.8",
38
40
  "typescript": "^5.0.2",
@@ -5,13 +5,11 @@ hexo.extend.filter.register('template_locals', (locals) => {
5
5
  const { config } = hexo;
6
6
  const { __, theme } = locals;
7
7
  const { i18n } = hexo.theme;
8
- const pangu = theme.pangu
9
- ? require('pangu')
10
- : {
11
- spacing: (data) => {
12
- return data;
13
- }
14
- };
8
+ const pangu = {
9
+ spacing: (data) => {
10
+ return data;
11
+ }
12
+ };
15
13
  locals.alternate = theme.alternate;
16
14
  locals.title = pangu.spacing(__('title') !== 'title' ? __('title') : config.title);
17
15
  locals.subtitle = pangu.spacing(__('subtitle') !== 'subtitle' ? __('subtitle') : config.subtitle);
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
- const pagination = require('hexo-pagination');
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
3
7
  const fmtNum = num => {
4
8
  return num < 10 ? '0' + num : num;
5
9
  };
@@ -34,7 +38,7 @@ if (!(hexo.config.archive && hexo.config.archive.enabled === false)) {
34
38
  function generate(path, posts, options) {
35
39
  options = options || {};
36
40
  options.archive = true;
37
- result = result.concat(pagination(path, posts, {
41
+ result = result.concat((0, hexo_pagination_1.default)(path, posts, {
38
42
  perPage: path === archiveDir ? 0 : perPage,
39
43
  layout: ['archive', 'index'],
40
44
  format: paginationDir + '/%d/',
@@ -1,18 +1,22 @@
1
1
  'use strict';
2
- const merge = require('hexo-util').deepMerge || require('lodash/merge');
3
- const fs = require('hexo-fs');
4
- const path = require('path');
5
- const yaml = require('js-yaml');
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexo_util_1 = __importDefault(require("hexo-util"));
7
+ const hexo_fs_1 = __importDefault(require("hexo-fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const js_yaml_1 = __importDefault(require("js-yaml"));
6
10
  hexo.extend.filter.register('before_generate', () => {
7
11
  if (hexo.config.theme_config) {
8
- hexo.theme.config = merge(hexo.theme.config, hexo.config.theme_config);
12
+ hexo.theme.config = hexo_util_1.default.deepMerge(hexo.theme.config, hexo.config.theme_config);
9
13
  }
10
14
  const data = hexo.locals.get('data');
11
15
  if (data.languages) {
12
16
  const { i18n } = hexo.theme;
13
17
  const mergeLang = lang => {
14
18
  if (data.languages[lang]) {
15
- i18n.set(lang, merge(i18n.get([lang]), data.languages[lang]));
19
+ i18n.set(lang, hexo_util_1.default.deepMerge(i18n.get([lang]), data.languages[lang]));
16
20
  }
17
21
  };
18
22
  for (const lang of ['en', 'ja', 'zh-CN', 'zh-HK', 'zh-TW']) {
@@ -22,14 +26,14 @@ hexo.extend.filter.register('before_generate', () => {
22
26
  hexo.theme.config.style = {};
23
27
  for (const style of ['iconfont', 'colors', 'custom']) {
24
28
  const custom_file = 'source/_data/' + style + '.styl';
25
- if (fs.existsSync(custom_file)) {
26
- hexo.theme.config.style[style] = path.resolve(hexo.base_dir, custom_file);
29
+ if (hexo_fs_1.default.existsSync(custom_file)) {
30
+ hexo.theme.config.style[style] = path_1.default.resolve(hexo.base_dir, custom_file);
27
31
  }
28
32
  }
29
33
  if (data.images && data.images.length >= 6) {
30
34
  hexo.theme.config.image_list = data.images;
31
35
  }
32
36
  else {
33
- hexo.theme.config.image_list = yaml.load(fs.readFileSync(path.join(__dirname, '../../_images.yml')));
37
+ hexo.theme.config.image_list = js_yaml_1.default.load(hexo_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml')));
34
38
  }
35
39
  });
@@ -1,18 +1,22 @@
1
1
  'use strict';
2
- const fs = require('hexo-fs');
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexo_fs_1 = __importDefault(require("hexo-fs"));
3
7
  hexo.extend.generator.register('images', function (locals) {
4
8
  const theme = hexo.theme.config;
5
9
  const dir = 'source/_data/' + theme.assets + '/';
6
- if (!fs.existsSync(dir)) {
10
+ if (!hexo_fs_1.default.existsSync(dir)) {
7
11
  return;
8
12
  }
9
13
  const result = [];
10
- const files = fs.listDirSync(dir);
14
+ const files = hexo_fs_1.default.listDirSync(dir);
11
15
  files.forEach((file) => {
12
16
  result.push({
13
17
  path: theme.assets + '/' + file,
14
18
  data: function () {
15
- return fs.createReadStream(dir + file);
19
+ return hexo_fs_1.default.createReadStream(dir + file);
16
20
  }
17
21
  });
18
22
  });
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
- const fs = require('hexo-fs');
3
- const pagination = require('hexo-pagination');
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexo_fs_1 = __importDefault(require("hexo-fs"));
7
+ const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
4
8
  hexo.config.index_generator = Object.assign({
5
9
  per_page: typeof hexo.config.per_page === 'undefined' ? 10 : hexo.config.per_page,
6
10
  order_by: '-date'
@@ -27,27 +31,27 @@ hexo.extend.generator.register('index', function (locals) {
27
31
  if (categories && categories.length) {
28
32
  categories.forEach((cat) => {
29
33
  const cover = `source/_posts/${cat.slug}`;
30
- if (fs.existsSync(cover + '/cover.avif')) {
34
+ if (hexo_fs_1.default.existsSync(cover + '/cover.avif')) {
31
35
  covers.push({
32
36
  path: cat.slug + '/cover.avif',
33
37
  data: function () {
34
- return fs.createReadStream(cover + '/cover.avif');
38
+ return hexo_fs_1.default.createReadStream(cover + '/cover.avif');
35
39
  }
36
40
  });
37
41
  }
38
- else if (fs.existsSync(cover + '/cover.webp')) {
42
+ else if (hexo_fs_1.default.existsSync(cover + '/cover.webp')) {
39
43
  covers.push({
40
44
  path: cat.slug + '/cover.webp',
41
45
  data: function () {
42
- return fs.createReadStream(cover + '/cover.webp');
46
+ return hexo_fs_1.default.createReadStream(cover + '/cover.webp');
43
47
  }
44
48
  });
45
49
  }
46
- else if (fs.existsSync(cover + '/cover.jpg')) {
50
+ else if (hexo_fs_1.default.existsSync(cover + '/cover.jpg')) {
47
51
  covers.push({
48
52
  path: cat.slug + '/cover.jpg',
49
53
  data: function () {
50
- return fs.createReadStream(cover + '/cover.jpg');
54
+ return hexo_fs_1.default.createReadStream(cover + '/cover.jpg');
51
55
  }
52
56
  });
53
57
  const topcat = getTopcat(cat);
@@ -74,7 +78,7 @@ hexo.extend.generator.register('index', function (locals) {
74
78
  });
75
79
  }
76
80
  if (posts.length > 0) {
77
- pages = pagination(path, posts, {
81
+ pages = (0, hexo_pagination_1.default)(path, posts, {
78
82
  perPage: config.index_generator.per_page,
79
83
  layout: ['index', 'archive'],
80
84
  format: paginationDir + '/%d/',
@@ -1,11 +1,16 @@
1
- const fs = require('hexo-fs');
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const package_json_1 = __importDefault(require("../../package.json"));
7
+ const hexo_fs_1 = __importDefault(require("hexo-fs"));
2
8
  hexo.extend.generator.register('script', function (locals) {
3
9
  const log = hexo.log || console.log;
4
10
  const config = hexo.config;
5
11
  const theme = hexo.theme.config;
6
- const env = require('../../package.json');
7
12
  const siteConfig = {
8
- version: env.version,
13
+ version: package_json_1.default.version,
9
14
  hostname: config.url,
10
15
  root: config.root,
11
16
  statics: theme.statics,
@@ -56,27 +61,27 @@ hexo.extend.generator.register('script', function (locals) {
56
61
  }
57
62
  let text = '';
58
63
  ['library', 'global', 'page', 'vue', 'components'].forEach(function (item) {
59
- if (fs.existsSync(`themes/shokaX/source/js/_app/${item}.js`)) {
60
- text += fs.readFileSync(`themes/shokaX/source/js/_app/${item}.js`).toString();
64
+ if (hexo_fs_1.default.existsSync(`themes/shokaX/source/js/_app/${item}.js`)) {
65
+ text += hexo_fs_1.default.readFileSync(`themes/shokaX/source/js/_app/${item}.js`).toString();
61
66
  }
62
67
  else {
63
- text += fs.readFileSync(`node_modules/hexo-theme-shokax/source/js/_app/${item}.js`).toString();
68
+ text += hexo_fs_1.default.readFileSync(`node_modules/hexo-theme-shokax/source/js/_app/${item}.js`).toString();
64
69
  }
65
70
  });
66
71
  if (!theme.experiments?.noPlayer) {
67
- if (fs.existsSync('themes/shokaX/source/js/_app/player.js')) {
68
- text += fs.readFileSync('themes/shokaX/source/js/_app/player.js').toString();
72
+ if (hexo_fs_1.default.existsSync('themes/shokaX/source/js/_app/player.js')) {
73
+ text += hexo_fs_1.default.readFileSync('themes/shokaX/source/js/_app/player.js').toString();
69
74
  }
70
75
  else {
71
- text += fs.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/player.js').toString();
76
+ text += hexo_fs_1.default.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/player.js').toString();
72
77
  }
73
78
  }
74
79
  if (theme.fireworks && theme.fireworks.enable) {
75
- if (fs.existsSync('themes/shokaX/source/js/_app/fireworks.js')) {
76
- text += fs.readFileSync('themes/shokaX/source/js/_app/fireworks.js').toString();
80
+ if (hexo_fs_1.default.existsSync('themes/shokaX/source/js/_app/fireworks.js')) {
81
+ text += hexo_fs_1.default.readFileSync('themes/shokaX/source/js/_app/fireworks.js').toString();
77
82
  }
78
83
  else {
79
- text += fs.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/fireworks.js').toString();
84
+ text += hexo_fs_1.default.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/fireworks.js').toString();
80
85
  }
81
86
  siteConfig.fireworks = theme.fireworks.color || ['rgba(255,182,185,.9)', 'rgba(250,227,217,.9)', 'rgba(187,222,214,.9)', 'rgba(138,198,209,.9)'];
82
87
  }
@@ -1,5 +1,10 @@
1
- import theme_env from '../../package.json';
2
- import { htmlTag, url_for, stripHTML } from 'hexo-util';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const package_json_1 = __importDefault(require("../../package.json"));
7
+ const hexo_util_1 = require("hexo-util");
3
8
  hexo.extend.helper.register('_new_comments', function (mode) {
4
9
  if (mode === 'twikoo') {
5
10
  return `<script data-pjax type="module">
@@ -56,7 +61,7 @@ hexo.extend.helper.register('hexo_env', function (type) {
56
61
  return this.env[type];
57
62
  });
58
63
  hexo.extend.helper.register('theme_env', function (type) {
59
- return theme_env[type];
64
+ return package_json_1.default[type];
60
65
  });
61
66
  hexo.extend.helper.register('_vendor_font', () => {
62
67
  const config = hexo.theme.config.font;
@@ -76,7 +81,7 @@ hexo.extend.helper.register('_vendor_font', () => {
76
81
  fontFamilies = [...new Set(fontFamilies)];
77
82
  fontFamilies = fontFamilies.join('|');
78
83
  return fontFamilies
79
- ? htmlTag('link', {
84
+ ? (0, hexo_util_1.htmlTag)('link', {
80
85
  rel: 'stylesheet',
81
86
  href: `${fontHost}/css?family=${fontFamilies.concat(fontDisplay, fontSubset)}`
82
87
  })
@@ -95,18 +100,18 @@ hexo.extend.helper.register('_vendor_js', () => {
95
100
  vendorJs = vendorJs.filter(item => item !== '');
96
101
  vendorJs = [...new Set(vendorJs)];
97
102
  vendorJs = vendorJs.join(',');
98
- return vendorJs ? htmlTag('script', { src: `https://cdn.jsdelivr.net/combine/${vendorJs}` }, '') : '';
103
+ return vendorJs ? (0, hexo_util_1.htmlTag)('script', { src: `https://cdn.jsdelivr.net/combine/${vendorJs}` }, '') : '';
99
104
  });
100
105
  hexo.extend.helper.register('_css', function (...urls) {
101
106
  const { statics, css } = hexo.theme.config;
102
- return urls.map(url => htmlTag('link', {
107
+ return urls.map(url => (0, hexo_util_1.htmlTag)('link', {
103
108
  rel: 'stylesheet',
104
- href: url_for.call(this, `${statics}${css}/${url}?v=${theme_env.version}`)
109
+ href: hexo_util_1.url_for.call(this, `${statics}${css}/${url}?v=${package_json_1.default.version}`)
105
110
  })).join('');
106
111
  });
107
112
  hexo.extend.helper.register('_js', function (...urls) {
108
113
  const { statics, js } = hexo.theme.config;
109
- return urls.map(url => htmlTag('script', { src: url_for.call(this, `${statics}${js}/${url}?v=${theme_env.version}`) }, '')).join('');
114
+ return urls.map(url => (0, hexo_util_1.htmlTag)('script', { src: hexo_util_1.url_for.call(this, `${statics}${js}/${url}?v=${package_json_1.default.version}`) }, '')).join('');
110
115
  });
111
116
  hexo.extend.helper.register('_list_vendor_js', () => {
112
117
  return hexo.theme.config.vendorsList.js;
@@ -158,14 +163,14 @@ hexo.extend.helper.register('_adv_vendor_js', function (js_name) {
158
163
  if (config['hash-value'])
159
164
  attr.integrity = config['hash-value'];
160
165
  if (config.deferLoad) {
161
- return htmlTag('script', { 'data-pjax': true }, `
166
+ return (0, hexo_util_1.htmlTag)('script', { 'data-pjax': true }, `
162
167
  const script=document.createElement("script");script.src="${result}",script.async=true,document.body.appendChild(script)
163
168
  `);
164
169
  }
165
- return htmlTag('script', attr, '');
170
+ return (0, hexo_util_1.htmlTag)('script', attr, '');
166
171
  });
167
172
  hexo.extend.helper.register('_striptags', function (data) {
168
- return stripHTML(data);
173
+ return (0, hexo_util_1.stripHTML)(data);
169
174
  });
170
175
  hexo.extend.helper.register('_truncate', function (data, end) {
171
176
  return data.substring(0, end);
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- import { htmlTag, url_for } from 'hexo-util';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const hexo_util_1 = require("hexo-util");
3
4
  const randomServer = parseInt(String(Math.random() * 4), 10) + 1;
4
5
  const randomBG = function (count = 1, image_server = null, image_list = []) {
5
6
  let i;
@@ -53,7 +54,7 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
53
54
  const theme = hexo.theme.config;
54
55
  let exturl = '';
55
56
  let tag = 'a';
56
- let attrs = { href: url_for.call(this, path), class: undefined, external: undefined, rel: undefined, 'data-url': undefined };
57
+ let attrs = { href: hexo_util_1.url_for.call(this, path), class: undefined, external: undefined, rel: undefined, 'data-url': undefined };
57
58
  if (theme.exturl && data.protocol && data.hostname !== siteHost) {
58
59
  tag = 'span';
59
60
  exturl = 'exturl';
@@ -84,7 +85,7 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
84
85
  attrs.rel = null;
85
86
  }
86
87
  }
87
- return htmlTag(tag, attrs, decodeURI(text), false);
88
+ return (0, hexo_util_1.htmlTag)(tag, attrs, decodeURI(text), false);
88
89
  });
89
90
  hexo.extend.helper.register('_image_url', function (img, path = '') {
90
91
  const { statics } = hexo.theme.config;
@@ -93,7 +94,7 @@ hexo.extend.helper.register('_image_url', function (img, path = '') {
93
94
  return img;
94
95
  }
95
96
  else {
96
- return url_for.call(this, statics + (post_asset_folder ? path : '') + img);
97
+ return hexo_util_1.url_for.call(this, statics + (post_asset_folder ? path : '') + img);
97
98
  }
98
99
  });
99
100
  hexo.extend.helper.register('_cover', function (item, num) {
@@ -122,7 +123,7 @@ hexo.extend.helper.register('canonical', function () {
122
123
  hexo.extend.helper.register('i18n_path', function (language) {
123
124
  const { path, lang } = this.page;
124
125
  const base = path.startsWith(lang) ? path.slice(lang.length + 1) : path;
125
- return url_for.call(this, `${this.languages.indexOf(language) === 0 ? '' : '/' + language}/${base}`);
126
+ return hexo_util_1.url_for.call(this, `${this.languages.indexOf(language) === 0 ? '' : '/' + language}/${base}`);
126
127
  });
127
128
  hexo.extend.helper.register('language_name', function (language) {
128
129
  const name = hexo.theme.i18n.__(language)('name');
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
- import fs from 'hexo-fs';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const hexo_fs_1 = __importDefault(require("hexo-fs"));
3
7
  const prepareQuery = (categories, parent) => {
4
8
  const query = {
5
9
  parent: undefined
@@ -50,18 +54,16 @@ hexo.extend.helper.register('_categories', function () {
50
54
  const categories = this.site.categories;
51
55
  if (!categories || !categories.length)
52
56
  return '';
53
- const pangu = this.theme.pangu
54
- ? require('pangu')
55
- : {
56
- spacing: data => {
57
- return data;
58
- }
59
- };
57
+ const pangu = {
58
+ spacing: data => {
59
+ return data;
60
+ }
61
+ };
60
62
  const result = {};
61
63
  categories.forEach((cat, i) => {
62
64
  const child = prepareQuery(categories, cat._id);
63
65
  const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg';
64
- if (fs.existsSync(cover)) {
66
+ if (hexo_fs_1.default.existsSync(cover)) {
65
67
  const className = cat.slug.split('/');
66
68
  className.pop();
67
69
  cat.class = className.join(' ');
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- import { stripHTML } from 'hexo-util';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const hexo_util_1 = require("hexo-util");
3
4
  const config = hexo.config.symbols_count_time = Object.assign({
4
5
  symbols: true,
5
6
  time: true,
@@ -58,5 +59,5 @@ hexo.extend.filter.register('after_post_render', (data) => {
58
59
  let { content } = data;
59
60
  if (config.exclude_codeblock)
60
61
  content = content.replace(/<pre>.*?<\/pre>/g, '');
61
- data.length = stripHTML(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
62
+ data.length = (0, hexo_util_1.stripHTML)(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
62
63
  }, 0);
@@ -1,11 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const injects_1 = __importDefault(require("./lib/injects"));
7
+ const node_https_1 = __importDefault(require("node:https"));
8
+ const package_json_1 = require("../../package.json");
1
9
  hexo.on('generateBefore', () => {
2
- require('./lib/injects')(hexo);
10
+ (0, injects_1.default)(hexo);
3
11
  });
4
12
  hexo.on('generateAfter', () => {
5
- const https = require('https');
6
- const path = require('path');
7
- const { version } = require(path.normalize('../../package.json'));
8
- https.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
13
+ node_https_1.default.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
9
14
  headers: {
10
15
  'User-Agent': 'Theme ShokaX Client'
11
16
  }
@@ -17,7 +22,7 @@ hexo.on('generateAfter', () => {
17
22
  res.on('end', () => {
18
23
  try {
19
24
  const latest = JSON.parse(result).tag_name.replace('v', '').split('.');
20
- const current = version.split('.');
25
+ const current = package_json_1.version.split('.');
21
26
  let isOutdated = false;
22
27
  for (let i = 0; i < Math.max(latest.length, current.length); i++) {
23
28
  if (!current[i] || latest[i] > current[i]) {
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- export default {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
3
4
  views: [
4
5
  'head',
5
6
  'sidebar',
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import points from './injects-point';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_fs_1 = __importDefault(require("node:fs"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const injects_point_1 = __importDefault(require("./injects-point"));
5
9
  const defaultExtname = '.pug';
6
10
  class StylusInject {
7
11
  constructor(base_dir) {
@@ -9,7 +13,7 @@ class StylusInject {
9
13
  this.files = [];
10
14
  }
11
15
  push(file) {
12
- this.files.push(path.resolve(this.base_dir, file));
16
+ this.files.push(node_path_1.default.resolve(this.base_dir, file));
13
17
  }
14
18
  }
15
19
  class ViewInject {
@@ -18,36 +22,36 @@ class ViewInject {
18
22
  this.raws = [];
19
23
  }
20
24
  raw(name, raw, ...args) {
21
- if (path.extname(name) === '') {
25
+ if (node_path_1.default.extname(name) === '') {
22
26
  name += defaultExtname;
23
27
  }
24
28
  this.raws.push({ name, raw, args });
25
29
  }
26
30
  file(name, file, ...args) {
27
- if (path.extname(name) === '') {
28
- name += path.extname(file);
31
+ if (node_path_1.default.extname(name) === '') {
32
+ name += node_path_1.default.extname(file);
29
33
  }
30
- this.raw(name, fs.readFileSync(path.resolve(this.base_dir, file), 'utf8'), ...args);
34
+ this.raw(name, node_fs_1.default.readFileSync(node_path_1.default.resolve(this.base_dir, file), 'utf8'), ...args);
31
35
  }
32
36
  }
33
37
  function initInject(base_dir) {
34
38
  const injects = {};
35
- points.styles.forEach(item => {
39
+ injects_point_1.default.styles.forEach(item => {
36
40
  injects[item] = new StylusInject(base_dir);
37
41
  });
38
- points.views.forEach(item => {
42
+ injects_point_1.default.views.forEach(item => {
39
43
  injects[item] = new ViewInject(base_dir);
40
44
  });
41
45
  return injects;
42
46
  }
43
- module.exports = (hexo) => {
47
+ exports.default = (hexo) => {
44
48
  const injects = initInject(hexo.base_dir);
45
49
  hexo.execFilterSync('theme_inject', injects);
46
50
  hexo.theme.config.injects = {};
47
- points.styles.forEach(type => {
51
+ injects_point_1.default.styles.forEach(type => {
48
52
  hexo.theme.config.injects[type] = injects[type].files;
49
53
  });
50
- points.views.forEach(type => {
54
+ injects_point_1.default.views.forEach(type => {
51
55
  const configs = Object.create(null);
52
56
  hexo.theme.config.injects[type] = [];
53
57
  injects[type].raws.forEach((injectObj, index) => {
@@ -1,23 +1,27 @@
1
1
  'use strict';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import yaml from 'js-yaml';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_fs_1 = __importDefault(require("node:fs"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const js_yaml_1 = __importDefault(require("js-yaml"));
5
9
  function linkGrid(args, content) {
6
10
  const theme = hexo.theme.config;
7
11
  if (!args[0] && !content) {
8
12
  return;
9
13
  }
10
14
  if (args[0]) {
11
- const filepath = path.join(hexo.source_dir, args[0]);
12
- if (fs.existsSync(filepath)) {
13
- content = fs.readFileSync(filepath);
15
+ const filepath = node_path_1.default.join(hexo.source_dir, args[0]);
16
+ if (node_fs_1.default.existsSync(filepath)) {
17
+ content = node_fs_1.default.readFileSync(filepath);
14
18
  }
15
19
  }
16
20
  if (!content) {
17
21
  return;
18
22
  }
19
23
  const siteHost = new URL(hexo.config.url).hostname || hexo.config.url;
20
- const list = yaml.load(content);
24
+ const list = js_yaml_1.default.load(content);
21
25
  let result = '';
22
26
  list.forEach((item) => {
23
27
  if (!item.url || !item.site) {
@@ -1,10 +1,14 @@
1
1
  'use strict';
2
- import yaml from 'js-yaml';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const js_yaml_1 = __importDefault(require("js-yaml"));
3
7
  function postMedia(args, content) {
4
8
  if (!args[0] || !content) {
5
9
  return;
6
10
  }
7
- const list = yaml.load(content);
11
+ const list = js_yaml_1.default.load(content);
8
12
  switch (args[0]) {
9
13
  case 'video':
10
14
  case 'audio':
@@ -1,12 +1,14 @@
1
1
  @import "_variables";
2
2
 
3
- for $inject_variable in hexo-config('injects.variable')
4
- @import $inject_variable;
3
+ if hexo-config('injects.variable')
4
+ for $inject_variable in hexo-config('injects.variable')
5
+ @import $inject_variable
5
6
 
6
7
  @import "_mixins";
7
8
 
8
- for $inject_mixin in hexo-config('injects.mixin')
9
- @import $inject_mixin;
9
+ if hexo-config('injects.mixin')
10
+ for $inject_mixin in hexo-config('injects.mixin')
11
+ @import $inject_mixin;
10
12
 
11
13
  if $colors = hexo-config('style.colors')
12
14
  @import $colors;
@@ -30,8 +32,9 @@ else
30
32
  if $custom = hexo-config('style.custom')
31
33
  @import $custom;
32
34
 
33
- for $inject_style in hexo-config('injects.style')
34
- @import $inject_style;
35
+ if hexo-config('injects.style')
36
+ for $inject_style in hexo-config('injects.style')
37
+ @import $inject_style;
35
38
 
36
39
  if $optimize = hexo-config('experiments.optimizeLongPosts')
37
40
  @import "optimize.styl"