vite-plugin-vue-devtools 0.5.1 → 1.0.0-alpha.2

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.
Files changed (44) hide show
  1. package/README.md +14 -14
  2. package/client.d.ts +55 -0
  3. package/dist/client/assets/{VIcon.vue_vue_type_script_setup_true_lang-3e22beca.js → Icon.vue_vue_type_script_setup_true_lang-9344440e.js} +2 -2
  4. package/dist/client/assets/{VIconButton.vue_vue_type_script_setup_true_lang-ff741416.js → IconButton.vue_vue_type_script_setup_true_lang-f308a32e.js} +4 -5
  5. package/dist/client/assets/{VIconTitle.vue_vue_type_script_setup_true_lang-02e99d8a.js → IconTitle.vue_vue_type_script_setup_true_lang-4cf300a8.js} +2 -2
  6. package/dist/client/assets/{IframeView.vue_vue_type_script_setup_true_lang-8e5b8335.js → IframeView.vue_vue_type_script_setup_true_lang-a998c802.js} +1 -1
  7. package/dist/client/assets/{VPanelGrids-885eb297.js → PanelGrids-bf67e36d.js} +1 -1
  8. package/dist/client/assets/SectionBlock-0024395a.css +18 -0
  9. package/dist/client/assets/{VSectionBlock-2f35c742.js → SectionBlock-30cd0db7.js} +11 -11
  10. package/dist/client/assets/{StateFields.vue_vue_type_script_setup_true_lang-fe7c7e4d.js → StateFields.vue_vue_type_script_setup_true_lang-f232f911.js} +13 -13
  11. package/dist/client/assets/{VSwitch.vue_vue_type_script_setup_true_lang-a0d66c22.js → Switch.vue_vue_type_script_setup_true_lang-ff441d43.js} +6 -6
  12. package/dist/client/assets/{VTextInput.vue_vue_type_script_setup_true_lang-ae0954a4.js → TextInput.vue_vue_type_script_setup_true_lang-49fa3d66.js} +5 -5
  13. package/dist/client/assets/{__eyedropper-4021b943.js → __eyedropper-04974bae.js} +9 -5
  14. package/dist/client/assets/{assets-02a93a40.js → assets-103b7b87.js} +26 -27
  15. package/dist/client/assets/{component-docs-add44d87.js → component-docs-c0980d29.js} +9 -10
  16. package/dist/client/assets/{components-c141317d.js → components-4ea0f479.js} +16 -16
  17. package/dist/client/assets/{documentations-30350ca6.js → documentations-81489cc3.js} +4 -5
  18. package/dist/client/assets/{graph-ca7151be.js → graph-3ab96556.js} +7 -8
  19. package/dist/client/assets/{index-14f26dd8.js → index-773a455a.js} +446 -107
  20. package/dist/client/assets/{index-133eebe9.js → index-cc695468.js} +1 -1
  21. package/dist/client/assets/{inspect-5ed32f17.js → inspect-a4a1ccce.js} +2 -3
  22. package/dist/client/assets/{npm-804ed8d6.js → npm-d82cc33a.js} +17 -18
  23. package/dist/client/assets/{overview-84e0d21c.js → overview-62088e28.js} +15 -16
  24. package/dist/client/assets/{pages-6df9c706.js → pages-b69a68f5.js} +16 -16
  25. package/dist/client/assets/{pinia-760b2ad2.js → pinia-f806031f.js} +6 -6
  26. package/dist/client/assets/{routes-6636ff43.js → routes-06a1de65.js} +13 -13
  27. package/dist/client/assets/{settings-3815e37a.css → settings-7bce89ae.css} +3 -3
  28. package/dist/client/assets/{settings-85b594bd.js → settings-a01dd288.js} +36 -38
  29. package/dist/client/assets/{splitpanes.es-34ce2868.js → splitpanes.es-87d8571e.js} +1 -1
  30. package/dist/client/assets/{timeline-34b2c182.js → timeline-4af72c7c.js} +11 -11
  31. package/dist/client/index.html +1 -1
  32. package/dist/{index.cjs → vite.cjs} +9 -40
  33. package/dist/{index.mjs → vite.mjs} +7 -38
  34. package/package.json +25 -88
  35. package/src/app.js +4 -0
  36. package/src/{node/views → views}/Main.vue +14 -23
  37. package/dist/client/assets/VSectionBlock-52804693.css +0 -18
  38. package/dist/client/assets/rpc-acb85b35.js +0 -145
  39. package/src/node/app.js +0 -31
  40. /package/dist/{index.d.ts → vite.d.ts} +0 -0
  41. /package/src/{node/views → views}/ComponentInspector.vue +0 -0
  42. /package/src/{node/views → views}/FrameBox.vue +0 -0
  43. /package/src/{node/views → views}/composables.ts +0 -0
  44. /package/src/{node/views → views}/utils.ts +0 -0
