@vue/devtools-api 6.0.12 → 6.1.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/index.js +1 -0
- package/lib/cjs/proxy.js +4 -0
- package/lib/cjs/time.js +28 -0
- package/lib/esm/api/api.d.ts +1 -0
- package/lib/esm/api/component.d.ts +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/proxy.js +4 -0
- package/lib/esm/time.d.ts +2 -0
- package/lib/esm/time.js +23 -0
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const const_1 = require("./const");
|
|
|
16
16
|
const proxy_1 = require("./proxy");
|
|
17
17
|
__exportStar(require("./api"), exports);
|
|
18
18
|
__exportStar(require("./plugin"), exports);
|
|
19
|
+
__exportStar(require("./time"), exports);
|
|
19
20
|
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
20
21
|
const descriptor = pluginDescriptor;
|
|
21
22
|
const target = (0, env_1.getTarget)();
|
package/lib/cjs/proxy.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApiProxy = void 0;
|
|
4
4
|
const const_1 = require("./const");
|
|
5
|
+
const time_1 = require("./time");
|
|
5
6
|
class ApiProxy {
|
|
6
7
|
constructor(plugin, hook) {
|
|
7
8
|
this.target = null;
|
|
@@ -39,6 +40,9 @@ class ApiProxy {
|
|
|
39
40
|
}
|
|
40
41
|
currentSettings = value;
|
|
41
42
|
},
|
|
43
|
+
now() {
|
|
44
|
+
return (0, time_1.now)();
|
|
45
|
+
},
|
|
42
46
|
};
|
|
43
47
|
if (hook) {
|
|
44
48
|
hook.on(const_1.HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
package/lib/cjs/time.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.now = exports.isPerformanceSupported = void 0;
|
|
4
|
+
let supported;
|
|
5
|
+
let perf;
|
|
6
|
+
function isPerformanceSupported() {
|
|
7
|
+
var _a;
|
|
8
|
+
if (supported !== undefined) {
|
|
9
|
+
return supported;
|
|
10
|
+
}
|
|
11
|
+
if (typeof window !== 'undefined' && window.performance) {
|
|
12
|
+
supported = true;
|
|
13
|
+
perf = window.performance;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
16
|
+
supported = true;
|
|
17
|
+
perf = global.perf_hooks.performance;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
supported = false;
|
|
21
|
+
}
|
|
22
|
+
return supported;
|
|
23
|
+
}
|
|
24
|
+
exports.isPerformanceSupported = isPerformanceSupported;
|
|
25
|
+
function now() {
|
|
26
|
+
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
27
|
+
}
|
|
28
|
+
exports.now = now;
|
package/lib/esm/api/api.d.ts
CHANGED
package/lib/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DevtoolsPluginApi } from './api';
|
|
|
2
2
|
import { PluginDescriptor, ExtractSettingsTypes, PluginSettingsItem } from './plugin';
|
|
3
3
|
export * from './api';
|
|
4
4
|
export * from './plugin';
|
|
5
|
+
export * from './time';
|
|
5
6
|
export { PluginQueueItem } from './env';
|
|
6
7
|
declare type Cast<A, B> = A extends B ? A : B;
|
|
7
8
|
declare type Narrowable = string | number | bigint | boolean;
|
package/lib/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { HOOK_SETUP } from './const';
|
|
|
3
3
|
import { ApiProxy } from './proxy';
|
|
4
4
|
export * from './api';
|
|
5
5
|
export * from './plugin';
|
|
6
|
+
export * from './time';
|
|
6
7
|
export function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
7
8
|
const descriptor = pluginDescriptor;
|
|
8
9
|
const target = getTarget();
|
package/lib/esm/proxy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HOOK_PLUGIN_SETTINGS_SET } from './const';
|
|
2
|
+
import { now } from './time';
|
|
2
3
|
export class ApiProxy {
|
|
3
4
|
constructor(plugin, hook) {
|
|
4
5
|
this.target = null;
|
|
@@ -36,6 +37,9 @@ export class ApiProxy {
|
|
|
36
37
|
}
|
|
37
38
|
currentSettings = value;
|
|
38
39
|
},
|
|
40
|
+
now() {
|
|
41
|
+
return now();
|
|
42
|
+
},
|
|
39
43
|
};
|
|
40
44
|
if (hook) {
|
|
41
45
|
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
package/lib/esm/time.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
let supported;
|
|
2
|
+
let perf;
|
|
3
|
+
export function isPerformanceSupported() {
|
|
4
|
+
var _a;
|
|
5
|
+
if (supported !== undefined) {
|
|
6
|
+
return supported;
|
|
7
|
+
}
|
|
8
|
+
if (typeof window !== 'undefined' && window.performance) {
|
|
9
|
+
supported = true;
|
|
10
|
+
perf = window.performance;
|
|
11
|
+
}
|
|
12
|
+
else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
13
|
+
supported = true;
|
|
14
|
+
perf = global.perf_hooks.performance;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
supported = false;
|
|
18
|
+
}
|
|
19
|
+
return supported;
|
|
20
|
+
}
|
|
21
|
+
export function now() {
|
|
22
|
+
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
23
|
+
}
|