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.cjs CHANGED
@@ -5,6 +5,7 @@ const path$a = require('node:path');
5
5
  const vite = require('vite');
6
6
  const sirv = require('sirv');
7
7
  const Inspect = require('vite-plugin-inspect');
8
+ const devtoolsKit = require('@vue/devtools-kit');
8
9
  const VueInspector = require('vite-plugin-vue-inspector');
9
10
  const devtoolsCore = require('@vue/devtools-core');
10
11
  const fsp = require('node:fs/promises');
@@ -112,12 +113,6 @@ const cyan = kolorist(36, 39);
112
113
  const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : path$a.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('vite.cjs', document.baseURI).href))));
113
114
  const DIR_CLIENT = path$a.resolve(DIR_DIST, "../client");
114
115
 
115
- function getViteConfig(config, pluginOptions) {
116
- devtoolsCore.defineViteServerAction("get-vite-root", () => {
117
- return config.root;
118
- });
119
- }
120
-
121
116
  const DEBOUNCE_DEFAULTS = {
122
117
  trailing: true
123
118
  };
@@ -174,23 +169,6 @@ async function _applyPromised(fn, _this, args) {
174
169
  return await fn.apply(_this, args);
175
170
  }
176
171
 
177
- function setupGraphModule(options) {
178
- const { rpc, server } = options;
179
- devtoolsCore.defineViteServerAction("graph:get-modules", async () => {
180
- const list = await rpc.list();
181
- const modules = list?.modules || [];
182
- return modules;
183
- });
184
- const triggerModuleUpdated = devtoolsCore.callViteClientListener("graph:module-updated");
185
- const debouncedModuleUpdated = debounce(() => {
186
- triggerModuleUpdated();
187
- }, 100);
188
- server.middlewares.use((_, __, next) => {
189
- debouncedModuleUpdated();
190
- next();
191
- });
192
- }
193
-
194
172
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
195
173
 
