vite-plugin-vue-devtools 7.2.0 → 7.3.0-beta.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.
Files changed (47) hide show
  1. package/client/assets/index-DhLLQ7AJ.css +1 -0
  2. package/client/assets/{index-CDBAuZCi.js → index-I7cYn7yD.js} +112 -113
  3. package/client/assets/{unocss-runtime-C2aH1Jer.js → unocss-runtime-DET60yni.js} +2 -2
  4. package/client/assets/{vue-yccoFuXf-q8nGVquG.js → vue-CCacahFR-CRnm5w84.js} +2 -2
  5. package/client/assets/{vue-CMvPPucx.js → vue-CpF6k_42.js} +2 -2
  6. package/client/assets/{vue-html-PWeNQaIl-ChlIBMe8.js → vue-html-Cae35ipv-514FnJ3-.js} +1 -1
  7. package/client/assets/{vue-html-DxgvOoVJ.js → vue-html-aHkQr8H2.js} +1 -1
  8. package/client/css-CAzixsid-CEpuX1HY.js +511 -0
  9. package/client/css-CAzixsid.js +511 -0
  10. package/client/devtools-panel.css +1 -0
  11. package/client/devtools-panel.js +92963 -0
  12. package/client/diff-Bo5iyMQ2-Bo5iyMQ2.js +7 -0
  13. package/client/diff-Bo5iyMQ2.js +7 -0
  14. package/client/html-BZB5lEhh-B74zAnWx.js +84 -0
  15. package/client/html-BZB5lEhh.js +84 -0
  16. package/client/index.html +2 -2
  17. package/client/javascript-DqVBMyXe-DqVBMyXe.js +705 -0
  18. package/client/javascript-DqVBMyXe.js +705 -0
  19. package/client/json-B12k4-6m-B12k4-6m.js +31 -0
  20. package/client/json-B12k4-6m.js +31 -0
  21. package/client/shellscript-C_gmBC5P-C_gmBC5P.js +7 -0
  22. package/client/shellscript-C_gmBC5P.js +7 -0
  23. package/client/typescript-AEg-ehu7-AEg-ehu7.js +672 -0
  24. package/client/typescript-AEg-ehu7.js +672 -0
  25. package/client/unocss-runtime-CysDdJDT.js +2041 -0
  26. package/client/vitesse-dark-CkUHDarG-CkUHDarG.js +685 -0
  27. package/client/vitesse-dark-CkUHDarG.js +685 -0
  28. package/client/vitesse-light-K81-viQS-K81-viQS.js +683 -0
  29. package/client/vitesse-light-K81-viQS.js +683 -0
  30. package/client/vue-CCacahFR-DGkPCBY5.js +2125 -0
  31. package/client/vue-CCacahFR.js +2125 -0
  32. package/client/vue-apis-Ba6Wxigc.js +1152 -0
  33. package/client/vue-html-Cae35ipv-C0hVhFzJ.js +11 -0
  34. package/client/vue-html-Cae35ipv.js +11 -0
  35. package/client/yaml-PGla5xPP-HJurM_FJ.js +206 -0
  36. package/client/yaml-PGla5xPP.js +206 -0
  37. package/dist/vite.cjs +140 -114
  38. package/dist/vite.d.cts +3 -17
  39. package/dist/vite.d.mts +3 -17
  40. package/dist/vite.d.ts +3 -17
  41. package/dist/vite.mjs +141 -115
  42. package/package.json +6 -6
  43. package/src/overlay/devtools-overlay.css +1 -1
  44. package/src/overlay/devtools-overlay.js +2 -2
  45. package/src/overlay/devtools-overlay.mjs +8 -0
  46. package/src/overlay.js +10 -4
  47. package/client/assets/index-Cka_f-Nd.css +0 -1
package/dist/vite.mjs CHANGED
@@ -3,8 +3,9 @@ import path$a, { dirname, resolve as resolve$1 } from 'node:path';
3
3
  import { normalizePath } from 'vite';
4
4
  import sirv from 'sirv';
5
5
  import Inspect from 'vite-plugin-inspect';
6
+ import { getViteRpcServer, setViteServerContext } from '@vue/devtools-kit';
6
7
  import VueInspector from 'vite-plugin-vue-inspector';
7
- import { defineViteServerAction, callViteClientListener, initViteServerContext } from '@vue/devtools-core';
8
+ import { createViteServerRpc } from '@vue/devtools-core';
8
9
  import fsp from 'node:fs/promises';
9
10
  import require$$0 from 'os';
10
11
  import require$$0$1 from 'path';
@@ -96,12 +97,6 @@ const cyan = kolorist(36, 39);
96
97
  const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
