Skip to content

Commit

Permalink
fix(utils): incorrect external regex (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikeq authored Nov 12, 2019
1 parent e21f8ae commit 41c6d7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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 '';
Expand Down Expand Up @@ -747,5 +747,5 @@ exports.parseBackground = function (value) {
}

exports.isExternal = function (link) {
return !!link.match(/^(\w+:)?\/\/\w+\.\w+/);
return /^(\w+:)?\/\//.test(link);
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
}
}

0 comments on commit 41c6d7d

Please sign in to comment.