From a36d5ef2df990f5e288291597d50eca4c11e4b84 Mon Sep 17 00:00:00 2001 From: wherewhere Date: Wed, 18 Dec 2024 13:21:37 +0800 Subject: [PATCH] feat: upgrade minify xml to v4 --- lib/xml.js | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/xml.js b/lib/xml.js index 264345d..9d5799f 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -1,8 +1,9 @@ 'use strict' -const { minify: compressXml } = require('minify-xml') const { match, logFn } = require('./tools') -function minifyXml() { +async function minifyXml() { + const { minify: compressXml } = await import('minify-xml') + const hexo = this const options = hexo.config.minify.xml @@ -11,7 +12,7 @@ function minifyXml() { const routeList = route.list() 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) => { const assetPath = route.get(path) let assetTxt = '' diff --git a/package.json b/package.json index 33d895c..82a2b89 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "clean-css": "^5.1.2", "html-minifier-terser": "^7.2.0", "micromatch": "^4.0.2", - "minify-xml": "^3.2.0", + "minify-xml": "^4.5.2", "svgo": "^3.0.0", "terser": "^5.3.0" },