97
98
  const DIR_CLIENT = resolve$1(DIR_DIST, "../client");
98
99
 
99
- function getViteConfig(config, pluginOptions) {
100
- defineViteServerAction("get-vite-root", () => {
101
- return config.root;
102
- });
103
- }
104
-
105
100
  const DEBOUNCE_DEFAULTS = {
106
101
  trailing: true
107
102
  };
@@ -158,23 +153,6 @@ async function _applyPromised(fn, _this, args) {
158
153
  return await fn.apply(_this, args);
159
154
  }
160
155
 
161
- function setupGraphModule(options) {
162
- const { rpc, server } = options;
163
- defineViteServerAction("graph:get-modules", async () => {
164
- const list = await rpc.list();
165
- const modules = list?.modules || [];
166
- return modules;
167
- });
168
- const triggerModuleUpdated = callViteClientListener("graph:module-updated");
169
- const debouncedModuleUpdated = debounce(() => {
170
- triggerModuleUpdated();
171
- }, 100);
172
- server.middlewares.use((_, __, next) => {
173
- debouncedModuleUpdated();
174
- next();
175
- });
176
- }
177
-
178
156
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
179
157
 
180
158
  function getDefaultExportFromCjs (x) {
@@ -559,7 +537,7 @@ var utils$j = {};
559
537
  */
560
538
 
561
539
  exports.escapeNode = (block, n = 0, type) => {
562
- let node = block.nodes[n];
540
+ const node = block.nodes[n];
563
541
  if (!node) return;
564
542
 
565
543
  if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
@@ -628,13 +606,23 @@ var utils$j = {};
628
606
 
629
607
  exports.flatten = (...args) => {
630
608
  const result = [];
609
+
631
610
  const flat = arr => {
632
611
  for (let i = 0; i < arr.length; i++) {
633
- let ele = arr[i];
634
- Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
612
+ const ele = arr[i];
613
+
614
+ if (Array.isArray(ele)) {
615
+ flat(ele);
616
+ continue;
617
+ }
618
+
619
+ if (ele !== undefined) {
620
+ result.push(ele);
621
+ }
635
622
  }
636
623
  return result;
637
624
  };
625
+
638
626
  flat(args);
639
627
  return result;
640
628
  };
@@ -643,9 +631,9 @@ var utils$j = {};
643
631
  const utils$i = utils$j;
644
632
 
645
633
  var stringify$4 = (ast, options = {}) => {
646
- let stringify = (node, parent = {}) => {
647
- let invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
648
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
634
+ const stringify = (node, parent = {}) => {
635
+ const invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
636
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
649
637
  let output = '';
650
638
 
651
639
  if (node.value) {
@@ -660,7 +648,7 @@ var stringify$4 = (ast, options = {}) => {
660
648
  }
661
649
 
662
650
  if (node.nodes) {
663
- for (let child of node.nodes) {
651
+ for (const child of node.nodes) {
664
652
  output += stringify(child);
665
653
  }
666
654
  }
@@ -1034,7 +1022,7 @@ const toMaxLen = (input, maxLength) => {
1034
1022
  return negative ? ('-' + input) : input;
1035
1023
  };
1036
1024
 
1037
- const toSequence = (parts, options) => {
1025
+ const toSequence = (parts, options, maxLen) => {
1038
1026
  parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1039
1027
  parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1040
1028
 
@@ -1044,11 +1032,11 @@ const toSequence = (parts, options) => {
1044
1032
  let result;
1045
1033
 
1046
1034
  if (parts.positives.length) {
1047
- positives = parts.positives.join('|');
1035
+ positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
1048
1036
  }
1049
1037
 
1050
1038
  if (parts.negatives.length) {
1051
- negatives = `-(${prefix}${parts.negatives.join('|')})`;
1039
+ negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
1052
1040
  }
1053
1041
 
1054
1042
  if (positives && negatives) {
@@ -1146,7 +1134,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
1146
1134
 
1147
1135
  if (options.toRegex === true) {
1148
1136
  return step > 1
1149
- ? toSequence(parts, options)
1137
+ ? toSequence(parts, options, maxLen)
1150
1138
  : toRegex(range, null, { wrap: false, ...options });
1151
1139
  }
1152
1140
 
@@ -1158,7 +1146,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
1158
1146
  return invalidRange(start, end, options);
1159
1147
  }
1160
1148
 
1161
-
1162
1149
  let format = options.transform || (val => String.fromCharCode(val));
1163
1150
  let a = `${start}`.charCodeAt(0);
1164
1151
  let b = `${end}`.charCodeAt(0);
@@ -1226,30 +1213,32 @@ const fill$1 = fillRange;
1226
1213
  const utils$h = utils$j;
1227
1214
 
1228
1215
  const compile$1 = (ast, options = {}) => {
1229
- let walk = (node, parent = {}) => {
1230
- let invalidBlock = utils$h.isInvalidBrace(parent);
1231
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
1232
- let invalid = invalidBlock === true || invalidNode === true;
1233
- let prefix = options.escapeInvalid === true ? '\\' : '';
1216
+ const walk = (node, parent = {}) => {
1217
+ const invalidBlock = utils$h.isInvalidBrace(parent);
1218
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
1219
+ const invalid = invalidBlock === true || invalidNode === true;
1220
+ const prefix = options.escapeInvalid === true ? '\\' : '';
1234
1221
  let output = '';
1235
1222
 
1236
1223
  if (node.isOpen === true) {
1237
1224
  return prefix + node.value;
1238
1225
  }
1226
+
1239
1227
  if (node.isClose === true) {
1228
+ console.log('node.isClose', prefix, node.value);
1240
1229
  return prefix + node.value;
1241
1230
  }
1242
1231
 
1243
1232
  if (node.type === 'open') {
1244
- return invalid ? (prefix + node.value) : '(';
1233
+ return invalid ? prefix + node.value : '(';
1245
1234
  }
1246
1235
 
1247
1236
  if (node.type === 'close') {
1248
- return invalid ? (prefix + node.value) : ')';
1237
+ return invalid ? prefix + node.value : ')';
1249
1238
  }
1250
1239
 
1251
1240
  if (node.type === 'comma') {
1252
- return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
1241
+ return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
1253
1242
  }
1254
1243
 
1255
1244
  if (node.value) {
@@ -1257,8 +1246,8 @@ const compile$1 = (ast, options = {}) => {
1257
1246
  }
1258
1247
 
1259
1248
  if (node.nodes && node.ranges > 0) {
1260
- let args = utils$h.reduce(node.nodes);
1261
- let range = fill$1(...args, { ...options, wrap: false, toRegex: true });
1249
+ const args = utils$h.reduce(node.nodes);
1250
+ const range = fill$1(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
1262
1251
 
1263
1252
  if (range.length !== 0) {
1264
1253
  return args.length > 1 && range.length > 1 ? `(${range})` : range;
@@ -1266,10 +1255,11 @@ const compile$1 = (ast, options = {}) => {
1266
1255
  }
1267
1256
 
1268
1257
  if (node.nodes) {
1269
- for (let child of node.nodes) {
1258
+ for (const child of node.nodes) {
1270
1259
  output += walk(child, node);
1271
1260
  }
1272
1261
  }
1262
+
1273
1263
  return output;
1274
1264
  };
1275
1265
 
@@ -1283,7 +1273,7 @@ const stringify$2 = stringify$4;
1283
1273
  const utils$g = utils$j;
1284
1274
 
1285
1275
  const append = (queue = '', stash = '', enclose = false) => {
1286
- let result = [];
1276
+ const result = [];
1287
1277
 
1288
1278
  queue = [].concat(queue);
1289
1279
  stash = [].concat(stash);
@@ -1293,15 +1283,15 @@ const append = (queue = '', stash = '', enclose = false) => {
1293
1283
  return enclose ? utils$g.flatten(stash).map(ele => `{${ele}}`) : stash;
1294
1284
  }
1295
1285
 
1296
- for (let item of queue) {
1286
+ for (const item of queue) {
1297
1287
  if (Array.isArray(item)) {
1298
- for (let value of item) {
1288
+ for (const value of item) {
1299
1289
  result.push(append(value, stash, enclose));
1300
1290
  }
1301
1291
  } else {
1302
1292
  for (let ele of stash) {
1303
1293
  if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
1304
- result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
1294
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
1305
1295
  }
1306
1296
  }
1307
1297
  }
@@ -1309,9 +1299,9 @@ const append = (queue = '', stash = '', enclose = false) => {
1309
1299
  };
1310
1300
 
1311
1301
  const expand$1 = (ast, options = {}) => {
1312
- let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
1302
+ const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
1313
1303
 
1314
- let walk = (node, parent = {}) => {
1304
+ const walk = (node, parent = {}) => {
1315
1305
  node.queue = [];
1316
1306
 
1317
1307
  let p = parent;
@@ -1333,7 +1323,7 @@ const expand$1 = (ast, options = {}) => {
1333
1323
  }
1334
1324
 
1335
1325
  if (node.nodes && node.ranges > 0) {
1336
- let args = utils$g.reduce(node.nodes);
1326
+ const args = utils$g.reduce(node.nodes);
1337
1327
 
1338
1328
  if (utils$g.exceedsLimit(...args, options.step, rangeLimit)) {
1339
1329
  throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
@@ -1349,7 +1339,7 @@ const expand$1 = (ast, options = {}) => {
1349
1339
  return;
1350
1340
  }
1351
1341
 
1352
- let enclose = utils$g.encloseBrace(node);
1342
+ const enclose = utils$g.encloseBrace(node);
1353
1343
  let queue = node.queue;
1354
1344
  let block = node;
1355
1345
 
@@ -1359,7 +1349,7 @@ const expand$1 = (ast, options = {}) => {
1359
1349
  }
1360
1350
 
1361
1351
  for (let i = 0; i < node.nodes.length; i++) {
1362
- let child = node.nodes[i];
1352
+ const child = node.nodes[i];
1363
1353
 
1364
1354
  if (child.type === 'comma' && node.type === 'brace') {
1365
1355
  if (i === 1) queue.push('');
@@ -1391,7 +1381,7 @@ const expand$1 = (ast, options = {}) => {
1391
1381
  var expand_1 = expand$1;
1392
1382
 
1393
1383
  var constants$4 = {
1394
- MAX_LENGTH: 1024 * 64,
1384
+ MAX_LENGTH: 10000,
1395
1385
 
1396
1386
  // Digits
1397
1387
  CHAR_0: '0', /* 0 */
@@ -1479,18 +1469,18 @@ const parse$3 = (input, options = {}) => {
1479
1469
  throw new TypeError('Expected a string');
1480
1470
  }
1481
1471
 
1482
- let opts = options || {};
1483
- let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
1472
+ const opts = options || {};
1473
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
1484
1474
  if (input.length > max) {
1485
1475
  throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
1486
1476
  }
1487
1477
 
1488
- let ast = { type: 'root', input, nodes: [] };
1489
- let stack = [ast];
1478
+ const ast = { type: 'root', input, nodes: [] };
1479
+ const stack = [ast];
1490
1480
  let block = ast;
1491
1481
  let prev = ast;
1492
1482
  let brackets = 0;
1493
- let length = input.length;
1483
+ const length = input.length;
1494
1484
  let index = 0;
1495
1485
  let depth = 0;
1496
1486
  let value;
@@ -1555,6 +1545,7 @@ const parse$3 = (input, options = {}) => {
1555
1545
 
1556
1546
  if (value === CHAR_LEFT_SQUARE_BRACKET$1) {
1557
1547
  brackets++;
1548
+
1558
1549
  let next;
1559
1550
 
1560
1551
  while (index < length && (next = advance())) {
@@ -1610,7 +1601,7 @@ const parse$3 = (input, options = {}) => {
1610
1601
  */
1611
1602
 
1612
1603
  if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
1613
- let open = value;
1604
+ const open = value;
1614
1605
  let next;
1615
1606
 
1616
1607
  if (options.keepQuotes !== true) {
@@ -1642,8 +1633,8 @@ const parse$3 = (input, options = {}) => {
1642
1633
  if (value === CHAR_LEFT_CURLY_BRACE$1) {
1643
1634
  depth++;
1644
1635
 
1645
- let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1646
- let brace = {
1636
+ const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1637
+ const brace = {
1647
1638
  type: 'brace',
1648
1639
  open: true,
1649
1640
  close: false,
@@ -1670,7 +1661,7 @@ const parse$3 = (input, options = {}) => {
1670
1661
  continue;
1671
1662
  }
1672
1663
 
1673
- let type = 'close';
1664
+ const type = 'close';
1674
1665
  block = stack.pop();
1675
1666
  block.close = true;
1676
1667
 
@@ -1688,7 +1679,7 @@ const parse$3 = (input, options = {}) => {
1688
1679
  if (value === CHAR_COMMA$1 && depth > 0) {
1689
1680
  if (block.ranges > 0) {
1690
1681
  block.ranges = 0;
1691
- let open = block.nodes.shift();
1682
+ const open = block.nodes.shift();
1692
1683
  block.nodes = [open, { type: 'text', value: stringify$1(block) }];
1693
1684
  }
1694
1685
 
@@ -1702,7 +1693,7 @@ const parse$3 = (input, options = {}) => {
1702
1693
  */
1703
1694
 
1704
1695
  if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
1705
- let siblings = block.nodes;
1696
+ const siblings = block.nodes;
1706
1697
 
1707
1698
  if (depth === 0 || siblings.length === 0) {
1708
1699
  push({ type: 'text', value });
@@ -1729,7 +1720,7 @@ const parse$3 = (input, options = {}) => {
1729
1720
  if (prev.type === 'range') {
1730
1721
  siblings.pop();
1731
1722
 
1732
- let before = siblings[siblings.length - 1];
1723
+ const before = siblings[siblings.length - 1];
1733
1724
  before.value += prev.value + value;
1734
1725
  prev = before;
1735
1726
  block.ranges--;
@@ -1762,8 +1753,8 @@ const parse$3 = (input, options = {}) => {
1762
1753
  });
1763
1754
 
1764
1755
  // get the location of the block on parent.nodes (block's siblings)
1765
- let parent = stack[stack.length - 1];
1766
- let index = parent.nodes.indexOf(block);
1756
+ const parent = stack[stack.length - 1];
1757
+ const index = parent.nodes.indexOf(block);
1767
1758
  // replace the (invalid) block with it's nodes
1768
1759
  parent.nodes.splice(index, 1, ...block.nodes);
1769
1760
  }
@@ -1798,8 +1789,8 @@ const braces$1 = (input, options = {}) => {
1798
1789
  let output = [];
1799
1790
 
1800
1791
  if (Array.isArray(input)) {
1801
- for (let pattern of input) {
1802
- let result = braces$1.create(pattern, options);
1792
+ for (const pattern of input) {
1793
+ const result = braces$1.create(pattern, options);
1803
1794
  if (Array.isArray(result)) {
1804
1795
  output.push(...result);
1805
1796
  } else {
@@ -1933,7 +1924,7 @@ braces$1.create = (input, options = {}) => {
1933
1924
  return [input];
1934
1925
  }
1935
1926
 
1936
- return options.expand !== true
1927
+ return options.expand !== true
1937
1928
  ? braces$1.compile(input, options)
1938
1929
  : braces$1.expand(input, options);
1939
1930
  };
@@ -7726,8 +7717,8 @@ function guessType(path) {
7726
7717
  return "wasm";
7727
7718
  return "other";
7728
7719
  }
7729
- function setupAssetsModule(options) {
7730
- const { rpc, server, config } = options;
7720
+ function getAssetsFunctions(ctx) {
7721
+ const { server, config } = ctx;
7731
7722
  const _imageMetaCache = /* @__PURE__ */ new Map();
7732
7723
  let cache = null;
7733
7724
  async function scan() {
@@ -7787,42 +7778,80 @@ function setupAssetsModule(options) {
7787
7778
  }
7788
7779
  return importers;
7789
7780
  }
7790
- defineViteServerAction("assets:get-static-assets", async () => {
7791
- return await scan();
7792
- });
7793
- defineViteServerAction("assets:get-asset-importers", async (url) => {
7794
- return await getAssetImporters(url);
7795
- });
7796
- defineViteServerAction("assets:get-image-meta", async (filepath) => {
7797
- if (_imageMetaCache.has(filepath))
7798
- return _imageMetaCache.get(filepath);
7799
- try {
7800
- const meta = imageMeta(await fsp.readFile(filepath));
7801
- _imageMetaCache.set(filepath, meta);
7802
- return meta;
7803
- } catch (e) {
7804
- _imageMetaCache.set(filepath, void 0);
7805
- console.error(e);
7806
- return void 0;
7807
- }
7808
- });
7809
- defineViteServerAction("assets:get-text-asset-content", async (filepath, limit = 300) => {
7810
- try {
7811
- const content = await fsp.readFile(filepath, "utf-8");
7812
- return content.slice(0, limit);
7813
- } catch (e) {
7814
- console.error(e);
7815
- return void 0;
7816
- }
7817
- });
7818
- const triggerAssetsUpdated = callViteClientListener("assets:updated");
7819
7781
  const debouncedAssetsUpdated = debounce(() => {
7820
- triggerAssetsUpdated();
7782
+ getViteRpcServer?.()?.broadcast?.emit("assetsUpdated");
7821
7783
  }, 100);
7822
7784
  server.watcher.on("all", (event) => {
7823
7785
  if (event !== "change")
7824
7786
  debouncedAssetsUpdated();
7825
7787
  });
7788
+ return {
7789
+ async getStaticAssets() {
7790
+ return await scan();
7791
+ },
7792
+ async getAssetImporters(url) {
7793
+ return await getAssetImporters(url);
7794
+ },
7795
+ async getImageMeta(filepath) {
7796
+ if (_imageMetaCache.has(filepath))
7797
+ return _imageMetaCache.get(filepath);
7798
+ try {
7799
+ const meta = imageMeta(await fsp.readFile(filepath));
7800
+ _imageMetaCache.set(filepath, meta);
7801
+ return meta;
7802
+ } catch (e) {
7803
+ _imageMetaCache.set(filepath, void 0);
7804
+ console.error(e);
7805
+ return void 0;
7806
+ }
7807
+ },
7808
+ async getTextAssetContent(filepath, limit = 300) {
7809
+ try {
7810
+ const content = await fsp.readFile(filepath, "utf-8");
7811
+ return content.slice(0, limit);
7812
+ } catch (e) {
7813
+ console.error(e);
7814
+ return void 0;
7815
+ }
7816
+ }
7817
+ };
7818
+ }
7819
+
7820
+ function getConfigFunctions(ctx) {
7821
+ return {
7822
+ getRoot() {
7823
+ return ctx.config.root;
7824
+ }
7825
+ };
7826
+ }
7827
+
7828
+ function getGraphFunctions(ctx) {
7829
+ const { rpc, server } = ctx;
7830
+ const debouncedModuleUpdated = debounce(() => {
7831
+ getViteRpcServer?.()?.broadcast?.emit("graphModuleUpdated");
7832
+ }, 100);
7833
+ server.middlewares.use((_, __, next) => {
7834
+ debouncedModuleUpdated();
7835
+ next();
7836
+ });
7837
+ return {
7838
+ async getGraphModules() {
7839
+ const list = await rpc.list();
7840
+ const modules = list?.modules || [];
7841
+ return modules;
7842
+ }
7843
+ };
7844
+ }
7845
+
7846
+ function getRpcFunctions(ctx) {
7847
+ return {
7848
+ heartbeat() {
7849
+ return true;
7850
+ },
7851
+ ...getAssetsFunctions(ctx),
7852
+ ...getConfigFunctions(ctx),
7853
+ ...getGraphFunctions(ctx)
7854
+ };
7826
7855
  }
7827
7856
 
7828
7857
  function getVueDevtoolsPath() {
@@ -7840,7 +7869,7 @@ function normalizeComboKeyPrint(toggleComboKey) {
7840
7869
  const defaultOptions = {
7841
7870
  appendTo: "",
7842
7871
  componentInspector: true,
7843
- launchEditor: "code"
7872
+ launchEditor: process.env.LAUNCH_EDITOR ?? "code"
7844
7873
  };
7845
7874
  function mergeOptions(options) {
7846
7875
  return Object.assign({}, defaultOptions, options);
@@ -7858,17 +7887,13 @@ function VitePluginVueDevTools(options) {
7858
7887
  single: true,
7859
7888
  dev: true
7860
7889
  }));
7861
- initViteServerContext(server);
7862
- getViteConfig(config);
7863
- setupGraphModule({
7864
- rpc: inspect.api.rpc,
7865
- server
7866
- });
7867
- setupAssetsModule({
7890
+ setViteServerContext(server);
7891
+ const rpcFunctions = getRpcFunctions({
7868
7892
  rpc: inspect.api.rpc,
7869
7893
  server,
7870
7894
  config
7871
7895
  });
7896
+ createViteServerRpc(rpcFunctions);
7872
7897
  const _printUrls = server.printUrls;
7873
7898
  const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
7874
7899
  server.printUrls = () => {
@@ -7908,9 +7933,10 @@ function VitePluginVueDevTools(options) {
7908
7933
  return;
7909
7934
  const { appendTo } = pluginOptions;
7910
7935
  const [filename] = id.split("?", 2);
7911
- if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename)))
7936
+ if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename))) {
7912
7937
  code = `import 'virtual:vue-devtools-path:overlay.js';
7913
7938
  ${code}`;
7939
+ }
7914
7940
  return code;
7915
7941
  },
7916
7942
  transformIndexHtml(html) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-vue-devtools",
3
3
  "type": "module",
4
- "version": "7.2.0",
4
+ "version": "7.3.0-beta.1",
5
5
  "description": "A vite plugin for Vue DevTools",
6
6
  "author": "webfansplz",
7
7
  "license": "MIT",
@@ -49,13 +49,13 @@
49
49
  "execa": "^8.0.1",
50
50
  "sirv": "^2.0.4",
51
51
  "vite-plugin-inspect": "^0.8.4",
52
- "vite-plugin-vue-inspector": "^5.1.0",
53
- "@vue/devtools-shared": "^7.2.0",
54
- "@vue/devtools-core": "^7.2.0",
55
- "@vue/devtools-kit": "^7.2.0"
52
+ "vite-plugin-vue-inspector": "^5.1.2",
53
+ "@vue/devtools-core": "^7.3.0-beta.1",
54
+ "@vue/devtools-shared": "^7.3.0-beta.1",
55
+ "@vue/devtools-kit": "^7.3.0-beta.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/node": "^20.12.12",
58
+ "@types/node": "^20.14.2",
59
59
  "fast-glob": "^3.3.2",
60
60
  "image-meta": "^0.2.0",
61
61
  "pathe": "^1.1.2"
@@ -1 +1 @@
1
- .vue-devtools-frame[data-v-8b2fd87f]{position:fixed;z-index:2147483645}.vue-devtools-frame[data-v-8b2fd87f] iframe{width:100%;height:100%;outline:none;background:var(--vue-devtools-widget-bg);border:1px solid rgba(125,125,125,.2);border-radius:10px}.vue-devtools-frame.view-mode-xs[data-v-8b2fd87f]{width:400px!important;height:80px!important}.vue-devtools-frame.view-mode-fullscreen[data-v-8b2fd87f]{width:100vw!important;height:100vh!important;z-index:1!important;bottom:0!important;transform:none!important}.vue-devtools-frame.view-mode-fullscreen[data-v-8b2fd87f] iframe{border-radius:0!important}.vue-devtools-resize--horizontal[data-v-8b2fd87f]{position:absolute;left:6px;right:6px;height:10px;margin:-5px 0;cursor:ns-resize;border-radius:5px}.vue-devtools-resize--vertical[data-v-8b2fd87f]{position:absolute;top:6px;bottom:0;width:10px;margin:0 -5px;cursor:ew-resize;border-radius:5px}.vue-devtools-resize-corner[data-v-8b2fd87f]{position:absolute;width:14px;height:14px;margin:-6px;border-radius:6px}.vue-devtools-resize[data-v-8b2fd87f]:hover{background:#7d7d7d1a}.vue-devtools__anchor[data-v-93de249b]{position:fixed;z-index:2147483645;transform-origin:center center;transform:translate(-50%,-50%) rotate(0)}.vue-devtools__anchor.fullscreen[data-v-93de249b]{transform:none!important;left:0!important}.vue-devtools__anchor-btn[data-v-93de249b]{border-radius:100%;border-width:0;width:30px;height:30px;display:flex;justify-content:center;align-items:center;opacity:.8;transition:opacity .2s ease-in-out}.vue-devtools__anchor-btn[data-v-93de249b]:hover{opacity:1}.vue-devtools__anchor-btn svg[data-v-93de249b]{width:14px;height:14px}.vue-devtools__anchor-btn.active[data-v-93de249b]{cursor:pointer}.vue-devtools__anchor .panel-entry-btn[data-v-93de249b]{cursor:pointer;flex:none}.vue-devtools__anchor--vertical .panel-entry-btn[data-v-93de249b]{transform:rotate(-90deg)}.vue-devtools__anchor--vertical .vue-devtools__panel[data-v-93de249b]{transform:translate(-50%,-50%) rotate(90deg);box-shadow:2px -2px 8px var(--vue-devtools-widget-shadow)}.vue-devtools__anchor--hide .vue-devtools__panel[data-v-93de249b]{max-width:32px;padding:2px 0}.vue-devtools__anchor--hide .vue-devtools__panel-content[data-v-93de249b]{opacity:0}.vue-devtools__anchor--glowing[data-v-93de249b]{position:absolute;left:0;top:0;transform:translate(-50%,-50%);width:160px;height:160px;opacity:0;transition:all 1s ease;pointer-events:none;z-index:-1;border-radius:9999px;background-image:linear-gradient(45deg,#00dc82,#36e4da,#0047e1);filter:blur(60px)}.vue-devtools__anchor:hover .vue-devtools__anchor--glowing[data-v-93de249b]{opacity:.6}.vue-devtools__panel[data-v-93de249b]{position:absolute;left:0;top:0;transform:translate(-50%,-50%);display:flex;justify-content:flex-start;overflow:hidden;align-items:center;gap:2px;height:30px;padding:4px 4px 4px 5px;box-sizing:border-box;border:1px solid var(--vue-devtools-widget-border);border-radius:20px;background-color:var(--vue-devtools-widget-bg);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:var(--vue-devtools-widget-fg);box-shadow:2px 2px 8px var(--vue-devtools-widget-shadow);-webkit-user-select:none;user-select:none;max-width:150px;transition:max-width .4s ease,padding .5s ease,transform .3s ease,all .4s ease}.vue-devtools__panel-content[data-v-93de249b]{transition:opacity .4s ease}.vue-devtools__panel-divider[data-v-93de249b]{border-left:1px solid rgba(136,136,136,.2);width:1px;height:10px}@keyframes blink-93de249b{0%{opacity:.2}50%{opacity:.6}to{opacity:.2}}@media print{#vue-devtools-anchor[data-v-93de249b]{display:none}}
1
+ .vue-devtools-frame[data-v-df0df9e8]{position:fixed;z-index:2147483645}.vue-devtools-frame[data-v-df0df9e8] iframe{width:100%;height:100%;outline:none;background:var(--vue-devtools-widget-bg);border:1px solid rgba(125,125,125,.2);border-radius:10px}.vue-devtools-frame.view-mode-xs[data-v-df0df9e8]{width:400px!important;height:80px!important}.vue-devtools-frame.view-mode-fullscreen[data-v-df0df9e8]{width:100vw!important;height:100vh!important;z-index:1!important;bottom:0!important;transform:none!important}.vue-devtools-frame.view-mode-fullscreen[data-v-df0df9e8] iframe{border-radius:0!important}.vue-devtools-resize--horizontal[data-v-df0df9e8]{position:absolute;left:6px;right:6px;height:10px;margin:-5px 0;cursor:ns-resize;border-radius:5px}.vue-devtools-resize--vertical[data-v-df0df9e8]{position:absolute;top:6px;bottom:0;width:10px;margin:0 -5px;cursor:ew-resize;border-radius:5px}.vue-devtools-resize-corner[data-v-df0df9e8]{position:absolute;width:14px;height:14px;margin:-6px;border-radius:6px}.vue-devtools-resize[data-v-df0df9e8]:hover{background:#7d7d7d1a}.vue-devtools__anchor[data-v-98d04846]{position:fixed;z-index:2147483645;transform-origin:center center;transform:translate(-50%,-50%) rotate(0)}.vue-devtools__anchor.fullscreen[data-v-98d04846]{transform:none!important;left:0!important}.vue-devtools__anchor-btn[data-v-98d04846]{border-radius:100%;border-width:0;width:30px;height:30px;display:flex;justify-content:center;align-items:center;opacity:.8;transition:opacity .2s ease-in-out}.vue-devtools__anchor-btn[data-v-98d04846]:hover{opacity:1}.vue-devtools__anchor-btn svg[data-v-98d04846]{width:14px;height:14px}.vue-devtools__anchor-btn.active[data-v-98d04846]{cursor:pointer}.vue-devtools__anchor .panel-entry-btn[data-v-98d04846]{cursor:pointer;flex:none}.vue-devtools__anchor--vertical .panel-entry-btn[data-v-98d04846]{transform:rotate(-90deg)}.vue-devtools__anchor--vertical .vue-devtools__panel[data-v-98d04846]{transform:translate(-50%,-50%) rotate(90deg);box-shadow:2px -2px 8px var(--vue-devtools-widget-shadow)}.vue-devtools__anchor--hide .vue-devtools__panel[data-v-98d04846]{max-width:32px;padding:2px 0}.vue-devtools__anchor--hide .vue-devtools__panel-content[data-v-98d04846]{opacity:0}.vue-devtools__anchor--glowing[data-v-98d04846]{position:absolute;left:0;top:0;transform:translate(-50%,-50%);width:160px;height:160px;opacity:0;transition:all 1s ease;pointer-events:none;z-index:-1;border-radius:9999px;background-image:linear-gradient(45deg,#00dc82,#36e4da,#0047e1);filter:blur(60px)}.vue-devtools__anchor:hover .vue-devtools__anchor--glowing[data-v-98d04846]{opacity:.6}.vue-devtools__panel[data-v-98d04846]{position:absolute;left:0;top:0;transform:translate(-50%,-50%);display:flex;justify-content:flex-start;overflow:hidden;align-items:center;gap:2px;height:30px;padding:4px 4px 4px 5px;box-sizing:border-box;border:1px solid var(--vue-devtools-widget-border);border-radius:20px;background-color:var(--vue-devtools-widget-bg);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:var(--vue-devtools-widget-fg);box-shadow:2px 2px 8px var(--vue-devtools-widget-shadow);-webkit-user-select:none;user-select:none;max-width:150px;transition:max-width .4s ease,padding .5s ease,transform .3s ease,all .4s ease}.vue-devtools__panel-content[data-v-98d04846]{transition:opacity .4s ease}.vue-devtools__panel-divider[data-v-98d04846]{border-left:1px solid rgba(136,136,136,.2);width:1px;height:10px}@keyframes blink-98d04846{0%{opacity:.2}50%{opacity:.6}to{opacity:.2}}@media print{#vue-devtools-anchor[data-v-98d04846]{display:none}}