@vue/devtools-api
Advanced tools
Comparing version 6.5.1 to 6.6.1
@@ -9,7 +9,7 @@ "use strict"; | ||
function getTarget() { | ||
// @ts-ignore | ||
// @ts-expect-error navigator and windows are not available in all environments | ||
return (typeof navigator !== 'undefined' && typeof window !== 'undefined') | ||
? window | ||
: typeof global !== 'undefined' | ||
? global | ||
: typeof globalThis !== 'undefined' | ||
? globalThis | ||
: {}; | ||
@@ -16,0 +16,0 @@ } |
@@ -40,6 +40,7 @@ "use strict"; | ||
}); | ||
if (proxy) | ||
if (proxy) { | ||
setupFn(proxy.proxiedTarget); | ||
} | ||
} | ||
} | ||
exports.setupDevtoolsPlugin = setupDevtoolsPlugin; |
@@ -89,3 +89,3 @@ "use strict"; | ||
return (...args) => { | ||
return new Promise(resolve => { | ||
return new Promise((resolve) => { | ||
this.targetQueue.push({ | ||
@@ -92,0 +92,0 @@ method: prop, |
@@ -15,5 +15,5 @@ "use strict"; | ||
} | ||
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { | ||
else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { | ||
supported = true; | ||
perf = global.perf_hooks.performance; | ||
perf = globalThis.perf_hooks.performance; | ||
} | ||
@@ -20,0 +20,0 @@ else { |
@@ -8,20 +8,20 @@ import type { ComponentBounds, Hookable } from './hooks.js'; | ||
on: Hookable<Context>; | ||
notifyComponentUpdate(instance?: ComponentInstance): void; | ||
addTimelineLayer(options: TimelineLayerOptions): void; | ||
addTimelineEvent(options: TimelineEventOptions): void; | ||
addInspector(options: CustomInspectorOptions): void; | ||
sendInspectorTree(inspectorId: string): void; | ||
sendInspectorState(inspectorId: string): void; | ||
selectInspectorNode(inspectorId: string, nodeId: string): void; | ||
getComponentBounds(instance: ComponentInstance): Promise<ComponentBounds>; | ||
getComponentName(instance: ComponentInstance): Promise<string>; | ||
getComponentInstances(app: App): Promise<ComponentInstance[]>; | ||
highlightElement(instance: ComponentInstance): void; | ||
unhighlightElement(): void; | ||
getSettings(pluginId?: string): TSettings; | ||
now(): number; | ||
notifyComponentUpdate: (instance?: ComponentInstance) => void; | ||
addTimelineLayer: (options: TimelineLayerOptions) => void; | ||
addTimelineEvent: (options: TimelineEventOptions) => void; | ||
addInspector: (options: CustomInspectorOptions) => void; | ||
sendInspectorTree: (inspectorId: string) => void; | ||
sendInspectorState: (inspectorId: string) => void; | ||
selectInspectorNode: (inspectorId: string, nodeId: string) => void; | ||
getComponentBounds: (instance: ComponentInstance) => Promise<ComponentBounds>; | ||
getComponentName: (instance: ComponentInstance) => Promise<string>; | ||
getComponentInstances: (app: App) => Promise<ComponentInstance[]>; | ||
highlightElement: (instance: ComponentInstance) => void; | ||
unhighlightElement: () => void; | ||
getSettings: (pluginId?: string) => TSettings; | ||
now: () => number; | ||
/** | ||
* @private Not implemented yet | ||
* @private | ||
*/ | ||
setSettings(values: TSettings): void; | ||
setSettings: (values: TSettings) => void; | ||
} | ||
@@ -52,3 +52,3 @@ export interface AppRecord { | ||
} | ||
export declare type ScreenshotOverlayRenderResult = HTMLElement | string | false; | ||
export type ScreenshotOverlayRenderResult = HTMLElement | string | false; | ||
export interface ScreenshotData { | ||
@@ -55,0 +55,0 @@ time: number; |
@@ -1,1 +0,1 @@ | ||
export declare type App = any; | ||
export type App = any; |
import type { InspectorNodeTag } from './api.js'; | ||
import type { ID } from './util.js'; | ||
export declare type ComponentInstance = any; | ||
export type ComponentInstance = any; | ||
export interface ComponentTreeNode { | ||
@@ -46,7 +46,7 @@ uid: ID; | ||
} | ||
export declare type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store'; | ||
export type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store'; | ||
export interface ComponentCustomState extends ComponentStateBase { | ||
value: CustomState; | ||
} | ||
export declare type CustomState = { | ||
export interface CustomState { | ||
_custom: { | ||
@@ -75,6 +75,6 @@ type: ComponentBuiltinCustomStateTypes | string; | ||
}; | ||
}; | ||
export declare type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState; | ||
} | ||
export type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState; | ||
export interface ComponentDevtoolsOptions { | ||
hide?: boolean; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { ComponentTreeNode, InspectedComponentData, ComponentInstance, ComponentDevtoolsOptions } from './component.js'; | ||
import type { ComponentDevtoolsOptions, ComponentInstance, ComponentTreeNode, InspectedComponentData } from './component.js'; | ||
import type { App } from './app.js'; | ||
@@ -34,3 +34,3 @@ import type { CustomInspectorNode, CustomInspectorState, TimelineEvent } from './api.js'; | ||
} | ||
export declare type HookPayloads = { | ||
export interface HookPayloads { | ||
[Hooks.TRANSFORM_CALL]: { | ||
@@ -147,4 +147,4 @@ callName: string; | ||
}; | ||
}; | ||
export declare type EditStatePayload = { | ||
} | ||
export type EditStatePayload = { | ||
value: any; | ||
@@ -158,26 +158,26 @@ newKey?: string | null; | ||
}; | ||
export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>; | ||
export type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>; | ||
export interface Hookable<TContext> { | ||
transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any; | ||
getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any; | ||
getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any; | ||
registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any; | ||
walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any; | ||
visitComponentTree(handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>): any; | ||
walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any; | ||
inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any; | ||
getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any; | ||
getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any; | ||
getComponentInstances(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>): any; | ||
getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any; | ||
getComponentRootElements(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>): any; | ||
editComponentState(handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>): any; | ||
getComponentDevtoolsOptions(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>): any; | ||
getComponentRenderCode(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>): any; | ||
inspectTimelineEvent(handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>): any; | ||
timelineCleared(handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>): any; | ||
getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any; | ||
getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any; | ||
editInspectorState(handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>): any; | ||
setPluginSettings(handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>): any; | ||
transformCall: (handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>) => any; | ||
getAppRecordName: (handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>) => any; | ||
getAppRootInstance: (handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>) => any; | ||
registerApplication: (handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>) => any; | ||
walkComponentTree: (handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>) => any; | ||
visitComponentTree: (handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>) => any; | ||
walkComponentParents: (handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>) => any; | ||
inspectComponent: (handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>) => any; | ||
getComponentBounds: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>) => any; | ||
getComponentName: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>) => any; | ||
getComponentInstances: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>) => any; | ||
getElementComponent: (handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>) => any; | ||
getComponentRootElements: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>) => any; | ||
editComponentState: (handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>) => any; | ||
getComponentDevtoolsOptions: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>) => any; | ||
getComponentRenderCode: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>) => any; | ||
inspectTimelineEvent: (handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>) => any; | ||
timelineCleared: (handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>) => any; | ||
getInspectorTree: (handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>) => any; | ||
getInspectorState: (handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>) => any; | ||
editInspectorState: (handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>) => any; | ||
setPluginSettings: (handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>) => any; | ||
} |
@@ -1,4 +0,4 @@ | ||
export declare type ID = number | string; | ||
export type ID = number | string; | ||
export interface WithId { | ||
id: ID; | ||
} |
@@ -0,3 +1,3 @@ | ||
import type { ApiProxy } from './proxy.js'; | ||
import type { PluginDescriptor, SetupFunction } from './index.js'; | ||
import type { ApiProxy } from './proxy.js'; | ||
export interface PluginQueueItem { | ||
@@ -4,0 +4,0 @@ pluginDescriptor: PluginDescriptor; |
@@ -5,9 +5,9 @@ export function getDevtoolsGlobalHook() { | ||
export function getTarget() { | ||
// @ts-ignore | ||
// @ts-expect-error navigator and windows are not available in all environments | ||
return (typeof navigator !== 'undefined' && typeof window !== 'undefined') | ||
? window | ||
: typeof global !== 'undefined' | ||
? global | ||
: typeof globalThis !== 'undefined' | ||
? globalThis | ||
: {}; | ||
} | ||
export const isProxyAvailable = typeof Proxy === 'function'; |
import type { DevtoolsPluginApi } from './api/index.js'; | ||
import type { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin.js'; | ||
import type { ExtractSettingsTypes, PluginDescriptor, PluginSettingsItem } from './plugin.js'; | ||
export * from './api/index.js'; | ||
@@ -7,13 +7,13 @@ export * from './plugin.js'; | ||
export { PluginQueueItem } from './env.js'; | ||
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) | ({ | ||
type Cast<A, B> = A extends B ? A : B; | ||
type Narrowable = string | number | bigint | boolean; | ||
type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({ | ||
[K in keyof A]: Narrow<A[K]>; | ||
})>; | ||
declare type Exact<C, T> = { | ||
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 type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => 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; |
@@ -1,2 +0,2 @@ | ||
import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env.js'; | ||
import { getDevtoolsGlobalHook, getTarget, isProxyAvailable } from './env.js'; | ||
import { HOOK_SETUP } from './const.js'; | ||
@@ -23,5 +23,6 @@ import { ApiProxy } from './proxy.js'; | ||
}); | ||
if (proxy) | ||
if (proxy) { | ||
setupFn(proxy.proxiedTarget); | ||
} | ||
} | ||
} |
@@ -19,3 +19,3 @@ import type { App } from './api/index.js'; | ||
} | ||
export declare type PluginSettingsItem = { | ||
export type PluginSettingsItem = { | ||
label: string; | ||
@@ -38,3 +38,3 @@ description?: string; | ||
}); | ||
declare type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{ | ||
type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{ | ||
type: 'boolean'; | ||
@@ -46,5 +46,5 @@ }] ? boolean : [T] extends [{ | ||
}] ? string : unknown; | ||
export declare type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = { | ||
export type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = { | ||
[K in keyof O]: InferSettingsType<O[K]>; | ||
}; | ||
export {}; |
@@ -86,3 +86,3 @@ import { HOOK_PLUGIN_SETTINGS_SET } from './const.js'; | ||
return (...args) => { | ||
return new Promise(resolve => { | ||
return new Promise((resolve) => { | ||
this.targetQueue.push({ | ||
@@ -89,0 +89,0 @@ method: prop, |
@@ -12,5 +12,5 @@ let supported; | ||
} | ||
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { | ||
else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { | ||
supported = true; | ||
perf = global.perf_hooks.performance; | ||
perf = globalThis.perf_hooks.performance; | ||
} | ||
@@ -17,0 +17,0 @@ else { |
{ | ||
"name": "@vue/devtools-api", | ||
"version": "6.5.1", | ||
"version": "6.6.1", | ||
"description": "Interact with the Vue devtools from the page", | ||
"main": "lib/cjs/index.js", | ||
"browser": "lib/esm/index.js", | ||
"module": "lib/esm/index.js", | ||
"types": "lib/esm/index.d.ts", | ||
"sideEffects": false, | ||
"author": { | ||
"name": "Guillaume Chau" | ||
}, | ||
"files": [ | ||
"lib/esm", | ||
"lib/cjs" | ||
], | ||
"license": "MIT", | ||
@@ -23,2 +14,11 @@ "repository": { | ||
}, | ||
"sideEffects": false, | ||
"main": "lib/cjs/index.js", | ||
"browser": "lib/esm/index.js", | ||
"module": "lib/esm/index.js", | ||
"types": "lib/esm/index.d.ts", | ||
"files": [ | ||
"lib/cjs", | ||
"lib/esm" | ||
], | ||
"publishConfig": { | ||
@@ -34,6 +34,6 @@ "access": "public" | ||
"devDependencies": { | ||
"@types/node": "^13.9.1", | ||
"@types/node": "^20.11.16", | ||
"@types/webpack-env": "^1.15.1", | ||
"typescript": "^4.5.2" | ||
"typescript": "^5.3.3" | ||
} | ||
} |
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
33264
912
120
10
18
5
68