16 lines
722 B
JavaScript
16 lines
722 B
JavaScript
import { existsSync } from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
const directory = path.dirname(fileURLToPath(import.meta.url));
|
|
const bundledTheme = path.resolve(directory, '..', 'theme');
|
|
const workspaceTheme = path.resolve(directory, '..', '..', 'packages', 'slidev-theme-easy-jyy');
|
|
export function resolveTheme(theme) {
|
|
if (theme)
|
|
return theme;
|
|
if (existsSync(path.join(bundledTheme, 'package.json')))
|
|
return bundledTheme;
|
|
if (existsSync(path.join(workspaceTheme, 'package.json')))
|
|
return workspaceTheme;
|
|
throw new Error('easy-slides 主题不存在;请重新安装或构建 @easy-slides/cli');
|
|
}
|
|
//# sourceMappingURL=theme.js.map
|