196
174
  function getDefaultExportFromCjs (x) {
@@ -575,7 +553,7 @@ var utils$j = {};
575
553
  */
576
554
 
577
555
  exports.escapeNode = (block, n = 0, type) => {
578
- let node = block.nodes[n];
556
+ const node = block.nodes[n];
579
557
  if (!node) return;
580
558
 
581
559
  if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
@@ -644,13 +622,23 @@ var utils$j = {};
644
622
 
645
623
  exports.flatten = (...args) => {
646
624
  const result = [];
625
+
647
626
  const flat = arr => {
648
627
  for (let i = 0; i < arr.length; i++) {
649
- let ele = arr[i];
650
- Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
628
+ const ele = arr[i];
629
+
630
+ if (Array.isArray(ele)) {
631
+ flat(ele);
632
+ continue;
633
+ }
634
+
635
+ if (ele !== undefined) {
636
+ result.push(ele);
637
+ }
651
638
  }
652
639
  return result;
653
640
  };
641
+
654
642
  flat(args);
655
643
  return result;
656
644
  };
@@ -659,9 +647,9 @@ var utils$j = {};
659
647
  const utils$i = utils$j;
660
648
 
661
649
  var stringify$4 = (ast, options = {}) => {
662
- let stringify = (node, parent = {}) => {
663
- let invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
664
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
650
+ const stringify = (node, parent = {}) => {
651
+ const invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
652
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
665
653
  let output = '';
666
654
 
667
655
  if (node.value) {
@@ -676,7 +664,7 @@ var stringify$4 = (ast, options = {}) => {
676
664
  }
677
665
 
678
666
  if (node.nodes) {
679
- for (let child of node.nodes) {
667
+ for (const child of node.nodes) {
680
668
  output += stringify(child);
681
669
  }
682
670
  }
@@ -1050,7 +1038,7 @@ const toMaxLen = (input, maxLength) => {
1050
1038
  return negative ? ('-' + input) : input;
1051
1039
  };
1052
1040
 
1053
- const toSequence = (parts, options) => {
1041
+ const toSequence = (parts, options, maxLen) => {
1054
1042
  parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1055
1043
  parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1056
1044
 
@@ -1060,11 +1048,11 @@ const toSequence = (parts, options) => {
1060
1048
  let result;
1061
1049
 
1062
1050
  if (parts.positives.length) {
1063
- positives = parts.positives.join('|');
1051
+ positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|');
1064
1052
  }
1065
1053
 
1066
1054
  if (parts.negatives.length) {
1067
- negatives = `-(${prefix}${parts.negatives.join('|')})`;
1055
+ negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`;
1068
1056
  }
1069
1057
 
1070
1058
  if (positives && negatives) {
@@ -1162,7 +1150,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
1162
1150
 
1163
1151
  if (options.toRegex === true) {
1164
1152
  return step > 1
1165
- ? toSequence(parts, options)
1153
+ ? toSequence(parts, options, maxLen)
1166
1154
  : toRegex(range, null, { wrap: false, ...options });
1167
1155
  }
1168
1156
 
@@ -1174,7 +1162,6 @@ const fillLetters = (start, end, step = 1, options = {}) => {
1174
1162
  return invalidRange(start, end, options);
1175
1163
  }
1176
1164
 
1177
-
1178
1165
  let format = options.transform || (val => String.fromCharCode(val));
1179
1166
  let a = `${start}`.charCodeAt(0);
1180
1167
  let b = `${end}`.charCodeAt(0);
@@ -1242,30 +1229,32 @@ const fill$1 = fillRange;
1242
1229
  const utils$h = utils$j;
1243
1230
 
1244
1231
  const compile$1 = (ast, options = {}) => {
1245
- let walk = (node, parent = {}) => {
1246
- let invalidBlock = utils$h.isInvalidBrace(parent);
1247
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
1248
- let invalid = invalidBlock === true || invalidNode === true;
1249
- let prefix = options.escapeInvalid === true ? '\\' : '';
1232
+ const walk = (node, parent = {}) => {
1233
+ const invalidBlock = utils$h.isInvalidBrace(parent);
1234
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
1235
+ const invalid = invalidBlock === true || invalidNode === true;
1236
+ const prefix = options.escapeInvalid === true ? '\\' : '';
1250
1237
  let output = '';
1251
1238
 
1252
1239
  if (node.isOpen === true) {
1253
1240
  return prefix + node.value;
1254
1241
  }
1242
+
1255
1243
  if (node.isClose === true) {
1244
+ console.log('node.isClose', prefix, node.value);
1256
1245
  return prefix + node.value;
1257
1246
  }
1258
1247
 
1259
1248
  if (node.type === 'open') {
1260
- return invalid ? (prefix + node.value) : '(';
1249
+ return invalid ? prefix + node.value : '(';
1261
1250
  }
1262
1251
 
1263
1252
  if (node.type === 'close') {
1264
- return invalid ? (prefix + node.value) : ')';
1253
+ return invalid ? prefix + node.value : ')';
1265
1254
  }
1266
1255
 
1267
1256
  if (node.type === 'comma') {
1268
- return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
1257
+ return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
1269
1258
  }
1270
1259
 
1271
1260
  if (node.value) {
@@ -1273,8 +1262,8 @@ const compile$1 = (ast, options = {}) => {
1273
1262
  }
1274
1263
 
1275
1264
  if (node.nodes && node.ranges > 0) {
1276
- let args = utils$h.reduce(node.nodes);
1277
- let range = fill$1(...args, { ...options, wrap: false, toRegex: true });
1265
+ const args = utils$h.reduce(node.nodes);
1266
+ const range = fill$1(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
1278
1267
 
1279
1268
  if (range.length !== 0) {
1280
1269
  return args.length > 1 && range.length > 1 ? `(${range})` : range;
@@ -1282,10 +1271,11 @@ const compile$1 = (ast, options = {}) => {
1282
1271
  }
1283
1272
 
1284
1273
  if (node.nodes) {
1285
- for (let child of node.nodes) {
1274
+ for (const child of node.nodes) {
1286
1275
  output += walk(child, node);
1287
1276
  }
1288
1277
  }
1278
+
1289
1279
  return output;
1290
1280
  };
1291
1281
 
@@ -1299,7 +1289,7 @@ const stringify$2 = stringify$4;
1299
1289
  const utils$g = utils$j;
1300
1290
 
1301
1291
  const append = (queue = '', stash = '', enclose = false) => {
1302
- let result = [];
1292
+ const result = [];
1303
1293
 
1304
1294
  queue = [].concat(queue);
1305
1295
  stash = [].concat(stash);
@@ -1309,15 +1299,15 @@ const append = (queue = '', stash = '', enclose = false) => {
1309
1299
  return enclose ? utils$g.flatten(stash).map(ele => `{${ele}}`) : stash;
1310
1300
  }
1311
1301
 
1312
- for (let item of queue) {
1302
+ for (const item of queue) {
1313
1303
  if (Array.isArray(item)) {
1314
- for (let value of item) {
1304
+ for (const value of item) {
1315
1305
  result.push(append(value, stash, enclose));
1316
1306
  }
1317
1307
  } else {
1318
1308
  for (let ele of stash) {
1319
1309
  if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
1320
- result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
1310
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
1321
1311
  }
1322
1312
  }
1323
1313
  }
@@ -1325,9 +1315,9 @@ const append = (queue = '', stash = '', enclose = false) => {
1325
1315
  };
1326
1316
 
1327
1317
  const expand$1 = (ast, options = {}) => {
1328
- let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
1318
+ const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
1329
1319
 
1330
- let walk = (node, parent = {}) => {
1320
+ const walk = (node, parent = {}) => {
1331
1321
  node.queue = [];
1332
1322
 
1333
1323
  let p = parent;
@@ -1349,7 +1339,7 @@ const expand$1 = (ast, options = {}) => {
1349
1339
  }
1350
1340
 
1351
1341
  if (node.nodes && node.ranges > 0) {
1352
- let args = utils$g.reduce(node.nodes);
1342
+ const args = utils$g.reduce(node.nodes);
1353
1343
 
1354
1344
  if (utils$g.exceedsLimit(...args, options.step, rangeLimit)) {
1355
1345
  throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
@@ -1365,7 +1355,7 @@ const expand$1 = (ast, options = {}) => {
1365
1355
  return;
1366
1356
  }
1367
1357
 
1368
- let enclose = utils$g.encloseBrace(node);
1358
+ const enclose = utils$g.encloseBrace(node);
1369
1359
  let queue = node.queue;
1370
1360
  let block = node;
1371
1361
 
@@ -1375,7 +1365,7 @@ const expand$1 = (ast, options = {}) => {
1375
1365
  }
1376
1366
 
1377
1367
  for (let i = 0; i < node.nodes.length; i++) {
1378
- let child = node.nodes[i];
1368
+ const child = node.nodes[i];
1379
1369
 
1380
1370
  if (child.type === 'comma' && node.type === 'brace') {
1381
1371
  if (i === 1) queue.push('');
@@ -1407,7 +1397,7 @@ const expand$1 = (ast, options = {}) => {
1407
1397
  var expand_1 = expand$1;
1408
1398
 
1409
1399
  var constants$4 = {
1410
- MAX_LENGTH: 1024 * 64,
1400
+ MAX_LENGTH: 10000,
1411
1401
 
1412
1402
  // Digits
1413
1403
  CHAR_0: '0', /* 0 */
@@ -1495,18 +1485,18 @@ const parse$3 = (input, options = {}) => {
1495
1485
  throw new TypeError('Expected a string');
1496
1486
  }
1497
1487
 
1498
- let opts = options || {};
1499
- let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
1488
+ const opts = options || {};
1489
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
1500
1490
  if (input.length > max) {
1501
1491
  throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
1502
1492
  }
1503
1493
 
1504
- let ast = { type: 'root', input, nodes: [] };
1505
- let stack = [ast];
1494
+ const ast = { type: 'root', input, nodes: [] };
1495
+ const stack = [ast];
1506
1496
  let block = ast;
1507
1497
  let prev = ast;
1508
1498
  let brackets = 0;
1509
- let length = input.length;
1499
+ const length = input.length;
1510
1500
  let index = 0;
1511
1501
  let depth = 0;
1512
1502
  let value;
@@ -1571,6 +1561,7 @@ const parse$3 = (input, options = {}) => {
1571
1561
 
1572
1562
  if (value === CHAR_LEFT_SQUARE_BRACKET$1) {
1573
1563
  brackets++;
1564
+
1574
1565
  let next;
1575
1566
 
1576
1567
  while (index < length && (next = advance())) {
@@ -1626,7 +1617,7 @@ const parse$3 = (input, options = {}) => {
1626
1617
  */
1627
1618
 
1628
1619
  if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
1629
- let open = value;
1620
+ const open = value;
1630
1621
  let next;
1631
1622
 
1632
1623
  if (options.keepQuotes !== true) {
@@ -1658,8 +1649,8 @@ const parse$3 = (input, options = {}) => {
1658
1649
  if (value === CHAR_LEFT_CURLY_BRACE$1) {
1659
1650
  depth++;
1660
1651
 
1661
- let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1662
- let brace = {
1652
+ const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1653
+ const brace = {
1663
1654
  type: 'brace',
1664
1655
  open: true,
1665
1656
  close: false,
@@ -1686,7 +1677,7 @@ const parse$3 = (input, options = {}) => {
1686
1677
  continue;
1687
1678
  }
1688
1679
 
1689
- let type = 'close';
1680
+ const type = 'close';
1690
1681
  block = stack.pop();
1691
1682
  block.close = true;
1692
1683
 
@@ -1704,7 +1695,7 @@ const parse$3 = (input, options = {}) => {
1704
1695
  if (value === CHAR_COMMA$1 && depth > 0) {
1705
1696
  if (block.ranges > 0) {
1706
1697
  block.ranges = 0;
1707
- let open = block.nodes.shift();
1698
+ const open = block.nodes.shift();
1708
1699
  block.nodes = [open, { type: 'text', value: stringify$1(block) }];
1709
1700
  }
1710
1701
 
@@ -1718,7 +1709,7 @@ const parse$3 = (input, options = {}) => {
1718
1709
  */
1719
1710
 
1720
1711
  if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
1721
- let siblings = block.nodes;
1712
+ const siblings = block.nodes;
1722
1713
 
1723
1714
  if (depth === 0 || siblings.length === 0) {
1724
1715
  push({ type: 'text', value });
@@ -1745,7 +1736,7 @@ const parse$3 = (input, options = {}) => {
1745
1736
  if (prev.type === 'range') {
1746
1737
  siblings.pop();
1747
1738
 
1748
- let before = siblings[siblings.length - 1];
1739
+ const before = siblings[siblings.length - 1];
1749
1740
  before.value += prev.value + value;
1750
1741
  prev = before;
1751
1742
  block.ranges--;
@@ -1778,8 +1769,8 @@ const parse$3 = (input, options = {}) => {
1778
1769
  });
1779
1770
 
1780
1771
  // get the location of the block on parent.nodes (block's siblings)
1781
- let parent = stack[stack.length - 1];
1782
- let index = parent.nodes.indexOf(block);
1772
+ const parent = stack[stack.length - 1];
1773
+ const index = parent.nodes.indexOf(block);
1783
1774
  // replace the (invalid) block with it's nodes
1784
1775
  parent.nodes.splice(index, 1, ...block.nodes);
1785
1776
  }
@@ -1814,8 +1805,8 @@ const braces$1 = (input, options = {}) => {
1814
1805
  let output = [];
1815
1806
 
1816
1807
  if (Array.isArray(input)) {
1817
- for (let pattern of input) {
1818
- let result = braces$1.create(pattern, options);
1808
+ for (const pattern of input) {
1809
+ const result = braces$1.create(pattern, options);
1819
1810
  if (Array.isArray(result)) {
1820
1811
  output.push(...result);
1821
1812
  } else {
@@ -1949,7 +1940,7 @@ braces$1.create = (input, options = {}) => {
1949
1940
  return [input];
1950
1941
  }
1951
1942
 
1952
- return options.expand !== true
1943
+ return options.expand !== true
1953
1944
  ? braces$1.compile(input, options)
1954
1945
  : braces$1.expand(input, options);
1955
1946
  };
@@ -7742,8 +7733,8 @@ function guessType(path) {
7742
7733
  return "wasm";
7743
7734
  return "other";
7744
7735
  }
7745
- function setupAssetsModule(options) {
7746
- const { rpc, server, config } = options;
7736
+ function getAssetsFunctions(ctx) {
7737
+ const { server, config } = ctx;
7747
7738
  const _imageMetaCache = /* @__PURE__ */ new Map();
7748
7739
  let cache = null;
7749
7740
  async function scan() {
@@ -7803,42 +7794,80 @@ function setupAssetsModule(options) {
7803
7794
  }
7804
7795
  return importers;
7805
7796
  }
7806
- devtoolsCore.defineViteServerAction("assets:get-static-assets", async () => {
7807
- return await scan();
7808
- });
7809
- devtoolsCore.defineViteServerAction("assets:get-asset-importers", async (url) => {
7810
- return await getAssetImporters(url);
7811
- });
7812
- devtoolsCore.defineViteServerAction("assets:get-image-meta", async (filepath) => {
7813
- if (_imageMetaCache.has(filepath))
7814
- return _imageMetaCache.get(filepath);
7815
- try {
7816
- const meta = imageMeta(await fsp__default.readFile(filepath));
7817
- _imageMetaCache.set(filepath, meta);
7818
- return meta;
7819
- } catch (e) {
7820
- _imageMetaCache.set(filepath, void 0);
7821
- console.error(e);
7822
- return void 0;
7823
- }
7824
- });
7825
- devtoolsCore.defineViteServerAction("assets:get-text-asset-content", async (filepath, limit = 300) => {
7826
- try {
7827
- const content = await fsp__default.readFile(filepath, "utf-8");
7828
- return content.slice(0, limit);
7829
- } catch (e) {
7830
- console.error(e);
7831
- return void 0;
7832
- }
7833
- });
7834
- const triggerAssetsUpdated = devtoolsCore.callViteClientListener("assets:updated");
7835
7797
  const debouncedAssetsUpdated = debounce(() => {
7836
- triggerAssetsUpdated();
7798
+ devtoolsKit.getViteRpcServer?.()?.broadcast?.emit("assetsUpdated");
7837
7799
  }, 100);
7838
7800
  server.watcher.on("all", (event) => {
7839
7801
  if (event !== "change")
7840
7802
  debouncedAssetsUpdated();
7841
7803
  });
7804
+ return {
7805
+ async getStaticAssets() {
7806
+ return await scan();
7807
+ },
7808
+ async getAssetImporters(url) {
7809
+ return await getAssetImporters(url);
7810
+ },
7811
+ async getImageMeta(filepath) {
7812
+ if (_imageMetaCache.has(filepath))
7813
+ return _imageMetaCache.get(filepath);
7814
+ try {
7815
+ const meta = imageMeta(await fsp__default.readFile(filepath));
7816
+ _imageMetaCache.set(filepath, meta);
7817
+ return meta;
7818
+ } catch (e) {
7819
+ _imageMetaCache.set(filepath, void 0);
7820
+ console.error(e);
7821
+ return void 0;
7822
+ }
7823
+ },
7824
+ async getTextAssetContent(filepath, limit = 300) {
7825
+ try {
7826
+ const content = await fsp__default.readFile(filepath, "utf-8");
7827
+ return content.slice(0, limit);
7828
+ } catch (e) {
7829
+ console.error(e);
7830
+ return void 0;
7831
+ }
7832
+ }
7833
+ };
7834
+ }
7835
+
7836
+ function getConfigFunctions(ctx) {
7837
+ return {
7838
+ getRoot() {
7839
+ return ctx.config.root;
7840
+ }
7841
+ };
7842
+ }
7843
+
7844
+ function getGraphFunctions(ctx) {
7845
+ const { rpc, server } = ctx;
7846
+ const debouncedModuleUpdated = debounce(() => {
7847
+ devtoolsKit.getViteRpcServer?.()?.broadcast?.emit("graphModuleUpdated");
7848
+ }, 100);
7849
+ server.middlewares.use((_, __, next) => {
7850
+ debouncedModuleUpdated();
7851
+ next();
7852
+ });
7853
+ return {
7854
+ async getGraphModules() {
7855
+ const list = await rpc.list();
7856
+ const modules = list?.modules || [];
7857
+ return modules;
7858
+ }
7859
+ };
7860
+ }
7861
+
7862
+ function getRpcFunctions(ctx) {
7863
+ return {
7864
+ heartbeat() {
7865
+ return true;
7866
+ },
7867
+ ...getAssetsFunctions(ctx),
7868
+ ...getConfigFunctions(ctx),
7869
+ ...getGraphFunctions(ctx)
7870
+ };
7842
7871
  }
7843
7872
 
7844
7873
  function getVueDevtoolsPath() {
@@ -7856,7 +7885,7 @@ function normalizeComboKeyPrint(toggleComboKey) {
7856
7885
  const defaultOptions = {
7857
7886
  appendTo: "",
7858
7887
  componentInspector: true,
7859
- launchEditor: "code"
7888
+ launchEditor: process.env.LAUNCH_EDITOR ?? "code"
7860
7889
  };
7861
7890
  function mergeOptions(options) {
7862
7891
  return Object.assign({}, defaultOptions, options);
@@ -7874,17 +7903,13 @@ function VitePluginVueDevTools(options) {
7874
7903
  single: true,
7875
7904
  dev: true
7876
7905
  }));
7877
- devtoolsCore.initViteServerContext(server);
7878
- getViteConfig(config);
7879
- setupGraphModule({
7880
- rpc: inspect.api.rpc,
7881
- server
7882
- });
7883
- setupAssetsModule({
7906
+ devtoolsKit.setViteServerContext(server);
7907
+ const rpcFunctions = getRpcFunctions({
7884
7908
  rpc: inspect.api.rpc,
7885
7909
  server,
7886
7910
  config
7887
7911
  });
7912
+ devtoolsCore.createViteServerRpc(rpcFunctions);
7888
7913
  const _printUrls = server.printUrls;
7889
7914
  const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
7890
7915
  server.printUrls = () => {
@@ -7924,9 +7949,10 @@ function VitePluginVueDevTools(options) {
7924
7949
  return;
7925
7950
  const { appendTo } = pluginOptions;
7926
7951
  const [filename] = id.split("?", 2);
7927
- if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename)))
7952
+ if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename))) {
7928
7953
  code = `import 'virtual:vue-devtools-path:overlay.js';
7929
7954
  ${code}`;
7955
+ }
7930
7956
  return code;
7931
7957
  },
7932
7958
  transformIndexHtml(html) {
package/dist/vite.d.cts CHANGED
@@ -1,19 +1,5 @@
1
- import { ResolvedConfig, ViteDevServer, PluginOption } from 'vite';
1
+ import { PluginOption } from 'vite';
2
2
  import { VitePluginInspectorOptions } from 'vite-plugin-vue-inspector';
3
- import { ViteInspectAPI } from 'vite-plugin-inspect';
4
-
5
- declare function getViteConfig(config: ResolvedConfig, pluginOptions: any): void;
6
-
7
- declare function setupGraphModule(options: {
8
- rpc: ViteInspectAPI['rpc'];
9
- server: ViteDevServer;
10
- }): void;
11
-
12
- declare function setupAssetsModule(options: {
13
- rpc: ViteInspectAPI['rpc'];
14
- server: ViteDevServer;
15
- config: ResolvedConfig;
16
- }): void;
17
3
 
18
4
  interface VitePluginVueDevToolsOptions {
19
5
  /**
@@ -35,7 +21,7 @@ interface VitePluginVueDevToolsOptions {
35
21
  *
36
22
  * @default code (Visual Studio Code)
37
23
  */
38
- launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm';
24
+ launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm' | 'rider' | string;
39
25
  /**
40
26
  * Customize openInEditor host
41
27
  * @default false
@@ -52,4 +38,4 @@ interface VitePluginVueDevToolsOptions {
52
38
  }
53
39
  declare function VitePluginVueDevTools(options?: VitePluginVueDevToolsOptions): PluginOption;
54
40
 
55
- export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default, getViteConfig, setupAssetsModule, setupGraphModule };
41
+ export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default };
package/dist/vite.d.mts CHANGED
@@ -1,19 +1,5 @@
1
- import { ResolvedConfig, ViteDevServer, PluginOption } from 'vite';
1
+ import { PluginOption } from 'vite';
2
2
  import { VitePluginInspectorOptions } from 'vite-plugin-vue-inspector';
3
- import { ViteInspectAPI } from 'vite-plugin-inspect';
4
-
5
- declare function getViteConfig(config: ResolvedConfig, pluginOptions: any): void;
6
-
7
- declare function setupGraphModule(options: {
8
- rpc: ViteInspectAPI['rpc'];
9
- server: ViteDevServer;
10
- }): void;
11
-
12
- declare function setupAssetsModule(options: {
13
- rpc: ViteInspectAPI['rpc'];
14
- server: ViteDevServer;
15
- config: ResolvedConfig;
16
- }): void;
17
3
 
18
4
  interface VitePluginVueDevToolsOptions {
19
5
  /**
@@ -35,7 +21,7 @@ interface VitePluginVueDevToolsOptions {
35
21
  *
36
22
  * @default code (Visual Studio Code)
37
23
  */
38
- launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm';
24
+ launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm' | 'rider' | string;
39
25
  /**
40
26
  * Customize openInEditor host
41
27
  * @default false
@@ -52,4 +38,4 @@ interface VitePluginVueDevToolsOptions {
52
38
  }
53
39
  declare function VitePluginVueDevTools(options?: VitePluginVueDevToolsOptions): PluginOption;
54
40
 
55
- export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default, getViteConfig, setupAssetsModule, setupGraphModule };
41
+ export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default };
package/dist/vite.d.ts CHANGED
@@ -1,19 +1,5 @@
1
- import { ResolvedConfig, ViteDevServer, PluginOption } from 'vite';
1
+ import { PluginOption } from 'vite';
2
2
  import { VitePluginInspectorOptions } from 'vite-plugin-vue-inspector';
3
- import { ViteInspectAPI } from 'vite-plugin-inspect';
4
-
5
- declare function getViteConfig(config: ResolvedConfig, pluginOptions: any): void;
6
-
7
- declare function setupGraphModule(options: {
8
- rpc: ViteInspectAPI['rpc'];
9
- server: ViteDevServer;
10
- }): void;
11
-
12
- declare function setupAssetsModule(options: {
13
- rpc: ViteInspectAPI['rpc'];
14
- server: ViteDevServer;
15
- config: ResolvedConfig;
16
- }): void;
17
3
 
18
4
  interface VitePluginVueDevToolsOptions {
19
5
  /**
@@ -35,7 +21,7 @@ interface VitePluginVueDevToolsOptions {
35
21
  *
36
22
  * @default code (Visual Studio Code)
37
23
  */
38
- launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm';
24
+ launchEditor?: 'appcode' | 'atom' | 'atom-beta' | 'brackets' | 'clion' | 'code' | 'code-insiders' | 'codium' | 'emacs' | 'idea' | 'notepad++' | 'pycharm' | 'phpstorm' | 'rubymine' | 'sublime' | 'vim' | 'visualstudio' | 'webstorm' | 'rider' | string;
39
25
  /**
40
26
  * Customize openInEditor host
41
27
  * @default false
@@ -52,4 +38,4 @@ interface VitePluginVueDevToolsOptions {
52
38
  }
53
39
  declare function VitePluginVueDevTools(options?: VitePluginVueDevToolsOptions): PluginOption;
54
40
 
55
- export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default, getViteConfig, setupAssetsModule, setupGraphModule };
41
+ export { type VitePluginVueDevToolsOptions, VitePluginVueDevTools as default };