Skip to content

Commit

Permalink
feat: expose dependency version
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jul 9, 2023
1 parent 44d6665 commit 7076c5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/monaco/env.ts
Expand Up @@ -76,7 +76,9 @@ let disposeVue: undefined | (() => void)
export async function reloadLanguageTools(store: Store) {
disposeVue?.()

let dependencies = {}
let dependencies: Record<string, string> = {
...store.state.dependencyVersion,
}

if (store.vueVersion) {
dependencies = {
Expand Down
2 changes: 1 addition & 1 deletion src/monaco/vue.worker.ts
Expand Up @@ -19,7 +19,7 @@ export interface CreateData {
compilerOptions?: import('typescript').CompilerOptions
vueCompilerOptions?: Partial<VueCompilerOptions>
}
dependencies: {}
dependencies: Record<string, string>
}

let locale: string
Expand Down
7 changes: 6 additions & 1 deletion src/store.ts
Expand Up @@ -90,6 +90,8 @@ export interface StoreState {
locale?: string | undefined
// used to force reset the sandbox
resetFlip: boolean
/** { dep: version } */
dependencyVersion?: Record<string, string>
}

export interface SFCOptions {
Expand Down Expand Up @@ -194,8 +196,10 @@ export class ReplStore implements Store {
this.state.typescriptVersion,
this.state.typescriptLocale,
this.state.locale,
this.state.dependencyVersion,
],
() => this.reloadLanguageTools?.()
() => this.reloadLanguageTools?.(),
{ deep: true }
)

this.state.errors = []
Expand Down Expand Up @@ -417,6 +421,7 @@ export class ReplStore implements Store {
imports['vue/server-renderer'] = ssrUrl
this.setImportMap(importMap)
this.forceSandboxReset()
this.reloadLanguageTools?.()
console.info(`[@vue/repl] Now using Vue version: ${version}`)
}

Expand Down

0 comments on commit 7076c5c

Please sign in to comment.