fix: fix lint

This commit is contained in:
where where 2025-11-03 21:08:21 +08:00
parent 77bf6c0224
commit da397b4504
10 changed files with 30 additions and 24 deletions

View File

@ -119,16 +119,14 @@ if (hexo.config.minify.enable === true && !(hexo.config.minify.previewServer ===
if (hexo.config.minify.css.enable === true) {
if (hexo.config.minify.css.sourceMap) {
hexo.extend.filter.register('after_generate', require('./lib/css').minifyCssWithMap, hexo.config.minify.js.priority)
}
else {
} else {
hexo.extend.filter.register('after_render:css', require('./lib/css').minifyCss, hexo.config.minify.css.priority)
}
}
if (hexo.config.minify.js.enable === true) {
if (hexo.config.minify.js.sourceMap) {
hexo.extend.filter.register('after_generate', require('./lib/js').minifyJsWithMap, hexo.config.minify.js.priority)
}
else {
} else {
hexo.extend.filter.register('after_render:js', require('./lib/js').minifyJs, hexo.config.minify.js.priority)
}
}

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const CleanCSS = require('clean-css')
const { isMatch, match, logFn } = require('./tools')
@ -51,7 +52,7 @@ function minifyCssWithMap() {
try {
const { base, ext, name } = parse(path)
const { styles, sourceMap } = await cleanCSS.minify(assetTxt)
if (verbose) logFn.call(this, assetTxt, result, path, 'css')
if (verbose) logFn.call(this, assetTxt, styles, path, 'css')
route.set(path, `${styles}\n/*# sourceMappingURL=${base}.map */`)
const map = sourceMap.toJSON()
map.sources = [`${name}.source${ext}`]

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const { minify: htmlMinify } = require('html-minifier-terser')
const { isMatch, logFn } = require('./tools')

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const { minify: terserMinify } = require('terser')
const { isMatch, match, logFn } = require('./tools')
@ -68,7 +69,7 @@ function minifyJsWithMap() {
url: `${base}.map`
}
const { code, map } = await terserMinify(assetTxt, { ...jsOptions })
if (verbose) logFn.call(this, assetTxt, result, path, 'js')
if (verbose) logFn.call(this, assetTxt, code, path, 'js')
route.set(path, code)
map.sources = [`${name}.source${ext}`]
route.set(`${path}.map`, JSON.stringify(map))

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const { match, logFn } = require('./tools')

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const { optimize: svgOptimize } = require('svgo')
const { match, logFn } = require('./tools')

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const micromatch = require('micromatch')

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const { match, logFn } = require('./tools')

View File

@ -1,3 +1,4 @@
/* eslint-disable space-before-function-paren */
'use strict'
const zlib = require('zlib')
const { promisify } = require('util')