diff --git a/lib/hexo/load_config.js b/lib/hexo/load_config.js index ecc336d137..42bbb719f4 100644 --- a/lib/hexo/load_config.js +++ b/lib/hexo/load_config.js @@ -6,7 +6,7 @@ const Theme = require('../theme'); const Source = require('./source'); const fs = require('hexo-fs'); const chalk = require('chalk'); -const merge = require('deepmerge'); +const { deepMerge } = require('hexo-util'); module.exports = ctx => { if (!ctx.env.init) return; @@ -26,7 +26,9 @@ module.exports = ctx => { ctx.log.debug('Config loaded: %s', chalk.magenta(tildify(configPath))); - ctx.config = config = merge(ctx.config, config); + ctx.config = deepMerge(ctx.config, config); + config = ctx.config; + ctx.config_path = configPath; config.root = config.root.replace(/\/*$/, '/'); diff --git a/lib/hexo/multi_config_path.js b/lib/hexo/multi_config_path.js index d2988e5d8f..c66442b7bd 100644 --- a/lib/hexo/multi_config_path.js +++ b/lib/hexo/multi_config_path.js @@ -3,7 +3,7 @@ const { isAbsolute, resolve, join, extname } = require('path'); const fs = require('hexo-fs'); const yml = require('js-yaml'); -const merge = require('deepmerge'); +const { deepMerge } = require('hexo-util'); module.exports = ctx => function multiConfigPath(base, configPaths, outputDir) { const { log } = ctx; @@ -48,10 +48,10 @@ module.exports = ctx => function multiConfigPath(base, configPaths, outputDir) { const ext = extname(paths[i]).toLowerCase(); if (ext === '.yml') { - combinedConfig = merge(combinedConfig, yml.load(file)); + combinedConfig = deepMerge(combinedConfig, yml.load(file)); count++; } else if (ext === '.json') { - combinedConfig = merge(combinedConfig, yml.safeLoad(file, {json: true})); + combinedConfig = deepMerge(combinedConfig, yml.safeLoad(file, {json: true})); count++; } else { log.w(`Config file ${paths[i]} not supported type.`); diff --git a/package.json b/package.json index 0f336f2d46..3485c8a1dd 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "hexo-fs": "^2.0.0", "hexo-i18n": "^1.0.0", "hexo-log": "^1.0.0", - "hexo-util": "^1.5.0", + "hexo-util": "github:hexojs/hexo-util#master", "js-yaml": "^3.12.0", "lodash": "^4.17.11", "micromatch": "^4.0.2",