@142vip/vitepress
Version:
基于vitepress框架搭建静态站点的常用工具包,提供ElementPlus相关组件和主题
23 lines (22 loc) • 779 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.indexWorkspacePackageJsonGlob = indexWorkspacePackageJsonGlob;
exports.normalizeGlobPackageJsonModule = normalizeGlobPackageJsonModule;
const PACKAGE_JSON_IN_WORKSPACE = /(?:^|\/)(?:packages|apps)\/([^/]+)\/package\.json$/;
function normalizeGlobPackageJsonModule(mod) {
if (mod !== null && typeof mod === "object" && "default" in mod && mod.default != null) {
return mod.default;
}
return mod;
}
function indexWorkspacePackageJsonGlob(modules) {
const byDir = {};
for (const [filePath, mod] of Object.entries(modules)) {
const m = filePath.match(PACKAGE_JSON_IN_WORKSPACE);
if (!m) continue;
byDir[m[1]] = normalizeGlobPackageJsonModule(mod);
}
return byDir;
}