@vue/devtools-api
Advanced tools
Comparing version 6.0.5 to 6.0.6
@@ -20,5 +20,6 @@ "use strict"; | ||
function setupDevtoolsPlugin(pluginDescriptor, setupFn) { | ||
const descriptor = pluginDescriptor; | ||
const target = (0, env_1.getTarget)(); | ||
const hook = (0, env_1.getDevtoolsGlobalHook)(); | ||
const enableProxy = env_1.isProxyAvailable && pluginDescriptor.enableEarlyProxy; | ||
const enableProxy = env_1.isProxyAvailable && descriptor.enableEarlyProxy; | ||
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) { | ||
@@ -28,6 +29,6 @@ hook.emit(const_1.HOOK_SETUP, pluginDescriptor, setupFn); | ||
else { | ||
const proxy = enableProxy ? new proxy_1.ApiProxy(pluginDescriptor, hook) : null; | ||
const proxy = enableProxy ? new proxy_1.ApiProxy(descriptor, hook) : null; | ||
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || []; | ||
list.push({ | ||
pluginDescriptor, | ||
pluginDescriptor: descriptor, | ||
setupFn, | ||
@@ -34,0 +35,0 @@ proxy, |
import { DevtoolsPluginApi } from './api'; | ||
import { PluginDescriptor } from './plugin'; | ||
import { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin'; | ||
export * from './api'; | ||
export * from './plugin'; | ||
export { PluginQueueItem } from './env'; | ||
declare type Cast<A, B> = A extends B ? A : B; | ||
declare type Narrowable = string | number | bigint | boolean; | ||
declare type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({ | ||
[K in keyof A]: Narrow<A[K]>; | ||
})>; | ||
declare type Exact<C, T> = { | ||
[K in keyof C]: K extends keyof T ? T[K] : never; | ||
}; | ||
export declare type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void; | ||
export declare function setupDevtoolsPlugin<TSettings = any>(pluginDescriptor: PluginDescriptor, setupFn: SetupFunction): void; | ||
export declare function setupDevtoolsPlugin<TDescriptor extends Exact<TDescriptor, PluginDescriptor>, TSettings = ExtractSettingsTypes<TDescriptor extends { | ||
settings: infer S; | ||
} ? S extends Record<string, PluginSettingsItem> ? S : Record<string, PluginSettingsItem> : Record<string, PluginSettingsItem>>>(pluginDescriptor: Narrow<TDescriptor>, setupFn: SetupFunction<TSettings>): void; |
@@ -7,5 +7,6 @@ import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env'; | ||
export function setupDevtoolsPlugin(pluginDescriptor, setupFn) { | ||
const descriptor = pluginDescriptor; | ||
const target = getTarget(); | ||
const hook = getDevtoolsGlobalHook(); | ||
const enableProxy = isProxyAvailable && pluginDescriptor.enableEarlyProxy; | ||
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy; | ||
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) { | ||
@@ -15,6 +16,6 @@ hook.emit(HOOK_SETUP, pluginDescriptor, setupFn); | ||
else { | ||
const proxy = enableProxy ? new ApiProxy(pluginDescriptor, hook) : null; | ||
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null; | ||
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || []; | ||
list.push({ | ||
pluginDescriptor, | ||
pluginDescriptor: descriptor, | ||
setupFn, | ||
@@ -21,0 +22,0 @@ proxy, |
@@ -21,2 +21,3 @@ import { App } from './api'; | ||
label: string; | ||
description?: string; | ||
} & ({ | ||
@@ -37,1 +38,12 @@ type: 'boolean'; | ||
}); | ||
declare type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{ | ||
type: 'boolean'; | ||
}] ? boolean : [T] extends [{ | ||
type: 'choice'; | ||
}] ? T['options'][number]['value'] : [T] extends [{ | ||
type: 'text'; | ||
}] ? string : unknown; | ||
export declare type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = { | ||
[K in keyof O]: InferSettingsType<O[K]>; | ||
}; | ||
export {}; |
{ | ||
"name": "@vue/devtools-api", | ||
"version": "6.0.5", | ||
"version": "6.0.6", | ||
"description": "Interact with the Vue devtools from the page", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30298
829