1
1
import { PluginDescriptor , SetupFunction } from '@vue/devtools-api'
2
2
import { Plugin , BackendContext , DevtoolsPluginApiInstance } from '@vue-devtools/app-backend-api'
3
3
import { BridgeEvents , target } from '@vue-devtools/shared-utils'
4
- import { getAppRecordId } from './app'
4
+ import { getAppRecord , getAppRecordId } from './app'
5
5
6
- export function addPlugin ( pluginDescriptor : PluginDescriptor , setupFn : SetupFunction , ctx : BackendContext ) {
6
+ export async function addPlugin ( pluginDescriptor : PluginDescriptor , setupFn : SetupFunction , ctx : BackendContext ) {
7
7
const plugin : Plugin = {
8
8
descriptor : pluginDescriptor ,
9
9
setupFn,
10
10
error : null
11
11
}
12
12
ctx . currentPlugin = plugin
13
13
try {
14
+ await getAppRecord ( plugin . descriptor . app , ctx )
14
15
const api = new DevtoolsPluginApiInstance ( plugin , ctx )
15
16
setupFn ( api )
16
17
} catch ( e ) {
@@ -33,7 +34,7 @@ export function addPlugin (pluginDescriptor: PluginDescriptor, setupFn: SetupFun
33
34
export async function addQueuedPlugins ( ctx : BackendContext ) {
34
35
if ( target . __VUE_DEVTOOLS_PLUGINS__ && Array . isArray ( target . __VUE_DEVTOOLS_PLUGINS__ ) ) {
35
36
for ( const plugin of target . __VUE_DEVTOOLS_PLUGINS__ ) {
36
- addPlugin ( plugin . pluginDescriptor , plugin . setupFn , ctx )
37
+ await addPlugin ( plugin . pluginDescriptor , plugin . setupFn , ctx )
37
38
}
38
39
target . __VUE_DEVTOOLS_PLUGINS__ = null
39
40
}
@@ -42,7 +43,7 @@ export async function addQueuedPlugins (ctx: BackendContext) {
42
43
export async function addPreviouslyRegisteredPlugins ( ctx : BackendContext ) {
43
44
if ( target . __VUE_DEVTOOLS_REGISTERED_PLUGINS__ && Array . isArray ( target . __VUE_DEVTOOLS_REGISTERED_PLUGINS__ ) ) {
44
45
for ( const plugin of target . __VUE_DEVTOOLS_REGISTERED_PLUGINS__ ) {
45
- addPlugin ( plugin . pluginDescriptor , plugin . setupFn , ctx )
46
+ await addPlugin ( plugin . pluginDescriptor , plugin . setupFn , ctx )
46
47
}
47
48
}
48
49
}
0 commit comments