@@ -1,4 +1,4 @@
1
- import { ar as h, o as openBlock, e as createElementBlock, f as renderSlot, l as normalizeStyle } from './index-14f26dd8.js';
1
+ import { ar as h, o as openBlock, e as createElementBlock, f as renderSlot, l as normalizeStyle } from './index-773a455a.js';
2
2
 
3
3
  const M = {
4
4
  name: "splitpanes",
@@ -1,11 +1,11 @@
1
- import { _ as _sfc_main$2 } from './StateFields.vue_vue_type_script_setup_true_lang-fe7c7e4d.js';
2
- import { _ as __unplugin_components_0 } from './VPanelGrids-885eb297.js';
3
- import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, _ as __unplugin_components_7, A as timelineLayer, B as activeTimelineEvents, C as activeTimelineEventIndex, D as toggleTimelineEventIndex, E as timelineEventDetails, G as activeLayerId, H as toggleTimelineLayer } from './index-14f26dd8.js';
1
+ import { _ as _sfc_main$2 } from './StateFields.vue_vue_type_script_setup_true_lang-f232f911.js';
2
+ import { _ as __unplugin_components_0 } from './PanelGrids-bf67e36d.js';
3
+ import { p as pushScopeId, a as popScopeId, n as nextTick, o as openBlock, c as createBlock, w as withScopeId, m as markRaw, s as shallowReactive, r as resolveComponent, b as resolveDirective, d as withDirectives, e as createElementBlock, f as renderSlot, g as createCommentVNode, h as withCtx, F as Fragment, i as renderList, j as resolveDynamicComponent, k as mergeProps, t as toHandlers, l as normalizeStyle, q as normalizeClass, u as createVNode, v as defineComponent, x as createBaseVNode, y as toDisplayString, z as unref, _ as __unplugin_components_7, A as timelineLayer, B as activeTimelineEvents, C as activeTimelineEventIndex, D as toggleTimelineEventIndex, E as timelineEventDetails, G as activeLayerId, H as toggleTimelineLayer } from './index-773a455a.js';
4
4
  import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-65004790.js';
5
- import { g, M } from './splitpanes.es-34ce2868.js';
6
- import './VIcon.vue_vue_type_script_setup_true_lang-3e22beca.js';
7
- import './index-133eebe9.js';
8
- import './VIconButton.vue_vue_type_script_setup_true_lang-ff741416.js';
5
+ import { g, M } from './splitpanes.es-87d8571e.js';
6
+ import './Icon.vue_vue_type_script_setup_true_lang-9344440e.js';
7
+ import './index-cc695468.js';
8
+ import './IconButton.vue_vue_type_script_setup_true_lang-f308a32e.js';
9
9
 
10
10
  var dayjs_min = {exports: {}};/* Injected with object hook! */
11
11
 
@@ -1329,8 +1329,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1329
1329
  emits: ["update-selected"],
1330
1330
  setup(__props, { emit: emits }) {
1331
1331
  return (_ctx, _cache) => {
1332
- const _component_VCard = __unplugin_components_7;
1333
- const _component_VPanelGrids = __unplugin_components_0;
1332
+ const _component_VDCard = __unplugin_components_7;
1333
+ const _component_VDPanelGrids = __unplugin_components_0;
1334
1334
  return _ctx.data.length ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
1335
1335
  createVNode(unref(script$2), {
1336
1336
  items: _ctx.data,
@@ -1365,12 +1365,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1365
1365
  ]),
1366
1366
  _: 1
1367
1367
  }, 8, ["items"])
