diff --git a/README.md b/README.md index 9c274af..896e3e8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Yet Another Minifier for Hexo. Minify and compress HTML, JS, CSS, SVG, XML and JSON. [Other files](https://github.com/curbengh/hexo-yam/blob/ba77db0094a7c07ea9f70f010bfc15541d4105ca/index.js#L64) are also compressed. Support gzip and [brotli](https://en.wikipedia.org/wiki/Brotli) [compressions](https://en.wikipedia.org/wiki/HTTP_compression). - ## Table of contents - [Installation](#installation) @@ -103,13 +102,12 @@ minify: - **priority** - Plugin's priority. Defaults to `10`. - **verbose** - Verbose output. Defaults to `false`. - **exclude** - Exclude files. Support [wildcard](http://www.globtester.com/) pattern(s) in a string or array. -- **compress** - Compress options. -- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://github.com/terser-js/terser#mangle-options). -- **output** - Output options. - - To retain comments, `output: {comments: true}`. +- **compress** - [Compress options](https://swc.rs/docs/configuration/minification#jscminifycompress). +- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://swc.rs/docs/configuration/minification#jscminifymangle). +- **format** - [Format options](https://swc.rs/docs/configuration/minification#jscminifyformat). - **globOptions** - See [globbing](#globbing) section. -For more options, see [Terser](https://github.com/terser-js/terser). +For more options, see [SWC](https://swc.rs/docs/configuration/minification). ## SVG diff --git a/index.js b/index.js index 318533a..5000060 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ hexo.config.minify.js = Object.assign({ exclude: ['*.min.js'], compress: {}, mangle: true, - output: {}, + format: {}, globOptions: { basename: true } }, hexo.config.minify.js) diff --git a/lib/filter.js b/lib/filter.js index f4cc97d..11600a4 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -109,10 +109,9 @@ async function minifyJs (str, data) { if (isMatch(path, exclude, globOptions)) return str - // Terser/SWC doesn't like unsupported options + // SWC/Terser doesn't like unsupported options const jsOptions = Object.assign({}, options) delete jsOptions.enable - delete jsOptions.output delete jsOptions.priority delete jsOptions.verbose // Old option, retained to avoid crash when upgrading to v4 diff --git a/test/js.test.js b/test/js.test.js index e778f92..47b3dfb 100644 --- a/test/js.test.js +++ b/test/js.test.js @@ -24,7 +24,7 @@ describe('js', () => { exclude: ['*.min.js'], compress: {}, mangle: true, - output: {}, + format: {}, globOptions: { basename: true } } }