UNPKG

@ithinkdt/core

Version:

iThinkDT Core

67 lines (62 loc) 1.65 kB
import path from 'node:path' import { existsSync } from 'node:fs' // eslint-disable-next-line vue/prefer-import-from-vue import { hyphenate } from '@vue/shared' export const Core = { from: '@ithinkdt/core', imports: [ 'useAuth', '$can', 'useAccess', 'useTheme', 'registerDict', 'useDict', 'useDictMap', '$fetch', 'useFetch', 'usePageTab', 'onPageClose', '$msg', '$dialog', '$notice', 'useForm', 'useTable', 'useDs', 'useTree', 'useModal', 'useCoreCtx', 'useCurd', 'useFormModal', 'analyzeEntity', 'useFile', 'Entity', 'Field', 'Label', 'openPage', { name: 'DictOption', type: true }, { name: 'DictItem', type: true }, { name: 'PaginResult', type: true }, { name: 'PageConf', type: true }, { name: 'UseFormItems', type: true }, { name: 'UseCurdFormItems', type: true }, ], } export const I18nResolver = (name) => { if (name === 'useI18n') { return { name, from: existsSync(path.resolve('./src', 'i18n/index.ts')) ? '@/i18n' : '@ithinkdt/core', } } if (name !== 'useI18n' && name.startsWith('use') && name.endsWith('I18n')) { const module = hyphenate(name.slice(3, -4)) const file = `views/${module}/_/i18n.ts` if (existsSync(path.resolve('./src', file))) { return { name, from: '@/' + file, } } } } export default Core