diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 090b510..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - env: { - browser: true, - commonjs: true, - es6: true, - node: true - }, - extends: [ - 'standard', - 'plugin:@typescript-eslint/recommended', - 'plugin:vue/vue3-recommended', - ], - plugins: [ - '@typescript-eslint', - 'vue' - ], - parserOptions: { - ecmaVersion: 2022 - }, - rules: { - camelcase: 'off', - 'n/no-callback-literal': 'off', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-unused-vars': 'off', - 'prefer-const': 'off' - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..a60c6c3 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,55 @@ +export default [ + { + files: ['*.ts', '*.tsx', '*.vue'], + languageOptions: { + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2022 + } + }, + plugins: { + '@typescript-eslint': await import('@typescript-eslint/eslint-plugin'), + 'vue': await import('eslint-plugin-vue') + }, + rules: { + camelcase: 'off', + 'n/no-callback-literal': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'prefer-const': 'off' + } + }, + { + files: ['*.js', '*.jsx'], + languageOptions: { + ecmaVersion: 2022 + }, + env: { + browser: true, + commonjs: true, + es6: true, + node: true + }, + extends: [ + 'standard' + ], + rules: { + camelcase: 'off', + 'n/no-callback-literal': 'off', + 'prefer-const': 'off' + } + }, + { + files: ['*.vue'], + languageOptions: { + parserOptions: { + ecmaVersion: 2022 + } + }, + extends: [ + 'plugin:vue/vue3-recommended' + ] + } +]; diff --git a/package.json b/package.json index ed169cf..93fd6d6 100644 --- a/package.json +++ b/package.json @@ -1,50 +1,50 @@ { "name": "hexo-theme-shokax", - "version": "0.4.2", + "version": "0.4.3", "description": "a hexo theme based on shoka", "main": "index.js", "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX", "author": "zkz098", "license": "AGPL-3.0-or-later", - "packageManager": "pnpm@8.14.1", + "packageManager": "pnpm@9.4.0", "scripts": { "test": "tsc --build --verbose", "build": "cd ./scripts && tsc --build --verbose" }, "devDependencies": { - "@types/fancybox": "^3.5.6", - "@types/jquery": "^3.5.29", + "@types/fancybox": "^3.5.7", + "@types/jquery": "^3.5.30", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.11.10", + "@types/node": "^20.14.8", "@types/quicklink": "^2.3.4", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.13.1", + "@typescript-eslint/parser": "^7.13.1", "eslint": "^9.5.0", "eslint-config-standard": "~17", "eslint-plugin-import": "^2.29.1", "eslint-plugin-n": "^17.9.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-vue": "^9.20.1", - "typescript": "^5.3.3" + "eslint-plugin-promise": "^6.2.0", + "eslint-plugin-vue": "^9.26.0", + "typescript": "^5.5.2" }, "dependencies": { - "@waline/client": "^3.1.2", - "vue": "^3.4.15", - "@algolia/client-search": "^4.22.1", + "@waline/client": "^3.2.2", + "vue": "^3.4.30", + "@algolia/client-search": "^4.23.3", "algoliasearch": "4.23.3", "esbuild": "^0.21.5", "hexo": "7.2.0", - "hexo-fs": "^4.1.1", + "hexo-fs": "^4.1.3", "hexo-pagination": "^3.0.0", - "hexo-util": "^3.2.0", - "instantsearch.js": "^4.64.2", + "hexo-util": "^3.3.0", + "instantsearch.js": "^4.72.1", "js-yaml": "^4.1.0", "mouse-firework": "^0.0.5", "quicklink": "^2.3.0", "theme-shokax-anime": "^0.0.6", "theme-shokax-pjax": "^0.0.3", - "twikoo": "^1.6.31", - "unlazy": "^0.11.1", + "twikoo": "^1.6.36", + "unlazy": "^0.11.3", "hexo-lightning-minify": "latest", "hexo-algoliasearch": "latest", "hexo-feed": "latest", @@ -53,5 +53,18 @@ "engines": { "node": ">=18.0.0" }, - "engineStrict": true + "engineStrict": true, + "pnpm": { + "overrides": { + "array-includes": "npm:@nolyfill/array-includes@latest", + "array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@latest", + "array.prototype.flat": "npm:@nolyfill/array.prototype.flat@latest", + "array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@latest", + "hasown": "npm:@nolyfill/hasown@latest", + "is-regex": "npm:@nolyfill/is-regex@latest", + "object.fromentries": "npm:@nolyfill/object.fromentries@latest", + "object.groupby": "npm:@nolyfill/object.groupby@latest", + "object.values": "npm:@nolyfill/object.values@latest" + } + } } diff --git a/scripts/plugin/index.ts b/scripts/plugin/index.ts index 4d72865..a5f3490 100644 --- a/scripts/plugin/index.ts +++ b/scripts/plugin/index.ts @@ -22,10 +22,10 @@ hexo.on('generateBefore', () => { hexo.on('generateAfter', () => { // 检查版本更新 - fetch('https://registry.npmmirror.com/hexo-theme-shokax').then((res) => { + fetch('https://api.shokax.top/version/hexo').then((res) => { res.json().then((resp) => { try { - const latest = resp['dist-tags'].latest + const latest = resp['version'] const current = version.split('.') let isOutdated = false for (let i = 0; i < Math.max(latest.length, current.length); i++) { diff --git a/source/js/_app/pjax/refresh.ts b/source/js/_app/pjax/refresh.ts index bbdd92f..c499f57 100644 --- a/source/js/_app/pjax/refresh.ts +++ b/source/js/_app/pjax/refresh.ts @@ -72,35 +72,33 @@ export const siteRefresh = (reload) => { sideBarTab() sidebarTOC() - if (LOCAL.ispost) { - import('../page/post').then(({ postBeauty }) => { - postBeauty() - }) + import('../page/post').then(({ postBeauty }) => { + postBeauty() + }) - const comment = new IntersectionObserver((entries) => { - entries.forEach((entry) => { - if (entry.isIntersecting) { - if (__shokax_waline__) { - import('../components/comments').then(({ walinePageview, walineComment }) => { - walinePageview() - walineComment() - }) - } - if (__shokax_twikoo__) { - import('../components/tcomments').then(({ twikooComment }) => { - twikooComment() - }) - } - comment.disconnect() + const comment = new IntersectionObserver((entries) => { + entries.forEach((entry) => { + if (entry.isIntersecting) { + if (__shokax_waline__) { + import('../components/comments').then(({ walinePageview, walineComment }) => { + walinePageview() + walineComment() + }) } - }) - }, { - root: null, - threshold: 0.2 + if (__shokax_twikoo__) { + import('../components/tcomments').then(({ twikooComment }) => { + twikooComment() + }) + } + comment.disconnect() + } }) + }, { + root: null, + threshold: 0.2 + }) - comment.observe($dom('#copyright')) - } + comment.observe($dom('#copyright')) lazyLoad() diff --git a/source/js/_app/pjax/siteInit.ts b/source/js/_app/pjax/siteInit.ts index 35e9bfb..4dec603 100644 --- a/source/js/_app/pjax/siteInit.ts +++ b/source/js/_app/pjax/siteInit.ts @@ -55,6 +55,7 @@ const siteInit = () => { }) // Handle and trigger popup window + // search 只有一个,不需要 each $dom.each('.search', (element) => { element.addEventListener('click', () => { document.body.style.overflow = 'hidden'