themeConfig.js 1.16 KB
Newer Older
1 2 3 4
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveThemeConfig = void 0;
const vuepress_shared_1 = require("@mr-hope/vuepress-shared");
5
const encrypt_1 = require("./encrypt");
6 7 8 9 10 11 12 13 14 15 16 17 18 19
const setThemeLocales = (themeConfig, rootLang) => {
    const rootLangPath = (0, vuepress_shared_1.lang2Path)(rootLang);
    // set locate for base
    themeConfig.locales["/"] = Object.assign(Object.assign(Object.assign({}, (0, vuepress_shared_1.getLocale)(rootLang)), (themeConfig.locales[rootLangPath] || {})), (themeConfig.locales["/"] || {}));
    // handle other languages
    Object.keys(themeConfig.locales).forEach((path) => {
        if (path === "/")
            return;
        const lang = (0, vuepress_shared_1.path2Lang)(path);
        themeConfig.locales[path] = Object.assign(Object.assign({}, (0, vuepress_shared_1.getLocale)(lang)), themeConfig.locales[path]);
    });
};
const resolveThemeConfig = (themeConfig, rootLang) => {
    setThemeLocales(themeConfig, rootLang);
20 21
    if (themeConfig.encrypt)
        (0, encrypt_1.resolveEncrypt)(themeConfig.encrypt);
22 23
};
exports.resolveThemeConfig = resolveThemeConfig;
24
//# sourceMappingURL=themeConfig.js.map