-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathindex.ts
52 lines (45 loc) · 1.38 KB
/
index.ts
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
/* eslint-disable import/first */
console.log =
console.info =
console.warn =
console.debug =
console.error =
console.trace =
() => {}
import 'reflect-metadata'
import { Telemetry } from '@vuedx/shared'
import type { Modules, PluginCreateInfo, TS } from './interfaces'
import type { PluginConfig } from './managers/ConfigManager'
import { pluginManager } from './managers/PluginManager'
import { PluginSideChannel } from './services/PluginSideChannel'
export { PluginSideChannel }
export type { PluginConfig }
pluginManager.fixConsole(console)
export default function init({ typescript }: Modules): TS.server.PluginModule {
Telemetry.setup(
'https://[email protected]/5595721',
'typescript-plugin-vue',
VERSION,
0.001,
{ typescriptVersion: typescript.versionMajorMinor },
)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { resolve } = require('node:path') as {
resolve: typeof import('node:path').resolve
}
return {
create(info: PluginCreateInfo) {
return pluginManager.create({
...info,
typescript,
typesDir: resolve(__dirname, '..', 'runtime'),
})
},
getExternalFiles(project) {
return pluginManager.getExternalFiles(project)
},
onConfigurationChanged(config) {
pluginManager.onConfigurationChanged(config)
},
}
}