feat: upgrade minify xml to v4

This commit is contained in:
wherewhere 2024-12-18 13:21:37 +08:00
parent bda758177a
commit a36d5ef2df
2 changed files with 5 additions and 4 deletions

View File

@ -1,8 +1,9 @@
'use strict' 'use strict'
const { minify: compressXml } = require('minify-xml')
const { match, logFn } = require('./tools') const { match, logFn } = require('./tools')
function minifyXml() { async function minifyXml() {
const { minify: compressXml } = await import('minify-xml')
const hexo = this const hexo = this
const options = hexo.config.minify.xml const options = hexo.config.minify.xml
@ -11,7 +12,7 @@ function minifyXml() {
const routeList = route.list() const routeList = route.list()
const { globOptions, include, verbose } = options const { globOptions, include, verbose } = options
return Promise.all((match(routeList, include, globOptions)).map(path => { await Promise.all((match(routeList, include, globOptions)).map(path => {
return new Promise((/** @type {(value: void) => void} */ resolve, reject) => { return new Promise((/** @type {(value: void) => void} */ resolve, reject) => {
const assetPath = route.get(path) const assetPath = route.get(path)
let assetTxt = '' let assetTxt = ''

View File

@ -29,7 +29,7 @@
"clean-css": "^5.1.2", "clean-css": "^5.1.2",
"html-minifier-terser": "^7.2.0", "html-minifier-terser": "^7.2.0",
"micromatch": "^4.0.2", "micromatch": "^4.0.2",
"minify-xml": "^3.2.0", "minify-xml": "^4.5.2",
"svgo": "^3.0.0", "svgo": "^3.0.0",
"terser": "^5.3.0" "terser": "^5.3.0"
}, },