@vue/devtools-api 6.5.1 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/env.js CHANGED
@@ -6,11 +6,11 @@ function getDevtoolsGlobalHook() {
6
6
  }
7
7
  exports.getDevtoolsGlobalHook = getDevtoolsGlobalHook;
8
8
  function getTarget() {
9
- // @ts-ignore
9
+ // @ts-expect-error navigator and windows are not available in all environments
10
10
  return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
11
11
  ? window
12
- : typeof global !== 'undefined'
13
- ? global
12
+ : typeof globalThis !== 'undefined'
13
+ ? globalThis
14
14
  : {};
15
15
  }
16
16
  exports.getTarget = getTarget;
package/lib/cjs/index.js CHANGED
@@ -37,8 +37,9 @@ function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
37
37
  setupFn,
38
38
  proxy,
39
39
  });
40
- if (proxy)
40
+ if (proxy) {
41
41
  setupFn(proxy.proxiedTarget);
42
+ }
42
43
  }
43
44
  }
44
45
  exports.setupDevtoolsPlugin = setupDevtoolsPlugin;
package/lib/cjs/proxy.js CHANGED
@@ -86,7 +86,7 @@ class ApiProxy {
86
86
  }
87
87
  else {
88
88
  return (...args) => {
89
- return new Promise(resolve => {
89
+ return new Promise((resolve) => {
90
90
  this.targetQueue.push({
91
91
  method: prop,
92
92
  args,
package/lib/cjs/time.js CHANGED
@@ -12,9 +12,9 @@ function isPerformanceSupported() {
12
12
  supported = true;
13
13
  perf = window.performance;
14
14
  }
15
- else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
15
+ else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
16
16
  supported = true;
17
- perf = global.perf_hooks.performance;
17
+ perf = globalThis.perf_hooks.performance;
18
18
  }
19
19
  else {
20
20
  supported = false;
@@ -5,24 +5,24 @@ import type { App } from './app.js';
5
5
  import type { ID } from './util.js';
6
6
  export interface DevtoolsPluginApi<TSettings> {
7
7
  on: Hookable<Context>;
8
- notifyComponentUpdate(instance?: ComponentInstance): void;
9
- addTimelineLayer(options: TimelineLayerOptions): void;
10
- addTimelineEvent(options: TimelineEventOptions): void;
11
- addInspector(options: CustomInspectorOptions): void;
12
- sendInspectorTree(inspectorId: string): void;
13
- sendInspectorState(inspectorId: string): void;
14
- selectInspectorNode(inspectorId: string, nodeId: string): void;
15
- getComponentBounds(instance: ComponentInstance): Promise<ComponentBounds>;
16
- getComponentName(instance: ComponentInstance): Promise<string>;
17
- getComponentInstances(app: App): Promise<ComponentInstance[]>;
18
- highlightElement(instance: ComponentInstance): void;
19
- unhighlightElement(): void;
20
- getSettings(pluginId?: string): TSettings;
21
- now(): number;
8
+ notifyComponentUpdate: (instance?: ComponentInstance) => void;
9
+ addTimelineLayer: (options: TimelineLayerOptions) => void;
10
+ addTimelineEvent: (options: TimelineEventOptions) => void;
11
+ addInspector: (options: CustomInspectorOptions) => void;
12
+ sendInspectorTree: (inspectorId: string) => void;
13
+ sendInspectorState: (inspectorId: string) => void;
14
+ selectInspectorNode: (inspectorId: string, nodeId: string) => void;
15
+ getComponentBounds: (instance: ComponentInstance) => Promise<ComponentBounds>;
16
+ getComponentName: (instance: ComponentInstance) => Promise<string>;
17
+ getComponentInstances: (app: App) => Promise<ComponentInstance[]>;
18
+ highlightElement: (instance: ComponentInstance) => void;
19
+ unhighlightElement: () => void;
20
+ getSettings: (pluginId?: string) => TSettings;
21
+ now: () => number;
22
22
  /**
23
- * @private Not implemented yet
23
+ * @private
24
24
  */
25
- setSettings(values: TSettings): void;
25
+ setSettings: (values: TSettings) => void;
26
26
  }
27
27
  export interface AppRecord {
28
28
  id: string;
@@ -48,7 +48,7 @@ export interface ScreenshotOverlayRenderContext<TData = any, TMeta = any> {
48
48
  events: (TimelineEvent<TData, TMeta> & ScreenshotOverlayEvent)[];
49
49
  index: number;
50
50
  }
51
- export declare type ScreenshotOverlayRenderResult = HTMLElement | string | false;
51
+ export type ScreenshotOverlayRenderResult = HTMLElement | string | false;
52
52
  export interface ScreenshotData {
53
53
  time: number;
54
54
  }
@@ -1 +1 @@
1
- export declare type App = any;
1
+ export type App = any;
@@ -1,6 +1,6 @@
1
1
  import type { InspectorNodeTag } from './api.js';
2
2
  import type { ID } from './util.js';
3
- export declare type ComponentInstance = any;
3
+ export type ComponentInstance = any;
4
4
  export interface ComponentTreeNode {
5
5
  uid: ID;
6
6
  id: string;
@@ -43,11 +43,11 @@ export interface ComponentPropState extends ComponentStateBase {
43
43
  mode?: 'default' | 'sync' | 'once';
44
44
  };
45
45
  }
46
- export declare type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
46
+ export type ComponentBuiltinCustomStateTypes = 'function' | 'map' | 'set' | 'reference' | 'component' | 'component-definition' | 'router' | 'store';
47
47
  export interface ComponentCustomState extends ComponentStateBase {
48
48
  value: CustomState;
49
49
  }
50
- export declare type CustomState = {
50
+ export interface CustomState {
51
51
  _custom: {
52
52
  type: ComponentBuiltinCustomStateTypes | string;
53
53
  objectType?: string;
@@ -71,8 +71,8 @@ export declare type CustomState = {
71
71
  /** internal */
72
72
  _reviveId?: number;
73
73
  };
74
- };
75
- export declare type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
74
+ }
75
+ export type ComponentState = ComponentStateBase | ComponentPropState | ComponentCustomState;
76
76
  export interface ComponentDevtoolsOptions {
77
77
  hide?: boolean;
78
78
  }
@@ -1,4 +1,4 @@
1
- import type { ComponentTreeNode, InspectedComponentData, ComponentInstance, ComponentDevtoolsOptions } from './component.js';
1
+ import type { ComponentDevtoolsOptions, ComponentInstance, ComponentTreeNode, InspectedComponentData } from './component.js';
2
2
  import type { App } from './app.js';
3
3
  import type { CustomInspectorNode, CustomInspectorState, TimelineEvent } from './api.js';
4
4
  export declare const enum Hooks {
@@ -31,7 +31,7 @@ export interface ComponentBounds {
31
31
  width: number;
32
32
  height: number;
33
33
  }
34
- export declare type HookPayloads = {
34
+ export interface HookPayloads {
35
35
  [Hooks.TRANSFORM_CALL]: {
36
36
  callName: string;
37
37
  inArgs: any[];
@@ -143,8 +143,8 @@ export declare type HookPayloads = {
143
143
  oldValue: any;
144
144
  settings: any;
145
145
  };
146
- };
147
- export declare type EditStatePayload = {
146
+ }
147
+ export type EditStatePayload = {
148
148
  value: any;
149
149
  newKey?: string | null;
150
150
  remove?: undefined | false;
@@ -153,28 +153,28 @@ export declare type EditStatePayload = {
153
153
  newKey?: undefined;
154
154
  remove: true;
155
155
  };
156
- export declare type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
156
+ export type HookHandler<TPayload, TContext> = (payload: TPayload, ctx: TContext) => void | Promise<void>;
157
157
  export interface Hookable<TContext> {
158
- transformCall(handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>): any;
159
- getAppRecordName(handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>): any;
160
- getAppRootInstance(handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>): any;
161
- registerApplication(handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>): any;
162
- walkComponentTree(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>): any;
163
- visitComponentTree(handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>): any;
164
- walkComponentParents(handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>): any;
165
- inspectComponent(handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>): any;
166
- getComponentBounds(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>): any;
167
- getComponentName(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>): any;
168
- getComponentInstances(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>): any;
169
- getElementComponent(handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>): any;
170
- getComponentRootElements(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>): any;
171
- editComponentState(handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>): any;
172
- getComponentDevtoolsOptions(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>): any;
173
- getComponentRenderCode(handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>): any;
174
- inspectTimelineEvent(handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>): any;
175
- timelineCleared(handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>): any;
176
- getInspectorTree(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>): any;
177
- getInspectorState(handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>): any;
178
- editInspectorState(handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>): any;
179
- setPluginSettings(handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>): any;
158
+ transformCall: (handler: HookHandler<HookPayloads[Hooks.TRANSFORM_CALL], TContext>) => any;
159
+ getAppRecordName: (handler: HookHandler<HookPayloads[Hooks.GET_APP_RECORD_NAME], TContext>) => any;
160
+ getAppRootInstance: (handler: HookHandler<HookPayloads[Hooks.GET_APP_ROOT_INSTANCE], TContext>) => any;
161
+ registerApplication: (handler: HookHandler<HookPayloads[Hooks.REGISTER_APPLICATION], TContext>) => any;
162
+ walkComponentTree: (handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_TREE], TContext>) => any;
163
+ visitComponentTree: (handler: HookHandler<HookPayloads[Hooks.VISIT_COMPONENT_TREE], TContext>) => any;
164
+ walkComponentParents: (handler: HookHandler<HookPayloads[Hooks.WALK_COMPONENT_PARENTS], TContext>) => any;
165
+ inspectComponent: (handler: HookHandler<HookPayloads[Hooks.INSPECT_COMPONENT], TContext>) => any;
166
+ getComponentBounds: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_BOUNDS], TContext>) => any;
167
+ getComponentName: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_NAME], TContext>) => any;
168
+ getComponentInstances: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_INSTANCES], TContext>) => any;
169
+ getElementComponent: (handler: HookHandler<HookPayloads[Hooks.GET_ELEMENT_COMPONENT], TContext>) => any;
170
+ getComponentRootElements: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_ROOT_ELEMENTS], TContext>) => any;
171
+ editComponentState: (handler: HookHandler<HookPayloads[Hooks.EDIT_COMPONENT_STATE], TContext>) => any;
172
+ getComponentDevtoolsOptions: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS], TContext>) => any;
173
+ getComponentRenderCode: (handler: HookHandler<HookPayloads[Hooks.GET_COMPONENT_RENDER_CODE], TContext>) => any;
174
+ inspectTimelineEvent: (handler: HookHandler<HookPayloads[Hooks.INSPECT_TIMELINE_EVENT], TContext>) => any;
175
+ timelineCleared: (handler: HookHandler<HookPayloads[Hooks.TIMELINE_CLEARED], TContext>) => any;
176
+ getInspectorTree: (handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_TREE], TContext>) => any;
177
+ getInspectorState: (handler: HookHandler<HookPayloads[Hooks.GET_INSPECTOR_STATE], TContext>) => any;
178
+ editInspectorState: (handler: HookHandler<HookPayloads[Hooks.EDIT_INSPECTOR_STATE], TContext>) => any;
179
+ setPluginSettings: (handler: HookHandler<HookPayloads[Hooks.SET_PLUGIN_SETTINGS], TContext>) => any;
180
180
  }
@@ -1,4 +1,4 @@
1
- export declare type ID = number | string;
1
+ export type ID = number | string;
2
2
  export interface WithId {
3
3
  id: ID;
4
4
  }
package/lib/esm/env.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { PluginDescriptor, SetupFunction } from './index.js';
2
1
  import type { ApiProxy } from './proxy.js';
2
+ import type { PluginDescriptor, SetupFunction } from './index.js';
3
3
  export interface PluginQueueItem {
4
4
  pluginDescriptor: PluginDescriptor;
5
5
  setupFn: SetupFunction;
package/lib/esm/env.js CHANGED
@@ -2,11 +2,11 @@ export function getDevtoolsGlobalHook() {
2
2
  return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
3
3
  }
4
4
  export function getTarget() {
5
- // @ts-ignore
5
+ // @ts-expect-error navigator and windows are not available in all environments
6
6
  return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
7
7
  ? window
8
- : typeof global !== 'undefined'
9
- ? global
8
+ : typeof globalThis !== 'undefined'
9
+ ? globalThis
10
10
  : {};
11
11
  }
12
12
  export const isProxyAvailable = typeof Proxy === 'function';
@@ -1,18 +1,18 @@
1
1
  import type { DevtoolsPluginApi } from './api/index.js';
2
- import type { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin.js';
2
+ import type { ExtractSettingsTypes, PluginDescriptor, PluginSettingsItem } from './plugin.js';
3
3
  export * from './api/index.js';
4
4
  export * from './plugin.js';
5
5
  export * from './time.js';
6
6
  export { PluginQueueItem } from './env.js';
7
- declare type Cast<A, B> = A extends B ? A : B;
8
- declare type Narrowable = string | number | bigint | boolean;
9
- declare type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({
7
+ type Cast<A, B> = A extends B ? A : B;
8
+ type Narrowable = string | number | bigint | boolean;
9
+ type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({
10
10
  [K in keyof A]: Narrow<A[K]>;
11
11
  })>;
12
- declare type Exact<C, T> = {
12
+ type Exact<C, T> = {
13
13
  [K in keyof C]: K extends keyof T ? T[K] : never;
14
14
  };
15
- export declare type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
15
+ export type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
16
16
  export declare function setupDevtoolsPlugin<TDescriptor extends Exact<TDescriptor, PluginDescriptor>, TSettings = ExtractSettingsTypes<TDescriptor extends {
17
17
  settings: infer S;
18
18
  } ? S extends Record<string, PluginSettingsItem> ? S : Record<string, PluginSettingsItem> : Record<string, PluginSettingsItem>>>(pluginDescriptor: Narrow<TDescriptor>, setupFn: SetupFunction<TSettings>): void;
package/lib/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getTarget, getDevtoolsGlobalHook, isProxyAvailable } from './env.js';
1
+ import { getDevtoolsGlobalHook, getTarget, isProxyAvailable } from './env.js';
2
2
  import { HOOK_SETUP } from './const.js';
3
3
  import { ApiProxy } from './proxy.js';
4
4
  export * from './api/index.js';
@@ -20,7 +20,8 @@ export function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
20
20
  setupFn,
21
21
  proxy,
22
22
  });
23
- if (proxy)
23
+ if (proxy) {
24
24
  setupFn(proxy.proxiedTarget);
25
+ }
25
26
  }
26
27
  }
@@ -16,7 +16,7 @@ export interface PluginDescriptor {
16
16
  enableEarlyProxy?: boolean;
17
17
  settings?: Record<string, PluginSettingsItem>;
18
18
  }
19
- export declare type PluginSettingsItem = {
19
+ export type PluginSettingsItem = {
20
20
  label: string;
21
21
  description?: string;
22
22
  } & ({
@@ -34,14 +34,14 @@ export declare type PluginSettingsItem = {
34
34
  type: 'text';
35
35
  defaultValue: string;
36
36
  });
37
- declare type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{
37
+ type InferSettingsType<T extends PluginSettingsItem> = [T] extends [{
38
38
  type: 'boolean';
39
39
  }] ? boolean : [T] extends [{
40
40
  type: 'choice';
41
41
  }] ? T['options'][number]['value'] : [T] extends [{
42
42
  type: 'text';
43
43
  }] ? string : unknown;
44
- export declare type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = {
44
+ export type ExtractSettingsTypes<O extends Record<string, PluginSettingsItem>> = {
45
45
  [K in keyof O]: InferSettingsType<O[K]>;
46
46
  };
47
47
  export {};
package/lib/esm/proxy.js CHANGED
@@ -83,7 +83,7 @@ export class ApiProxy {
83
83
  }
84
84
  else {
85
85
  return (...args) => {
86
- return new Promise(resolve => {
86
+ return new Promise((resolve) => {
87
87
  this.targetQueue.push({
88
88
  method: prop,
89
89
  args,
package/lib/esm/time.js CHANGED
@@ -9,9 +9,9 @@ export function isPerformanceSupported() {
9
9
  supported = true;
10
10
  perf = window.performance;
11
11
  }
12
- else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
12
+ else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
13
13
  supported = true;
14
- perf = global.perf_hooks.performance;
14
+ perf = globalThis.perf_hooks.performance;
15
15
  }
16
16
  else {
17
17
  supported = false;
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@vue/devtools-api",
3
- "version": "6.5.1",
3
+ "version": "6.6.1",
4
4
  "description": "Interact with the Vue devtools from the page",
5
- "main": "lib/cjs/index.js",
6
- "browser": "lib/esm/index.js",
7
- "module": "lib/esm/index.js",
8
- "types": "lib/esm/index.d.ts",
9
- "sideEffects": false,
10
5
  "author": {
11
6
  "name": "Guillaume Chau"
12
7
  },
13
- "files": [
14
- "lib/esm",
15
- "lib/cjs"
16
- ],
17
8
  "license": "MIT",
18
9
  "repository": {
19
10
  "url": "https://github.com/vuejs/vue-devtools.git",
20
11
  "type": "git",
21
12
  "directory": "packages/api"
22
13
  },
14
+ "sideEffects": false,
15
+ "main": "lib/cjs/index.js",
16
+ "browser": "lib/esm/index.js",
17
+ "module": "lib/esm/index.js",
18
+ "types": "lib/esm/index.d.ts",
19
+ "files": [
20
+ "lib/cjs",
21
+ "lib/esm"
22
+ ],
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
@@ -30,8 +30,8 @@
30
30
  "build:watch": "yarn tsc --module es2015 --outDir lib/esm -d -w --sourceMap"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^13.9.1",
33
+ "@types/node": "^20.11.16",
34
34
  "@types/webpack-env": "^1.15.1",
35
- "typescript": "^4.5.2"
35
+ "typescript": "^5.3.3"
36
36
  }
37
37
  }