@nuxt/devtools-kit 1.3.14 → 1.4.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/dist/runtime/host-client.d.ts +4 -0
- package/dist/runtime/host-client.mjs +34 -0
- package/host-client.d.ts +1 -0
- package/host-client.mjs +1 -0
- package/package.json +8 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuxtDevtoolsHostClient } from '../types';
|
|
3
|
+
export declare function onDevtoolsHostClientConnected(fn: (client: NuxtDevtoolsHostClient) => void): (() => void) | undefined;
|
|
4
|
+
export declare function useDevtoolsHostClient(): Ref<NuxtDevtoolsHostClient | undefined>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { shallowRef } from "vue";
|
|
2
|
+
let clientRef;
|
|
3
|
+
const fns = [];
|
|
4
|
+
export function onDevtoolsHostClientConnected(fn) {
|
|
5
|
+
fns.push(fn);
|
|
6
|
+
if (typeof window === "undefined")
|
|
7
|
+
return;
|
|
8
|
+
if (window.__NUXT_DEVTOOLS_HOST__) {
|
|
9
|
+
fns.forEach((fn2) => fn2(window.__NUXT_DEVTOOLS_HOST__));
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(window, "__NUXT_DEVTOOLS_HOST__", {
|
|
12
|
+
set(value) {
|
|
13
|
+
if (value)
|
|
14
|
+
fns.forEach((fn2) => fn2(value));
|
|
15
|
+
},
|
|
16
|
+
get() {
|
|
17
|
+
return clientRef.value;
|
|
18
|
+
},
|
|
19
|
+
configurable: true
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
fns.splice(fns.indexOf(fn), 1);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function useDevtoolsHostClient() {
|
|
26
|
+
if (!clientRef) {
|
|
27
|
+
clientRef = shallowRef();
|
|
28
|
+
onDevtoolsHostClientConnected(setup);
|
|
29
|
+
}
|
|
30
|
+
function setup(client) {
|
|
31
|
+
clientRef.value = client;
|
|
32
|
+
}
|
|
33
|
+
return clientRef;
|
|
34
|
+
}
|
package/host-client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/runtime/host-client'
|
package/host-client.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/runtime/host-client.mjs'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/devtools-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://devtools.nuxt.com/module/utils-kit",
|
|
7
7
|
"repository": {
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"./iframe-client": {
|
|
24
24
|
"types": "./iframe-client.d.ts",
|
|
25
25
|
"import": "./iframe-client.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./host-client": {
|
|
28
|
+
"types": "./host-client.d.ts",
|
|
29
|
+
"import": "./host-client.mjs"
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"main": "./dist/index.cjs",
|
|
@@ -37,8 +41,8 @@
|
|
|
37
41
|
"vite": "*"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@nuxt/kit": "^3.
|
|
41
|
-
"@nuxt/schema": "^3.
|
|
44
|
+
"@nuxt/kit": "^3.13.0",
|
|
45
|
+
"@nuxt/schema": "^3.13.0",
|
|
42
46
|
"execa": "^7.2.0"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
@@ -46,7 +50,7 @@
|
|
|
46
50
|
"error-stack-parser-es": "^0.1.5",
|
|
47
51
|
"hookable": "^5.5.3",
|
|
48
52
|
"unbuild": "^2.0.0",
|
|
49
|
-
"unimport": "^3.
|
|
53
|
+
"unimport": "^3.11.1",
|
|
50
54
|
"vite-plugin-vue-inspector": "^5.1.3",
|
|
51
55
|
"vue-router": "^4.4.3"
|
|
52
56
|
},
|