1368
- ])) : (openBlock(), createBlock(_component_VPanelGrids, {
1368
+ ])) : (openBlock(), createBlock(_component_VDPanelGrids, {
1369
1369
  key: 1,
1370
1370
  px5: ""
1371
1371
  }, {
1372
1372
  default: withCtx(() => [
1373
- createVNode(_component_VCard, {
1373
+ createVNode(_component_VDCard, {
1374
1374
  flex: "~ col gap2",
1375
1375
  "min-w-30": "",
1376
1376
  "items-center": "",
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <link rel="icon" href="/favicon.svg" type="image/svg+xml">
7
7
  <title>Vue DevTools</title>
8
- <script type="module" crossorigin src="./assets/index-14f26dd8.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-773a455a.js"></script>
9
9
  <link rel="stylesheet" href="./assets/index-d3dcbe9e.css">
10
10
  </head>
11
11
  <body>
@@ -6,7 +6,7 @@ const vite = require('vite');
6
6
  const sirv = require('sirv');
7
7
  const Inspect = require('vite-plugin-inspect');
8
8
  const VueInspector = require('vite-plugin-vue-inspector');
9
- const birpc = require('birpc');
9
+ const core$1 = require('@vite-plugin-vue-devtools/core');
10
10
  const fs$9 = require('node:fs/promises');
11
11
  const require$$0 = require('os');
12
12
  const require$$0$1 = require('path');
@@ -50,37 +50,7 @@ const require$$0$3__default = /*#__PURE__*/_interopDefaultCompat(require$$0$3$1)
50
50
  const require$$0$5__default = /*#__PURE__*/_interopDefaultCompat(require$$0$5);
51
51
  const require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
52
52
 
53
- function createRPCServer(name, ws, functions) {
54
- const event = `${name}:rpc`;
55
- const group = birpc.createBirpcGroup(
56
- functions,
57
- () => birpc.cachedMap(
58
- Array.from(ws?.clients || []),
59
- (socket) => {
60
- return {
61
- on: (fn) => {
62
- ws.on(event, (data, source) => {
63
- if (socket === source)
64
- fn(data);
65
- });
66
- },
67
- post: (data) => {
68
- socket.send(event, data);
69
- }
70
- };
71
- }
72
- ),
73
- {
74
- timeout: -1
75
- }
76
- );
77
- ws.on("connection", () => {
78
- group.updateChannels();
79
- });
80
- return group.broadcast;
81
- }
82
-
83
- const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : path$3$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
53
+ const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : path$3$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('vite.cjs', document.baseURI).href))));
84
54
  const DIR_CLIENT = path$3$1.resolve(DIR_DIST, "../dist/client");
85
55
 
86
56
  async function getComponentsRelationships(rpc) {
@@ -13777,10 +13747,9 @@ async function getComponentInfo(root, filename) {
13777
13747
  });
13778
13748
  }
13779
13749
 
13780
- const NAME = "vite-plugin-vue-devtools";
13781
13750
  function getVueDevtoolsPath() {
13782
- const pluginPath = vite.normalizePath(path$3__default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)))));
13783
- return pluginPath.replace(/\/dist$/, "//src/node");
13751
+ const pluginPath = vite.normalizePath(path$3__default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('vite.cjs', document.baseURI).href)))));
13752
+ return pluginPath.replace(/\/dist$/, "//src");
13784
13753
  }
13785
13754
  function VitePluginVueDevTools(options = { appendTo: "" }) {
13786
13755
  const vueDevtoolsPath = getVueDevtoolsPath();
@@ -13794,9 +13763,10 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13794
13763
  single: true,
13795
13764
  dev: true
13796
13765
  }));
13797
- const rpc = createRPCServer("vite-plugin-vue-devtools", server.ws, {
13798
- componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13766
+ const rpc = core$1.createRPCServer(server.ws, {
13767
+ root: () => config.root,
13799
13768
  inspectClientUrl: () => `${config.base || "/"}__inspect/`,
13769
+ componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13800
13770
  staticAssets: () => getStaticAssets(config),
13801
13771
  getImageMeta,
13802
13772
  getTextAssetContent,
@@ -13824,12 +13794,11 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13824
13794
  else if (type === "exit")
13825
13795
  rpc.onTerminalExit({ data });
13826
13796
  }
13827
- }),
13828
- root: () => config.root
13797
+ })
13829
13798
  });
