import { createSSRApp } from 'vue'
import * as Pinia from 'pinia'

import 'virtual:uno.css'

import App from './App.vue'
import { setupAppConfig } from '@/config/app'
import { setupUniConfig } from '@/config/uni'
import { setupStore } from '@/store'
import { setupI18n } from '@/locales'

export function createApp() {
    const app = createSSRApp(App)

    // 注册 APP 配置
    setupAppConfig(app)

    // 配置 uni 对象全局绑定一些配置
    setupUniConfig()

    // 配置 store
    setupStore(app)

    // 配置 i18n
    setupI18n(app)

    return {
        app,
        Pinia,
    }
}
