Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | // region Dependency Injection
import {createApp} from 'vue'
import App from './App.vue'
// note axios
import {apiGlobalPlugin} from "@/libs/axios/plugin";
import { i18n, i18nReady } from '@/libs/i18n'
import { withLoading } from '@/libs/loading'
import router from './router'
import vuetify from './libs/vuetify'
import loggerPlugin from '@/libs/logger/plugin'
import { useSchemaLogger } from '@/libs/logger/logger' // 実際の配置に合わせて調整
import {createPinia} from 'pinia'
import {createPersistedState} from 'pinia-plugin-persistedstate'
import {useAuthStore} from '@/stores/auth'
import './styles/style.css'
import './styles/tokens.css'
import './styles/overrides.css'
import './styles/nav-tight.scss'
// endregion Dependency Injection
// region interface
// endregion interface
// region constants
const app = createApp(App)
const pinia = createPinia()
// endregion constants
// region variable
// endregion variable
// region props
// endregion props
// region emits
// endregion emits
// region validator
// endregion validator
// region methods
pinia.use(createPersistedState())
app.use(apiGlobalPlugin)
app.use(router)
app.use(vuetify)
app.use(loggerPlugin)
app.use(pinia)
app.use(i18n)
// endregion methods
// region export
async function bootstrap(): Promise<void> {
const auth = useAuthStore(pinia)
await withLoading(async () => {
await Promise.all([
i18nReady(),
auth.init(),
router.isReady(),
])
}, 'bootstrap', pinia)
app.mount('#app')
}
// const auth = useAuthStore(pinia)
// // await auth.init()
// // await i18nReady()
//
// await withLoading(async () => {
// // i18n と auth を並列でも直列でもOK。依存が無ければ並列が速い
// await Promise.all([
// i18nReady(),
// auth.init(),
// router.isReady(), // ついでにルーター準備も待つとチラつき減
// ])
// }, 'bootstrap', pinia)
// app.mount('#app')
function toErrPayload(err: unknown) {
if (err instanceof Error) {
return { name: err.name, message: err.message, stack: err.stack }
}
return { message: String(err) }
}
const bootLog = useSchemaLogger({ logger: 'Bootstrap' })
bootstrap().catch((e) => {
const href = typeof window !== 'undefined' ? window.location.href : undefined
const userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : undefined
try {
bootLog.fatal('bootstrap failed', {
err: toErrPayload(e),
href,
userAgent,
})
} catch (logErr) {
// ロガー自体が落ちた場合の最終手段
console.error('bootstrap failed', e, 'logger failed', logErr)
}
})
// endregion export
|