Skip to content

Commit

Permalink
feat: use ts version option for ts lib dts acquire
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jul 5, 2023
1 parent 0cc220d commit a042d4c
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions src/monaco/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,37 @@ let disposeVue: undefined | (() => void)
export async function reloadVue(store: Store) {
disposeVue?.()

let dependencies = {};

if (store.vueVersion) {
dependencies = {
...dependencies,
vue: store.vueVersion,
'@vue/compiler-core': store.vueVersion,
'@vue/compiler-dom': store.vueVersion,
'@vue/compiler-sfc': store.vueVersion,
'@vue/compiler-ssr': store.vueVersion,
'@vue/reactivity': store.vueVersion,
'@vue/runtime-core': store.vueVersion,
'@vue/runtime-dom': store.vueVersion,
'@vue/shared': store.vueVersion,
}
}

if (store.state.typescriptVersion) {
dependencies = {
...dependencies,
typescript: store.state.typescriptVersion,
}
}

const worker = editor.createWebWorker<any>({
moduleId: 'vs/language/vue/vueWorker',
label: 'vue',
host: new WorkerHost(),
createData: {
tsconfig: store.getTsConfig?.() || {},
dependencies: !store.vueVersion
? {}
: {
vue: store.vueVersion,
'@vue/compiler-core': store.vueVersion,
'@vue/compiler-dom': store.vueVersion,
'@vue/compiler-sfc': store.vueVersion,
'@vue/compiler-ssr': store.vueVersion,
'@vue/reactivity': store.vueVersion,
'@vue/runtime-core': store.vueVersion,
'@vue/runtime-dom': store.vueVersion,
'@vue/shared': store.vueVersion,
},
dependencies,
} satisfies CreateData,
})
const languageId = ['vue', 'javascript', 'typescript']
Expand Down

0 comments on commit a042d4c

Please sign in to comment.