13830
13799
  }
13831
13800
  const plugin = {
13832
- name: NAME,
13801
+ name: core$1.PLUGIN_NAME,
13833
13802
  enforce: "pre",
13834
13803
  apply: "serve",
13835
13804
  configResolved(resolvedConfig) {
@@ -4,7 +4,7 @@ import { normalizePath } from 'vite';
4
4
  import sirv from 'sirv';
5
5
  import Inspect from 'vite-plugin-inspect';
6
6
  import VueInspector from 'vite-plugin-vue-inspector';
7
- import { createBirpcGroup, cachedMap } from 'birpc';
7
+ import { PLUGIN_NAME, createRPCServer } from '@vite-plugin-vue-devtools/core';
8
8
  import fs$9 from 'node:fs/promises';
9
9
  import require$$0 from 'os';
10
10
  import require$$0$1 from 'path';
@@ -24,36 +24,6 @@ import require$$0$5 from 'buffer';
24
24
  import { debuglog } from 'node:util';
25
25
  import require$$1 from 'tty';
26
26
 
27
- function createRPCServer(name, ws, functions) {
28
- const event = `${name}:rpc`;
29
- const group = createBirpcGroup(
30
- functions,
31
- () => cachedMap(
32
- Array.from(ws?.clients || []),
33
- (socket) => {
34
- return {
35
- on: (fn) => {
36
- ws.on(event, (data, source) => {
37
- if (socket === source)
38
- fn(data);
39
- });
40
- },
41
- post: (data) => {
42
- socket.send(event, data);
43
- }
44
- };
45
- }
46
- ),
47
- {
48
- timeout: -1
49
- }
50
- );
51
- ws.on("connection", () => {
52
- group.updateChannels();
53
- });
54
- return group.broadcast;
55
- }
56
-
57
27
  const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
58
28
  const DIR_CLIENT = resolve$1(DIR_DIST, "../dist/client");
59
29
 
@@ -13751,10 +13721,9 @@ async function getComponentInfo(root, filename) {
13751
13721
  });
13752
13722
  }
13753
13723
 
13754
- const NAME = "vite-plugin-vue-devtools";
13755
13724
  function getVueDevtoolsPath() {
13756
13725
  const pluginPath = normalizePath(path$3$1.dirname(fileURLToPath(import.meta.url)));
13757
- return pluginPath.replace(/\/dist$/, "//src/node");
13726
+ return pluginPath.replace(/\/dist$/, "//src");
13758
13727
  }
13759
13728
  function VitePluginVueDevTools(options = { appendTo: "" }) {
13760
13729
  const vueDevtoolsPath = getVueDevtoolsPath();
@@ -13768,9 +13737,10 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13768
13737
  single: true,
13769
13738
  dev: true
13770
13739
  }));
13771
- const rpc = createRPCServer("vite-plugin-vue-devtools", server.ws, {
13772
- componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13740
+ const rpc = createRPCServer(server.ws, {
13741
+ root: () => config.root,
13773
13742
  inspectClientUrl: () => `${config.base || "/"}__inspect/`,
13743
+ componentGraph: () => getComponentsRelationships(inspect.api.rpc),
13774
13744
  staticAssets: () => getStaticAssets(config),
13775
13745
  getImageMeta,
13776
13746
  getTextAssetContent,
@@ -13798,12 +13768,11 @@ function VitePluginVueDevTools(options = { appendTo: "" }) {
13798
13768
  else if (type === "exit")
13799
13769
  rpc.onTerminalExit({ data });
13800
13770
  }
13801
- }),
13802
- root: () => config.root
13771
+ })
13803
13772
  });
13804
13773
  }
