diff --git a/lib/utils.js b/lib/utils.js index 0b3046a..e3106b1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -568,7 +568,7 @@ exports.localeId = function (ids, toOld) { } /** - * Transform with babel, and minify with uglify + * Transform with babel, and minify with terser * * @param {string} code * @returns {string} @@ -584,15 +584,15 @@ exports.parseJs = jsParser(); exports.minifyHtml = htmlMinifier(); function jsParser() { - let babel, uglify; + let babel, terser; try { - uglify = require('uglify-js'); + terser = require('terser'); babel = require('babel-core'); require('babel-preset-env'); } catch (e) { return i => i || '' } const esSafe = code => babel.transform(code, { presets: [['env', { 'modules': false }]] }); - const minify = uglify.minify; + const minify = terser.minify; return function (code) { if (!code || typeof code !== 'string') return ''; @@ -747,5 +747,5 @@ exports.parseBackground = function (value) { } exports.isExternal = function (link) { - return !!link.match(/^(\w+:)?\/\/\w+\.\w+/); + return /^(\w+:)?\/\//.test(link); } diff --git a/package.json b/package.json index 708134d..2789ed8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-inside", - "version": "2.5.1", + "version": "2.5.2", "description": "❤️ SPA, flat and clean theme for Hexo.", "scripts": { "test": "jasmine --config=test/jasmine.json" @@ -28,6 +28,6 @@ "babel-preset-env": "1.7.0", "hexo": "4.0.0", "jasmine": "3.5.0", - "uglify-js": "3.6.7" + "terser": "4.4.0" } }