2025-06-27 15:29:20 +00:00
|
|
|
import { Format } from "../format"
|
2025-06-30 20:45:13 +00:00
|
|
|
import { LSP } from "../lsp"
|
2025-08-02 22:50:19 +00:00
|
|
|
import { Plugin } from "../plugin"
|
2025-09-01 21:15:49 +00:00
|
|
|
import { Instance } from "../project/instance"
|
2025-06-27 15:29:20 +00:00
|
|
|
import { Share } from "../share/share"
|
2025-07-24 00:30:46 +00:00
|
|
|
import { Snapshot } from "../snapshot"
|
2025-06-27 15:29:20 +00:00
|
|
|
|
2025-09-01 21:15:49 +00:00
|
|
|
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
|
|
|
|
|
return Instance.provide(directory, async () => {
|
2025-08-21 15:22:13 +00:00
|
|
|
await Plugin.init()
|
2025-06-27 15:29:20 +00:00
|
|
|
Share.init()
|
|
|
|
|
Format.init()
|
2025-06-30 20:45:13 +00:00
|
|
|
LSP.init()
|
2025-07-24 00:30:46 +00:00
|
|
|
Snapshot.init()
|
2025-09-01 21:15:49 +00:00
|
|
|
const result = await cb()
|
|
|
|
|
await Instance.dispose()
|
|
|
|
|
return result
|
2025-06-27 15:29:20 +00:00
|
|
|
})
|
|
|
|
|
}
|