13805
13774
  const plugin = {
13806
- name: NAME,
13775
+ name: PLUGIN_NAME,
13807
13776
  enforce: "pre",
13808
13777
  apply: "serve",
13809
13778
  configResolved(resolvedConfig) {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "vite-plugin-vue-devtools",
3
- "version": "0.5.1",
4
- "packageManager": "pnpm@8.6.7",
3
+ "type": "module",
4
+ "version": "1.0.0-alpha.2",
5
5
  "description": "A vite plugin for Vue DevTools",
6
6
  "author": "webfansplz",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/webfansplz/vite-plugin-vue-devtools#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/webfansplz/vite-plugin-vue-devtools.git"
11
+ "url": "git+https://github.com/webfansplz/vite-plugin-vue-devtools.git",
12
+ "directory": "packages/node"
12
13
  },
13
14
  "bugs": {
14
15
  "url": "https://github.com/webfansplz/vite-plugin-vue-devtools/issues"
@@ -21,111 +22,47 @@
21
22
  ],
22
23
  "exports": {
23
24
  ".": {
24
- "types": "./dist/index.d.ts",
25
- "require": "./dist/index.cjs",
26
- "import": "./dist/index.mjs"
25
+ "types": "./dist/vite.d.ts",
26
+ "require": "./dist/vite.cjs",
27
+ "import": "./dist/vite.mjs"
27
28
  },
28
- "./*": "./*"
29
+ "./*": "./*",
30
+ "./client": {
31
+ "types": "./client.d.ts"
32
+ }
29
33
  },
30
- "main": "dist/index.cjs",
31
- "module": "dist/index.mjs",
32
- "types": "dist/index.d.ts",
34
+ "main": "dist/vite.cjs",
35
+ "module": "dist/vite.mjs",
36
+ "types": "dist/vite.d.ts",
33
37
  "files": [
34
38
  "dist",
35
- "src/node/views/*",
36
- "src/node/app.js",
39
+ "./src/views/*",
40
+ "./src/app.js",
37
41
  "*.d.ts"
38
42
  ],
39
43
  "engines": {
40
- "node": ">=v14"
41
- },
42
- "scripts": {
43
- "build": "rimraf dist && run-s build:*",
44
- "build:client": "vite build src/client",
45
- "build:js": "unbuild",
46
- "dev": "nr stub && pnpm dev:client",
47
- "dev:client": "vite build src/client --watch",
48
- "play": "nr -C playground dev",
49
- "stub": "unbuild --stub",
50
- "lint": "eslint .",
51
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
52
- "prepublishOnly": "npm run build",
53
- "release": "bumpp && nr changelog && npm publish",
54
- "dep:up": "taze -I major"
44
+ "node": ">=v14.21.3"
55
45
  },
56
46
  "peerDependencies": {
57
47
  "vite": "^3.1.0 || ^4.0.0-0"
58
48
  },
59
49
  "dependencies": {
60
- "@vueuse/core": "^10.2.1",
61
- "@vueuse/integrations": "^10.2.1",
62
50
  "@webfansplz/vuedoc-parser": "^0.0.3",
63
- "algoliasearch": "^4.18.0",
64
51
  "birpc": "^0.2.12",
65
52
  "execa": "^7.1.1",
66
- "json-editor-vue": "^0.10.6",
67
- "minimatch": "^9.0.3",
68
- "nanoid": "^4.0.2",
69
53
  "sirv": "^2.0.3",
70
- "splitpanes": "^3.1.5",
71
- "vanilla-jsoneditor": "^0.17.8",
72
- "vite-hot-client": "^0.2.1",
73
- "vite-plugin-inspect": "^0.7.32",
54
+ "vite-plugin-inspect": "^0.7.33",
74
55
  "vite-plugin-vue-inspector": "^3.4.2",
75
- "vue-router": "^4.2.4",
76
- "vuedraggable": "^4.1.0",
77
- "xterm": "^5.2.1",
78
- "xterm-addon-fit": "^0.7.0"
56
+ "@vite-plugin-vue-devtools/core": "1.0.0-alpha.2"
79
57
  },
80
58
  "devDependencies": {
81
- "@algolia/client-search": "^4.18.0",
82
- "@antfu/eslint-config": "^0.39.7",
83
- "@antfu/ni": "^0.21.4",
84
- "@iconify/json": "^2.2.88",
85
- "@nuxt/devtools-ui-kit": "^0.6.7",
86
- "@types/codemirror": "^5.60.8",
87
- "@types/node": "^20.4.1",
88
- "@types/splitpanes": "^2.2.1",
89
- "@unocss/eslint-config": "^0.53.5",
90
- "@unocss/reset": "^0.53.5",
91
- "@vitejs/plugin-vue": "^4.2.3",
92
- "@vitejs/plugin-vue-jsx": "^3.0.1",
93
- "bumpp": "^9.1.1",
94
- "codemirror": "^6.0.1",
95
- "codemirror-theme-vars": "^0.1.2",
96
- "conventional-changelog-cli": "^3.0.0",
97
- "dayjs": "^1.11.9",
98
- "eslint": "8.44.0",
59
+ "@types/node": "^20.4.2",
99
60
  "fast-glob": "^3.3.0",
100
- "floating-vue": "2.0.0-beta.24",
101
- "fuse.js": "^6.6.2",
102
61
  "image-meta": "^0.1.1",
103
- "lint-staged": "^13.2.3",
104
- "npm-run-all": "^4.1.5",
105
- "ohash": "^1.1.2",
106
- "pathe": "^1.1.1",
107
- "pinia": "^2.1.4",
108
- "pnpm": "^8.6.7",
109
- "rimraf": "^5.0.1",
110
- "simple-git-hooks": "^2.8.1",
111
- "taze": "^0.11.2",
112
- "typescript": "^5.1.6",
113
- "unbuild": "^1.2.1",
114
- "unocss": "^0.53.5",
115
- "unplugin-auto-import": "^0.16.6",
116
- "unplugin-vue-components": "^0.25.1",
117
- "vis-data": "^7.1.6",
118
- "vis-network": "^9.1.6",
119
- "vite": "^4.4.2",
120
- "vite-dev-rpc": "^0.1.2",
121
- "vite-plugin-pages": "^0.31.0",
122
- "vue": "^3.3.4",
123
- "vue-virtual-scroller": "2.0.0-beta.8"
62
+ "pathe": "^1.1.1"
124
63
  },
125
- "simple-git-hooks": {
126
- "pre-commit": "pnpm lint-staged"
127
- },
128
- "lint-staged": {
129
- "*": "eslint --fix"
64
+ "scripts": {
65
+ "build": "unbuild",
66
+ "stub": "unbuild --stub"
130
67
  }
131
- }
68
+ }
package/src/app.js ADDED
@@ -0,0 +1,4 @@
1
+ import { createDevToolsContainer } from '@vite-plugin-vue-devtools/core'
2
+ import App from 'virtual:vue-devtools-path:views/Main.vue'
3
+
4
+ createDevToolsContainer(App)
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue'
3
3
 
4
4
  // @ts-expect-error virtual module
5
5
  import vueDevToolsOptions from 'virtual:vue-devtools-options'
6
+ import { DevToolsHooks, collectDevToolsHookBuffer } from '@vite-plugin-vue-devtools/core'
6
7
  import Frame from './FrameBox.vue'
7
8
  import ComponentInspector from './ComponentInspector.vue'
8
9
  import { useHighlightComponent, useIframe, useInspector, usePanelVisible, usePiPMode, usePosition } from './composables'
@@ -17,19 +18,7 @@ const props = defineProps({
17
18
 
18
19
  const hook = props.hook
19
20
 
20
- const DevToolsHooks = {
21
- APP_INIT: 'app:init',
22
- COMPONENT_UPDATED: 'component:updated',
23
- COMPONENT_ADDED: 'component:added',
24
- COMPONENT_REMOVED: 'component:removed',
25
- COMPONENT_EMIT: 'component:emit',
26
- PERF_START: 'perf:start',
27
- PERF_END: 'perf:end',
28
- ADD_ROUTE: 'router:add-route',
29
- REMOVE_ROUTE: 'router:remove-route',
30
- }
31
-
32
- const hookBuffer: [string, { args: any[] }][] = []
21
+ const { hookBuffer, collect } = collectDevToolsHookBuffer()
33
22
 
34
23
  let isAppCreated = false
35
24
  const panelState = ref<{
@@ -138,10 +127,6 @@ async function setupClient(iframe: HTMLIFrameElement) {
138
127
  })
139
128
  }
140
129
 
141
- function updateHookBuffer(type, args) {
142
- hookBuffer.push([type, args])
143
- }
144
-
145
130
  function collectDynamicRoute(app) {
146
131
  const router = app?.config?.globalProperties?.$router
147
132
  if (!router)
@@ -152,7 +137,7 @@ function collectDynamicRoute(app) {
152
137
  const res = _addRoute(...args)
153
138
 
154
139
  if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
155
- updateHookBuffer(DevToolsHooks.ADD_ROUTE, {
140
+ collect(DevToolsHooks.ADD_ROUTE, {
156
141
  args: [...args],
157
142
  })
158
143
  }
@@ -165,7 +150,7 @@ function collectDynamicRoute(app) {
165
150
  const res = _removeRoute(...args)
166
151
 
167
152
  if (!iframe.value?.contentWindow?.__VUE_DEVTOOLS_VIEW__?.loaded) {
168
- updateHookBuffer(DevToolsHooks.REMOVE_ROUTE, {
153
+ collect(DevToolsHooks.REMOVE_ROUTE, {
169
154
  args: [...args],
170
155
  })
171
156
  }
@@ -186,7 +171,7 @@ function collectHookBuffer() {
186
171
  return
187
172
 
188
173
  collectDynamicRoute(app)
189
- updateHookBuffer(DevToolsHooks.APP_INIT, {
174
+ collect(DevToolsHooks.APP_INIT, {
190
175
  app,
191
176
  })
192
177
  setTimeout(() => {
@@ -199,7 +184,7 @@ function collectHookBuffer() {
199
184
  // if (stopCollect(component))
200
185
  // return
201
186
 
202
- // updateHookBuffer(DevToolsHooks.COMPONENT_EMIT, {
187
+ // collect(DevToolsHooks.COMPONENT_EMIT, {
203
188
  // now: Date.now(),
204
189
  // app,
205
190
  // uid,
@@ -213,7 +198,7 @@ function collectHookBuffer() {
213
198
  // if (stopCollect(component))
214
199
  // return
215
200
 
216
- // updateHookBuffer(DevToolsHooks.PERF_END, {
201
+ // collect(DevToolsHooks.PERF_END, {
217
202
  // now: Date.now(),
218
203
  // app,
219
204
  // uid,
@@ -234,7 +219,7 @@ function collectHookBuffer() {
234
219
  if (!app || (typeof uid !== 'number' && !uid) || !component || stopCollect(component))
235
220
  return
236
221
 
237
- updateHookBuffer(item, {
222
+ collect(item, {
238
223
  app, uid, parentUid, component,
239
224
  })
240
225
  })
@@ -407,4 +392,10 @@ collectHookBuffer()
407
392
  opacity: 0.2;
408
393
  }
409
394
  }
395
+
396
+ @media print {
397
+ #vue-devtools-anchor {
398
+ display: none;
399
+ }
400
+ }
410
401
  </style>
@@ -1,18 +0,0 @@
1
-
2
- details[data-v-cf2e46eb] {
3
- border-style:none;;
4
- }
5
- summary[data-v-cf2e46eb] {
6
- border-style:none;;
7
- list-style: none;
8
- }
9
- details[open] summary[data-v-cf2e46eb] {
10
- border-style:none;;
11
- }
12
- details summary[data-v-cf2e46eb]::-webkit-details-marker {
13
- display:none;
14
- }
15
- details[open] .chevron[data-v-cf2e46eb] {
16
- transform: rotate(180deg);
17
- opacity: 0.75;
18
- }
@@ -1,145 +0,0 @@
1
- import { cy as __vitePreload, cc as hookApi } from './index-14f26dd8.js';
2
-
3
- async function getViteClient(base = "/", warning = true) {
4
- try {
5
- return await __vitePreload(() => import(
6
- /* @vite-ignore */
7
- `${base}@vite/client`
8
- ),true?[]:void 0,import.meta.url);
9
- } catch {
10
- if (warning)
11
- console.error(`[vite-plugin-hot] Failed to import "${base}@vite/client"`);
12
- }
13
- return void 0;
14
- }
15
- async function createHotContext(path = "/____", base = "/") {
16
- const viteClient = await getViteClient(base);
17
- return viteClient?.createHotContext(path);
18
- }
19
-
20
- /* Injected with object hook! */
21
-
22
- const DEFAULT_TIMEOUT = 6e4;
23
- function defaultSerialize(i) {
24
- return i;
25
- }
26
- const defaultDeserialize = defaultSerialize;
27
- const { setTimeout } = globalThis;
28
- const random = Math.random.bind(Math);
29
- function createBirpc(functions, options) {
30
- const {
31
- post,
32
- on,
33
- eventNames = [],
34
- serialize = defaultSerialize,
35
- deserialize = defaultDeserialize,
36
- resolver,
37
- timeout = DEFAULT_TIMEOUT
38
- } = options;
39
- const rpcPromiseMap = /* @__PURE__ */ new Map();
40
- let _promise;
41
- const rpc = new Proxy({}, {
42
- get(_, method) {
43
- if (method === "$functions")
44
- return functions;
45
- const sendEvent = (...args) => {
46
- post(serialize({ m: method, a: args, t: "q" }));
47
- };
48
- if (eventNames.includes(method)) {
49
- sendEvent.asEvent = sendEvent;
50
- return sendEvent;
51
- }
52
- const sendCall = async (...args) => {
53
- await _promise;
54
- return new Promise((resolve, reject) => {
55
- const id = nanoid();
56
- rpcPromiseMap.set(id, { resolve, reject });
57
- post(serialize({ m: method, a: args, i: id, t: "q" }));
58
- if (timeout >= 0) {
59
- setTimeout(() => {
60
- reject(new Error(`[birpc] timeout on calling "${method}"`));
61
- rpcPromiseMap.delete(id);
62
- }, timeout);
63
- }
64
- });
65
- };
66
- sendCall.asEvent = sendEvent;
67
- return sendCall;
68
- }
69
- });
70
- _promise = on(async (data, ...extra) => {
71
- const msg = deserialize(data);
72
- if (msg.t === "q") {
73
- const { m: method, a: args } = msg;
74
- let result, error;
75
- const fn = resolver ? resolver(method, functions[method]) : functions[method];
76
- if (!fn) {
77
- error = new Error(`[birpc] function "${method}" not found`);
78
- } else {
79
- try {
80
- result = await fn.apply(rpc, args);
81
- } catch (e) {
82
- error = e;
83
- }
84
- }
85
- if (msg.i) {
86
- if (error && options.onError)
87
- options.onError(error, method, args);
88
- post(serialize({ t: "s", i: msg.i, r: result, e: error }), ...extra);
89
- }
90
- } else {
91
- const { i: ack, r: result, e: error } = msg;
92
- const promise = rpcPromiseMap.get(ack);
93
- if (promise) {
94
- if (error)
95
- promise.reject(error);
96
- else
97
- promise.resolve(result);
98
- }
99
- rpcPromiseMap.delete(ack);
100
- }
101
- });
102
- return rpc;
103
- }
104
- const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
105
- function nanoid(size = 21) {
106
- let id = "";
107
- let i = size;
108
- while (i--)
109
- id += urlAlphabet[random() * 64 | 0];
110
- return id;
111
- }
112
-
113
- /* Injected with object hook! */
114
-
115
- function createRPCClient(name, hot, functions = {}) {
116
- const event = `${name}:rpc`;
117
- return createBirpc(
118
- functions,
119
- {
120
- on: async (fn) => {
121
- (await hot).on(event, fn);
122
- },
123
- post: async (data) => {
124
- (await hot).send(event, data);
125
- },
126
- timeout: -1
127
- }
128
- );
129
- }
130
-
131
- /* Injected with object hook! */
132
-
133
- const rpc = createRPCClient("vite-plugin-vue-devtools", await createHotContext("/___", `${location.pathname.split("/__devtools__")[0] || ""}/`.replace(/\/\//g, "/")), {
134
- onTerminalData({ data }) {
135
- hookApi.hook.emit("__vue-devtools:terminal:data__", data);
136
- },
137
- onTerminalExit({ data }) {
138
- hookApi.hook.emit("__vue-devtools:terminal:exit__", data);
139
- }
140
- });
141
- const inspectClientUrl = await rpc.inspectClientUrl();
142
-
143
- /* Injected with object hook! */
144
-
145
- export { inspectClientUrl as i, rpc as r };