@lvce-editor/extension-detail-view 6.8.0 → 7.0.0
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/extensionDetailViewWorkerMain.js +519 -161
- package/package.json +2 -2
|
@@ -324,22 +324,339 @@ const A = 53;
|
|
|
324
324
|
const Ul = 60;
|
|
325
325
|
const Code$2 = 65;
|
|
326
326
|
const Dt = 67;
|
|
327
|
+
const Reference = 100;
|
|
328
|
+
|
|
329
|
+
const ClientX = 'event.clientX';
|
|
330
|
+
const ClientY = 'event.clientY';
|
|
331
|
+
const TargetHref = 'event.target.href';
|
|
332
|
+
const TargetName = 'event.target.name';
|
|
327
333
|
|
|
328
334
|
const LeftArrow = 13;
|
|
329
335
|
const RightArrow = 15;
|
|
330
336
|
|
|
337
|
+
const Script$1 = 2;
|
|
338
|
+
|
|
339
|
+
const ExtensionDetailReadme = 20;
|
|
340
|
+
const ExtensionDetailIconContextMenu$2 = 4091;
|
|
341
|
+
|
|
342
|
+
const None$2 = 0;
|
|
343
|
+
|
|
344
|
+
const Web$1 = 1;
|
|
345
|
+
const Electron$1 = 2;
|
|
346
|
+
|
|
347
|
+
const ExtensionHostWorker = 44;
|
|
348
|
+
const ExtensionManagementWorker = 9006;
|
|
349
|
+
const FileSystemWorker$1 = 209;
|
|
350
|
+
const MarkdownWorker$1 = 300;
|
|
351
|
+
const RendererWorker = 1;
|
|
352
|
+
|
|
353
|
+
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
354
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
355
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
356
|
+
const SetPatches = 'Viewlet.setPatches';
|
|
357
|
+
|
|
358
|
+
const FocusExtensionDetailTabs = 451;
|
|
359
|
+
|
|
331
360
|
const mergeClassNames = (...classNames) => {
|
|
332
361
|
return classNames.filter(Boolean).join(' ');
|
|
333
362
|
};
|
|
334
363
|
|
|
335
364
|
const text = data => {
|
|
336
365
|
return {
|
|
337
|
-
|
|
366
|
+
childCount: 0,
|
|
338
367
|
text: data,
|
|
339
|
-
|
|
368
|
+
type: Text$1
|
|
340
369
|
};
|
|
341
370
|
};
|
|
342
371
|
|
|
372
|
+
const SetText = 1;
|
|
373
|
+
const Replace = 2;
|
|
374
|
+
const SetAttribute = 3;
|
|
375
|
+
const RemoveAttribute = 4;
|
|
376
|
+
const Add = 6;
|
|
377
|
+
const NavigateChild = 7;
|
|
378
|
+
const NavigateParent = 8;
|
|
379
|
+
const RemoveChild = 9;
|
|
380
|
+
const NavigateSibling = 10;
|
|
381
|
+
const SetReferenceNodeUid = 11;
|
|
382
|
+
|
|
383
|
+
const isKey = key => {
|
|
384
|
+
return key !== 'type' && key !== 'childCount';
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const getKeys = node => {
|
|
388
|
+
const keys = Object.keys(node).filter(isKey);
|
|
389
|
+
return keys;
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const arrayToTree = nodes => {
|
|
393
|
+
const result = [];
|
|
394
|
+
let i = 0;
|
|
395
|
+
while (i < nodes.length) {
|
|
396
|
+
const node = nodes[i];
|
|
397
|
+
const {
|
|
398
|
+
children,
|
|
399
|
+
nodesConsumed
|
|
400
|
+
} = getChildrenWithCount(nodes, i + 1, node.childCount || 0);
|
|
401
|
+
result.push({
|
|
402
|
+
node,
|
|
403
|
+
children
|
|
404
|
+
});
|
|
405
|
+
i += 1 + nodesConsumed;
|
|
406
|
+
}
|
|
407
|
+
return result;
|
|
408
|
+
};
|
|
409
|
+
const getChildrenWithCount = (nodes, startIndex, childCount) => {
|
|
410
|
+
if (childCount === 0) {
|
|
411
|
+
return {
|
|
412
|
+
children: [],
|
|
413
|
+
nodesConsumed: 0
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
const children = [];
|
|
417
|
+
let i = startIndex;
|
|
418
|
+
let remaining = childCount;
|
|
419
|
+
let totalConsumed = 0;
|
|
420
|
+
while (remaining > 0 && i < nodes.length) {
|
|
421
|
+
const node = nodes[i];
|
|
422
|
+
const nodeChildCount = node.childCount || 0;
|
|
423
|
+
const {
|
|
424
|
+
children: nodeChildren,
|
|
425
|
+
nodesConsumed
|
|
426
|
+
} = getChildrenWithCount(nodes, i + 1, nodeChildCount);
|
|
427
|
+
children.push({
|
|
428
|
+
node,
|
|
429
|
+
children: nodeChildren
|
|
430
|
+
});
|
|
431
|
+
const nodeSize = 1 + nodesConsumed;
|
|
432
|
+
i += nodeSize;
|
|
433
|
+
totalConsumed += nodeSize;
|
|
434
|
+
remaining--;
|
|
435
|
+
}
|
|
436
|
+
return {
|
|
437
|
+
children,
|
|
438
|
+
nodesConsumed: totalConsumed
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const compareNodes = (oldNode, newNode) => {
|
|
443
|
+
const patches = [];
|
|
444
|
+
// Check if node type changed - return null to signal incompatible nodes
|
|
445
|
+
// (caller should handle this with a Replace operation)
|
|
446
|
+
if (oldNode.type !== newNode.type) {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
// Handle reference nodes - special handling for uid changes
|
|
450
|
+
if (oldNode.type === Reference) {
|
|
451
|
+
if (oldNode.uid !== newNode.uid) {
|
|
452
|
+
patches.push({
|
|
453
|
+
type: SetReferenceNodeUid,
|
|
454
|
+
uid: newNode.uid
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
return patches;
|
|
458
|
+
}
|
|
459
|
+
// Handle text nodes
|
|
460
|
+
if (oldNode.type === Text$1 && newNode.type === Text$1) {
|
|
461
|
+
if (oldNode.text !== newNode.text) {
|
|
462
|
+
patches.push({
|
|
463
|
+
type: SetText,
|
|
464
|
+
value: newNode.text
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
return patches;
|
|
468
|
+
}
|
|
469
|
+
// Compare attributes
|
|
470
|
+
const oldKeys = getKeys(oldNode);
|
|
471
|
+
const newKeys = getKeys(newNode);
|
|
472
|
+
// Check for attribute changes
|
|
473
|
+
for (const key of newKeys) {
|
|
474
|
+
if (oldNode[key] !== newNode[key]) {
|
|
475
|
+
patches.push({
|
|
476
|
+
type: SetAttribute,
|
|
477
|
+
key,
|
|
478
|
+
value: newNode[key]
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Check for removed attributes
|
|
483
|
+
for (const key of oldKeys) {
|
|
484
|
+
if (!(key in newNode)) {
|
|
485
|
+
patches.push({
|
|
486
|
+
type: RemoveAttribute,
|
|
487
|
+
key
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return patches;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
const treeToArray = node => {
|
|
495
|
+
const result = [node.node];
|
|
496
|
+
for (const child of node.children) {
|
|
497
|
+
result.push(...treeToArray(child));
|
|
498
|
+
}
|
|
499
|
+
return result;
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const diffChildren = (oldChildren, newChildren, patches) => {
|
|
503
|
+
const maxLength = Math.max(oldChildren.length, newChildren.length);
|
|
504
|
+
// Track where we are: -1 means at parent, >= 0 means at child index
|
|
505
|
+
let currentChildIndex = -1;
|
|
506
|
+
// Collect indices of children to remove (we'll add these patches at the end in reverse order)
|
|
507
|
+
const indicesToRemove = [];
|
|
508
|
+
for (let i = 0; i < maxLength; i++) {
|
|
509
|
+
const oldNode = oldChildren[i];
|
|
510
|
+
const newNode = newChildren[i];
|
|
511
|
+
if (!oldNode && !newNode) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (!oldNode) {
|
|
515
|
+
// Add new node - we should be at the parent
|
|
516
|
+
if (currentChildIndex >= 0) {
|
|
517
|
+
// Navigate back to parent
|
|
518
|
+
patches.push({
|
|
519
|
+
type: NavigateParent
|
|
520
|
+
});
|
|
521
|
+
currentChildIndex = -1;
|
|
522
|
+
}
|
|
523
|
+
// Flatten the entire subtree so renderInternal can handle it
|
|
524
|
+
const flatNodes = treeToArray(newNode);
|
|
525
|
+
patches.push({
|
|
526
|
+
type: Add,
|
|
527
|
+
nodes: flatNodes
|
|
528
|
+
});
|
|
529
|
+
} else if (newNode) {
|
|
530
|
+
// Compare nodes to see if we need any patches
|
|
531
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
532
|
+
// If nodePatches is null, the node types are incompatible - need to replace
|
|
533
|
+
if (nodePatches === null) {
|
|
534
|
+
// Navigate to this child
|
|
535
|
+
if (currentChildIndex === -1) {
|
|
536
|
+
patches.push({
|
|
537
|
+
type: NavigateChild,
|
|
538
|
+
index: i
|
|
539
|
+
});
|
|
540
|
+
currentChildIndex = i;
|
|
541
|
+
} else if (currentChildIndex !== i) {
|
|
542
|
+
patches.push({
|
|
543
|
+
type: NavigateSibling,
|
|
544
|
+
index: i
|
|
545
|
+
});
|
|
546
|
+
currentChildIndex = i;
|
|
547
|
+
}
|
|
548
|
+
// Replace the entire subtree
|
|
549
|
+
const flatNodes = treeToArray(newNode);
|
|
550
|
+
patches.push({
|
|
551
|
+
type: Replace,
|
|
552
|
+
nodes: flatNodes
|
|
553
|
+
});
|
|
554
|
+
// After replace, we're at the new element (same position)
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
// Check if we need to recurse into children
|
|
558
|
+
const hasChildrenToCompare = oldNode.children.length > 0 || newNode.children.length > 0;
|
|
559
|
+
// Only navigate to this element if we need to do something
|
|
560
|
+
if (nodePatches.length > 0 || hasChildrenToCompare) {
|
|
561
|
+
// Navigate to this child if not already there
|
|
562
|
+
if (currentChildIndex === -1) {
|
|
563
|
+
patches.push({
|
|
564
|
+
type: NavigateChild,
|
|
565
|
+
index: i
|
|
566
|
+
});
|
|
567
|
+
currentChildIndex = i;
|
|
568
|
+
} else if (currentChildIndex !== i) {
|
|
569
|
+
patches.push({
|
|
570
|
+
type: NavigateSibling,
|
|
571
|
+
index: i
|
|
572
|
+
});
|
|
573
|
+
currentChildIndex = i;
|
|
574
|
+
}
|
|
575
|
+
// Apply node patches (these apply to the current element, not children)
|
|
576
|
+
if (nodePatches.length > 0) {
|
|
577
|
+
patches.push(...nodePatches);
|
|
578
|
+
}
|
|
579
|
+
// Compare children recursively
|
|
580
|
+
if (hasChildrenToCompare) {
|
|
581
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
// Remove old node - collect the index for later removal
|
|
586
|
+
indicesToRemove.push(i);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
// Navigate back to parent if we ended at a child
|
|
590
|
+
if (currentChildIndex >= 0) {
|
|
591
|
+
patches.push({
|
|
592
|
+
type: NavigateParent
|
|
593
|
+
});
|
|
594
|
+
currentChildIndex = -1;
|
|
595
|
+
}
|
|
596
|
+
// Add remove patches in reverse order (highest index first)
|
|
597
|
+
// This ensures indices remain valid as we remove
|
|
598
|
+
for (let j = indicesToRemove.length - 1; j >= 0; j--) {
|
|
599
|
+
patches.push({
|
|
600
|
+
type: RemoveChild,
|
|
601
|
+
index: indicesToRemove[j]
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
const diffTrees = (oldTree, newTree, patches, path) => {
|
|
606
|
+
// At the root level (path.length === 0), we're already AT the element
|
|
607
|
+
// So we compare the root node directly, then compare its children
|
|
608
|
+
if (path.length === 0 && oldTree.length === 1 && newTree.length === 1) {
|
|
609
|
+
const oldNode = oldTree[0];
|
|
610
|
+
const newNode = newTree[0];
|
|
611
|
+
// Compare root nodes
|
|
612
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
613
|
+
// If nodePatches is null, the root node types are incompatible - need to replace
|
|
614
|
+
if (nodePatches === null) {
|
|
615
|
+
const flatNodes = treeToArray(newNode);
|
|
616
|
+
patches.push({
|
|
617
|
+
type: Replace,
|
|
618
|
+
nodes: flatNodes
|
|
619
|
+
});
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (nodePatches.length > 0) {
|
|
623
|
+
patches.push(...nodePatches);
|
|
624
|
+
}
|
|
625
|
+
// Compare children
|
|
626
|
+
if (oldNode.children.length > 0 || newNode.children.length > 0) {
|
|
627
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
628
|
+
}
|
|
629
|
+
} else {
|
|
630
|
+
// Non-root level or multiple root elements - use the regular comparison
|
|
631
|
+
diffChildren(oldTree, newTree, patches);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
const removeTrailingNavigationPatches = patches => {
|
|
636
|
+
// Find the last non-navigation patch
|
|
637
|
+
let lastNonNavigationIndex = -1;
|
|
638
|
+
for (let i = patches.length - 1; i >= 0; i--) {
|
|
639
|
+
const patch = patches[i];
|
|
640
|
+
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
|
|
641
|
+
lastNonNavigationIndex = i;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
// Return patches up to and including the last non-navigation patch
|
|
646
|
+
return lastNonNavigationIndex === -1 ? [] : patches.slice(0, lastNonNavigationIndex + 1);
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
const diffTree = (oldNodes, newNodes) => {
|
|
650
|
+
// Step 1: Convert flat arrays to tree structures
|
|
651
|
+
const oldTree = arrayToTree(oldNodes);
|
|
652
|
+
const newTree = arrayToTree(newNodes);
|
|
653
|
+
// Step 3: Compare the trees
|
|
654
|
+
const patches = [];
|
|
655
|
+
diffTrees(oldTree, newTree, patches, []);
|
|
656
|
+
// Remove trailing navigation patches since they serve no purpose
|
|
657
|
+
return removeTrailingNavigationPatches(patches);
|
|
658
|
+
};
|
|
659
|
+
|
|
343
660
|
const AdditionalDetails = 'AdditionalDetails';
|
|
344
661
|
const AdditionalDetailsEntry = 'AdditionalDetailsEntry';
|
|
345
662
|
const AdditionalDetailsTitle = 'AdditionalDetailsTitle';
|
|
@@ -1021,64 +1338,6 @@ const getFeatureVirtualDomHandler = featureName => {
|
|
|
1021
1338
|
return feature.getVirtualDom;
|
|
1022
1339
|
};
|
|
1023
1340
|
|
|
1024
|
-
const ClientX = 'event.clientX';
|
|
1025
|
-
const ClientY = 'event.clientY';
|
|
1026
|
-
const TargetHref = 'event.target.href';
|
|
1027
|
-
const TargetName = 'event.target.name';
|
|
1028
|
-
|
|
1029
|
-
const Script$1 = 2;
|
|
1030
|
-
|
|
1031
|
-
const ExtensionDetailReadme = 20;
|
|
1032
|
-
const ExtensionDetailIconContextMenu$2 = 4091;
|
|
1033
|
-
|
|
1034
|
-
const None$2 = 0;
|
|
1035
|
-
|
|
1036
|
-
const Web$1 = 1;
|
|
1037
|
-
const Electron$1 = 2;
|
|
1038
|
-
|
|
1039
|
-
const ExtensionHostWorker = 44;
|
|
1040
|
-
const ExtensionManagementWorker = 9006;
|
|
1041
|
-
const FileSystemWorker$1 = 209;
|
|
1042
|
-
const MarkdownWorker$1 = 300;
|
|
1043
|
-
const RendererWorker = 1;
|
|
1044
|
-
|
|
1045
|
-
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1046
|
-
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1047
|
-
|
|
1048
|
-
const FocusExtensionDetailTabs = 451;
|
|
1049
|
-
|
|
1050
|
-
const rpcs = Object.create(null);
|
|
1051
|
-
const set$a = (id, rpc) => {
|
|
1052
|
-
rpcs[id] = rpc;
|
|
1053
|
-
};
|
|
1054
|
-
const get$3 = id => {
|
|
1055
|
-
return rpcs[id];
|
|
1056
|
-
};
|
|
1057
|
-
|
|
1058
|
-
const create$4 = rpcId => {
|
|
1059
|
-
return {
|
|
1060
|
-
async dispose() {
|
|
1061
|
-
const rpc = get$3(rpcId);
|
|
1062
|
-
await rpc.dispose();
|
|
1063
|
-
},
|
|
1064
|
-
// @ts-ignore
|
|
1065
|
-
invoke(method, ...params) {
|
|
1066
|
-
const rpc = get$3(rpcId);
|
|
1067
|
-
// @ts-ignore
|
|
1068
|
-
return rpc.invoke(method, ...params);
|
|
1069
|
-
},
|
|
1070
|
-
// @ts-ignore
|
|
1071
|
-
invokeAndTransfer(method, ...params) {
|
|
1072
|
-
const rpc = get$3(rpcId);
|
|
1073
|
-
// @ts-ignore
|
|
1074
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1075
|
-
},
|
|
1076
|
-
set(rpc) {
|
|
1077
|
-
set$a(rpcId, rpc);
|
|
1078
|
-
}
|
|
1079
|
-
};
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
1341
|
const normalizeLine = line => {
|
|
1083
1342
|
if (line.startsWith('Error: ')) {
|
|
1084
1343
|
return line.slice('Error: '.length);
|
|
@@ -1595,10 +1854,10 @@ const IpcParentWithMessagePort$1 = {
|
|
|
1595
1854
|
|
|
1596
1855
|
const Two$1 = '2.0';
|
|
1597
1856
|
const callbacks = Object.create(null);
|
|
1598
|
-
const get$
|
|
1857
|
+
const get$3 = id => {
|
|
1599
1858
|
return callbacks[id];
|
|
1600
1859
|
};
|
|
1601
|
-
const remove$
|
|
1860
|
+
const remove$2 = id => {
|
|
1602
1861
|
delete callbacks[id];
|
|
1603
1862
|
};
|
|
1604
1863
|
class JsonRpcError extends Error {
|
|
@@ -1744,14 +2003,14 @@ const warn = (...args) => {
|
|
|
1744
2003
|
console.warn(...args);
|
|
1745
2004
|
};
|
|
1746
2005
|
const resolve = (id, response) => {
|
|
1747
|
-
const fn = get$
|
|
2006
|
+
const fn = get$3(id);
|
|
1748
2007
|
if (!fn) {
|
|
1749
2008
|
console.log(response);
|
|
1750
2009
|
warn(`callback ${id} may already be disposed`);
|
|
1751
2010
|
return;
|
|
1752
2011
|
}
|
|
1753
2012
|
fn(response);
|
|
1754
|
-
remove$
|
|
2013
|
+
remove$2(id);
|
|
1755
2014
|
};
|
|
1756
2015
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
1757
2016
|
const getErrorType = prettyError => {
|
|
@@ -1807,7 +2066,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
1807
2066
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
1808
2067
|
return create$1$1(id, errorProperty);
|
|
1809
2068
|
};
|
|
1810
|
-
const create$
|
|
2069
|
+
const create$4 = (message, result) => {
|
|
1811
2070
|
return {
|
|
1812
2071
|
jsonrpc: Two$1,
|
|
1813
2072
|
id: message.id,
|
|
@@ -1816,7 +2075,7 @@ const create$3 = (message, result) => {
|
|
|
1816
2075
|
};
|
|
1817
2076
|
const getSuccessResponse = (message, result) => {
|
|
1818
2077
|
const resultProperty = result ?? null;
|
|
1819
|
-
return create$
|
|
2078
|
+
return create$4(message, resultProperty);
|
|
1820
2079
|
};
|
|
1821
2080
|
const getErrorResponseSimple = (id, error) => {
|
|
1822
2081
|
return {
|
|
@@ -1930,14 +2189,14 @@ const execute = (command, ...args) => {
|
|
|
1930
2189
|
};
|
|
1931
2190
|
|
|
1932
2191
|
const Two = '2.0';
|
|
1933
|
-
const create$
|
|
2192
|
+
const create$t = (method, params) => {
|
|
1934
2193
|
return {
|
|
1935
2194
|
jsonrpc: Two,
|
|
1936
2195
|
method,
|
|
1937
2196
|
params
|
|
1938
2197
|
};
|
|
1939
2198
|
};
|
|
1940
|
-
const create$
|
|
2199
|
+
const create$s = (id, method, params) => {
|
|
1941
2200
|
const message = {
|
|
1942
2201
|
id,
|
|
1943
2202
|
jsonrpc: Two,
|
|
@@ -1947,14 +2206,14 @@ const create$o = (id, method, params) => {
|
|
|
1947
2206
|
return message;
|
|
1948
2207
|
};
|
|
1949
2208
|
let id = 0;
|
|
1950
|
-
const create$
|
|
2209
|
+
const create$r = () => {
|
|
1951
2210
|
return ++id;
|
|
1952
2211
|
};
|
|
1953
2212
|
|
|
1954
2213
|
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
1955
2214
|
|
|
1956
2215
|
const registerPromise = map => {
|
|
1957
|
-
const id = create$
|
|
2216
|
+
const id = create$r();
|
|
1958
2217
|
const {
|
|
1959
2218
|
promise,
|
|
1960
2219
|
resolve
|
|
@@ -1972,7 +2231,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
|
|
|
1972
2231
|
id,
|
|
1973
2232
|
promise
|
|
1974
2233
|
} = registerPromise(callbacks);
|
|
1975
|
-
const message = create$
|
|
2234
|
+
const message = create$s(id, method, params);
|
|
1976
2235
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1977
2236
|
ipc.sendAndTransfer(message);
|
|
1978
2237
|
} else {
|
|
@@ -2008,7 +2267,7 @@ const createRpc = ipc => {
|
|
|
2008
2267
|
* @deprecated
|
|
2009
2268
|
*/
|
|
2010
2269
|
send(method, ...params) {
|
|
2011
|
-
const message = create$
|
|
2270
|
+
const message = create$t(method, params);
|
|
2012
2271
|
ipc.send(message);
|
|
2013
2272
|
}
|
|
2014
2273
|
};
|
|
@@ -2044,7 +2303,54 @@ const listen$1 = async (module, options) => {
|
|
|
2044
2303
|
const ipc = module.wrap(rawIpc);
|
|
2045
2304
|
return ipc;
|
|
2046
2305
|
};
|
|
2047
|
-
|
|
2306
|
+
|
|
2307
|
+
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
2308
|
+
|
|
2309
|
+
const createSharedLazyRpc = factory => {
|
|
2310
|
+
let rpcPromise;
|
|
2311
|
+
const getOrCreate = () => {
|
|
2312
|
+
if (!rpcPromise) {
|
|
2313
|
+
rpcPromise = factory();
|
|
2314
|
+
}
|
|
2315
|
+
return rpcPromise;
|
|
2316
|
+
};
|
|
2317
|
+
return {
|
|
2318
|
+
async dispose() {
|
|
2319
|
+
const rpc = await getOrCreate();
|
|
2320
|
+
await rpc.dispose();
|
|
2321
|
+
},
|
|
2322
|
+
async invoke(method, ...params) {
|
|
2323
|
+
const rpc = await getOrCreate();
|
|
2324
|
+
return rpc.invoke(method, ...params);
|
|
2325
|
+
},
|
|
2326
|
+
async invokeAndTransfer(method, ...params) {
|
|
2327
|
+
const rpc = await getOrCreate();
|
|
2328
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2329
|
+
},
|
|
2330
|
+
async send(method, ...params) {
|
|
2331
|
+
const rpc = await getOrCreate();
|
|
2332
|
+
rpc.send(method, ...params);
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
};
|
|
2336
|
+
const create$j = async ({
|
|
2337
|
+
commandMap,
|
|
2338
|
+
isMessagePortOpen,
|
|
2339
|
+
send
|
|
2340
|
+
}) => {
|
|
2341
|
+
return createSharedLazyRpc(() => {
|
|
2342
|
+
return create$3({
|
|
2343
|
+
commandMap,
|
|
2344
|
+
isMessagePortOpen,
|
|
2345
|
+
send
|
|
2346
|
+
});
|
|
2347
|
+
});
|
|
2348
|
+
};
|
|
2349
|
+
const LazyTransferMessagePortRpcParent = {
|
|
2350
|
+
__proto__: null,
|
|
2351
|
+
create: create$j
|
|
2352
|
+
};
|
|
2353
|
+
const create$5 = async ({
|
|
2048
2354
|
commandMap,
|
|
2049
2355
|
isMessagePortOpen = true,
|
|
2050
2356
|
messagePort
|
|
@@ -2061,7 +2367,7 @@ const create$7 = async ({
|
|
|
2061
2367
|
messagePort.start();
|
|
2062
2368
|
return rpc;
|
|
2063
2369
|
};
|
|
2064
|
-
const create$
|
|
2370
|
+
const create$3 = async ({
|
|
2065
2371
|
commandMap,
|
|
2066
2372
|
isMessagePortOpen,
|
|
2067
2373
|
send
|
|
@@ -2071,7 +2377,7 @@ const create$5 = async ({
|
|
|
2071
2377
|
port2
|
|
2072
2378
|
} = new MessageChannel();
|
|
2073
2379
|
await send(port1);
|
|
2074
|
-
return create$
|
|
2380
|
+
return create$5({
|
|
2075
2381
|
commandMap,
|
|
2076
2382
|
isMessagePortOpen,
|
|
2077
2383
|
messagePort: port2
|
|
@@ -2079,9 +2385,9 @@ const create$5 = async ({
|
|
|
2079
2385
|
};
|
|
2080
2386
|
const TransferMessagePortRpcParent = {
|
|
2081
2387
|
__proto__: null,
|
|
2082
|
-
create: create$
|
|
2388
|
+
create: create$3
|
|
2083
2389
|
};
|
|
2084
|
-
const create$2 = async ({
|
|
2390
|
+
const create$2$1 = async ({
|
|
2085
2391
|
commandMap
|
|
2086
2392
|
}) => {
|
|
2087
2393
|
// TODO create a commandMap per rpc instance
|
|
@@ -2093,7 +2399,7 @@ const create$2 = async ({
|
|
|
2093
2399
|
};
|
|
2094
2400
|
const WebWorkerRpcClient = {
|
|
2095
2401
|
__proto__: null,
|
|
2096
|
-
create: create$2
|
|
2402
|
+
create: create$2$1
|
|
2097
2403
|
};
|
|
2098
2404
|
const createMockRpc = ({
|
|
2099
2405
|
commandMap
|
|
@@ -2115,12 +2421,61 @@ const createMockRpc = ({
|
|
|
2115
2421
|
return mockRpc;
|
|
2116
2422
|
};
|
|
2117
2423
|
|
|
2424
|
+
const rpcs = Object.create(null);
|
|
2425
|
+
const set$a = (id, rpc) => {
|
|
2426
|
+
rpcs[id] = rpc;
|
|
2427
|
+
};
|
|
2428
|
+
const get$2 = id => {
|
|
2429
|
+
return rpcs[id];
|
|
2430
|
+
};
|
|
2431
|
+
const remove$1 = id => {
|
|
2432
|
+
delete rpcs[id];
|
|
2433
|
+
};
|
|
2434
|
+
|
|
2435
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
2436
|
+
const create$2 = rpcId => {
|
|
2437
|
+
return {
|
|
2438
|
+
async dispose() {
|
|
2439
|
+
const rpc = get$2(rpcId);
|
|
2440
|
+
await rpc.dispose();
|
|
2441
|
+
},
|
|
2442
|
+
// @ts-ignore
|
|
2443
|
+
invoke(method, ...params) {
|
|
2444
|
+
const rpc = get$2(rpcId);
|
|
2445
|
+
// @ts-ignore
|
|
2446
|
+
return rpc.invoke(method, ...params);
|
|
2447
|
+
},
|
|
2448
|
+
// @ts-ignore
|
|
2449
|
+
invokeAndTransfer(method, ...params) {
|
|
2450
|
+
const rpc = get$2(rpcId);
|
|
2451
|
+
// @ts-ignore
|
|
2452
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2453
|
+
},
|
|
2454
|
+
registerMockRpc(commandMap) {
|
|
2455
|
+
const mockRpc = createMockRpc({
|
|
2456
|
+
commandMap
|
|
2457
|
+
});
|
|
2458
|
+
set$a(rpcId, mockRpc);
|
|
2459
|
+
// @ts-ignore
|
|
2460
|
+
mockRpc[Symbol.dispose] = () => {
|
|
2461
|
+
remove$1(rpcId);
|
|
2462
|
+
};
|
|
2463
|
+
// @ts-ignore
|
|
2464
|
+
return mockRpc;
|
|
2465
|
+
},
|
|
2466
|
+
set(rpc) {
|
|
2467
|
+
set$a(rpcId, rpc);
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2118
2472
|
const {
|
|
2119
2473
|
dispose: dispose$4,
|
|
2120
2474
|
invoke: invoke$5,
|
|
2121
2475
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
2476
|
+
registerMockRpc: registerMockRpc$2,
|
|
2122
2477
|
set: set$9
|
|
2123
|
-
} = create$
|
|
2478
|
+
} = create$2(ExtensionHostWorker);
|
|
2124
2479
|
const executeReferenceProvider = async (id, offset) => {
|
|
2125
2480
|
// @ts-ignore
|
|
2126
2481
|
return invoke$5('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
@@ -2133,12 +2488,9 @@ const getRuntimeStatus$2 = async extensionId => {
|
|
|
2133
2488
|
// @ts-ignore
|
|
2134
2489
|
return invoke$5('ExtensionHost.getRuntimeStatus', extensionId);
|
|
2135
2490
|
};
|
|
2136
|
-
const
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
});
|
|
2140
|
-
set$9(mockRpc);
|
|
2141
|
-
return mockRpc;
|
|
2491
|
+
const getEnabledOutputProviderIds = async () => {
|
|
2492
|
+
const channels = await invoke$5('Output.getEnabledProviders');
|
|
2493
|
+
return channels;
|
|
2142
2494
|
};
|
|
2143
2495
|
|
|
2144
2496
|
const ExtensionHost = {
|
|
@@ -2146,6 +2498,7 @@ const ExtensionHost = {
|
|
|
2146
2498
|
dispose: dispose$4,
|
|
2147
2499
|
executeFileReferenceProvider,
|
|
2148
2500
|
executeReferenceProvider,
|
|
2501
|
+
getEnabledOutputProviderIds,
|
|
2149
2502
|
getRuntimeStatus: getRuntimeStatus$2,
|
|
2150
2503
|
invoke: invoke$5,
|
|
2151
2504
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
@@ -2156,7 +2509,7 @@ const ExtensionHost = {
|
|
|
2156
2509
|
const {
|
|
2157
2510
|
invoke: invoke$4,
|
|
2158
2511
|
set: set$8
|
|
2159
|
-
} = create$
|
|
2512
|
+
} = create$2(ExtensionManagementWorker);
|
|
2160
2513
|
const enable2 = (id, platform) => {
|
|
2161
2514
|
return invoke$4(`Extensions.enable2`, id, platform);
|
|
2162
2515
|
};
|
|
@@ -2168,8 +2521,9 @@ const {
|
|
|
2168
2521
|
dispose: dispose$3,
|
|
2169
2522
|
invoke: invoke$3,
|
|
2170
2523
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
2524
|
+
registerMockRpc: registerMockRpc$1,
|
|
2171
2525
|
set: set$7
|
|
2172
|
-
} = create$
|
|
2526
|
+
} = create$2(FileSystemWorker$1);
|
|
2173
2527
|
const remove = async dirent => {
|
|
2174
2528
|
return invoke$3('FileSystem.remove', dirent);
|
|
2175
2529
|
};
|
|
@@ -2177,7 +2531,6 @@ const readDirWithFileTypes = async uri => {
|
|
|
2177
2531
|
return invoke$3('FileSystem.readDirWithFileTypes', uri);
|
|
2178
2532
|
};
|
|
2179
2533
|
const getPathSeparator = async root => {
|
|
2180
|
-
// @ts-ignore
|
|
2181
2534
|
return invoke$3('FileSystem.getPathSeparator', root);
|
|
2182
2535
|
};
|
|
2183
2536
|
const getRealPath = async path => {
|
|
@@ -2205,27 +2558,22 @@ const copy = async (oldUri, newUri) => {
|
|
|
2205
2558
|
return invoke$3('FileSystem.copy', oldUri, newUri);
|
|
2206
2559
|
};
|
|
2207
2560
|
const exists$1 = async uri => {
|
|
2208
|
-
// @ts-ignore
|
|
2209
2561
|
return invoke$3('FileSystem.exists', uri);
|
|
2210
2562
|
};
|
|
2211
2563
|
const getFolderSize$1 = async uri => {
|
|
2212
|
-
// @ts-ignore
|
|
2213
2564
|
return invoke$3('FileSystem.getFolderSize', uri);
|
|
2214
2565
|
};
|
|
2215
2566
|
const readFileAsBlob$1 = async uri => {
|
|
2216
|
-
// @ts-ignore
|
|
2217
2567
|
return invoke$3('FileSystem.readFileAsBlob', uri);
|
|
2218
2568
|
};
|
|
2219
2569
|
const appendFile = async (uri, text) => {
|
|
2220
|
-
// @ts-ignore
|
|
2221
2570
|
return invoke$3('FileSystem.appendFile', uri, text);
|
|
2222
2571
|
};
|
|
2223
|
-
const
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
return mockRpc;
|
|
2572
|
+
const watchFile = async (watchId, uri, rpcId) => {
|
|
2573
|
+
await invoke$3('FileSystem.watchFile', watchId, uri, rpcId);
|
|
2574
|
+
};
|
|
2575
|
+
const unwatchFile = async watchId => {
|
|
2576
|
+
await invoke$3('FileSystem.unwatchFile', watchId);
|
|
2229
2577
|
};
|
|
2230
2578
|
|
|
2231
2579
|
const FileSystemWorker = {
|
|
@@ -2249,6 +2597,8 @@ const FileSystemWorker = {
|
|
|
2249
2597
|
rename,
|
|
2250
2598
|
set: set$7,
|
|
2251
2599
|
stat,
|
|
2600
|
+
unwatchFile,
|
|
2601
|
+
watchFile,
|
|
2252
2602
|
writeFile
|
|
2253
2603
|
};
|
|
2254
2604
|
|
|
@@ -2256,8 +2606,9 @@ const {
|
|
|
2256
2606
|
dispose: dispose$2,
|
|
2257
2607
|
invoke: invoke$2,
|
|
2258
2608
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
2609
|
+
registerMockRpc,
|
|
2259
2610
|
set: set$6
|
|
2260
|
-
} = create$
|
|
2611
|
+
} = create$2(MarkdownWorker$1);
|
|
2261
2612
|
const getVirtualDom$1 = async html => {
|
|
2262
2613
|
// @ts-ignore
|
|
2263
2614
|
return invoke$2('Markdown.getVirtualDom', html);
|
|
@@ -2266,13 +2617,6 @@ const render$1 = async (markdown, options) => {
|
|
|
2266
2617
|
// @ts-ignore
|
|
2267
2618
|
return invoke$2('Markdown.render', markdown, options);
|
|
2268
2619
|
};
|
|
2269
|
-
const registerMockRpc = commandMap => {
|
|
2270
|
-
const mockRpc = createMockRpc({
|
|
2271
|
-
commandMap
|
|
2272
|
-
});
|
|
2273
|
-
set$6(mockRpc);
|
|
2274
|
-
return mockRpc;
|
|
2275
|
-
};
|
|
2276
2620
|
|
|
2277
2621
|
const MarkdownWorker = {
|
|
2278
2622
|
__proto__: null,
|
|
@@ -2289,27 +2633,23 @@ const {
|
|
|
2289
2633
|
invoke: invoke$1,
|
|
2290
2634
|
invokeAndTransfer,
|
|
2291
2635
|
set: set$5
|
|
2292
|
-
} = create$
|
|
2636
|
+
} = create$2(RendererWorker);
|
|
2293
2637
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
2294
2638
|
number(uid);
|
|
2295
2639
|
number(menuId);
|
|
2296
2640
|
number(x);
|
|
2297
2641
|
number(y);
|
|
2298
|
-
// @ts-ignore
|
|
2299
2642
|
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2300
2643
|
};
|
|
2301
2644
|
const setColorTheme$1 = async id => {
|
|
2302
|
-
// @ts-ignore
|
|
2303
2645
|
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
2304
2646
|
};
|
|
2305
2647
|
const sendMessagePortToMarkdownWorker$1 = async (port, rpcId) => {
|
|
2306
2648
|
const command = 'Markdown.handleMessagePort';
|
|
2307
|
-
// @ts-ignore
|
|
2308
2649
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
2309
2650
|
};
|
|
2310
2651
|
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
2311
2652
|
const command = 'FileSystem.handleMessagePort';
|
|
2312
|
-
// @ts-ignore
|
|
2313
2653
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
2314
2654
|
};
|
|
2315
2655
|
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
@@ -2317,7 +2657,6 @@ const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
|
2317
2657
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
2318
2658
|
};
|
|
2319
2659
|
const confirm = async (message, options) => {
|
|
2320
|
-
// @ts-ignore
|
|
2321
2660
|
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
2322
2661
|
return result;
|
|
2323
2662
|
};
|
|
@@ -2325,7 +2664,6 @@ const writeClipBoardText = async text => {
|
|
|
2325
2664
|
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
2326
2665
|
};
|
|
2327
2666
|
const writeClipBoardImage = async blob => {
|
|
2328
|
-
// @ts-ignore
|
|
2329
2667
|
await invoke$1('ClipBoard.writeImage', /* text */blob);
|
|
2330
2668
|
};
|
|
2331
2669
|
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
@@ -2339,30 +2677,24 @@ const getAllExtensions$1 = async () => {
|
|
|
2339
2677
|
return invoke$1('ExtensionManagement.getAllExtensions');
|
|
2340
2678
|
};
|
|
2341
2679
|
const getExtension$2 = async id => {
|
|
2342
|
-
// @ts-ignore
|
|
2343
2680
|
return invoke$1('ExtensionManagement.getExtension', id);
|
|
2344
2681
|
};
|
|
2345
2682
|
const openNativeFolder = async uri => {
|
|
2346
|
-
// @ts-ignore
|
|
2347
2683
|
await invoke$1('OpenNativeFolder.openNativeFolder', uri);
|
|
2348
2684
|
};
|
|
2349
2685
|
const uninstallExtension = async id => {
|
|
2350
2686
|
return invoke$1('ExtensionManagement.uninstall', id);
|
|
2351
2687
|
};
|
|
2352
2688
|
const openExtensionSearch$1 = async () => {
|
|
2353
|
-
// @ts-ignore
|
|
2354
2689
|
return invoke$1('SideBar.openViewlet', 'Extensions');
|
|
2355
2690
|
};
|
|
2356
2691
|
const setExtensionsSearchValue = async searchValue => {
|
|
2357
|
-
// @ts-ignore
|
|
2358
2692
|
return invoke$1('Extensions.handleInput', searchValue, Script$1);
|
|
2359
2693
|
};
|
|
2360
2694
|
const openExternal$1 = async uri => {
|
|
2361
|
-
// @ts-ignore
|
|
2362
2695
|
await invoke$1('Open.openExternal', uri);
|
|
2363
2696
|
};
|
|
2364
2697
|
const openUrl = async uri => {
|
|
2365
|
-
// @ts-ignore
|
|
2366
2698
|
await invoke$1('Open.openUrl', uri);
|
|
2367
2699
|
};
|
|
2368
2700
|
|
|
@@ -2985,42 +3317,68 @@ const create$1 = () => {
|
|
|
2985
3317
|
const states = Object.create(null);
|
|
2986
3318
|
const commandMapRef = {};
|
|
2987
3319
|
return {
|
|
2988
|
-
|
|
2989
|
-
|
|
3320
|
+
clear() {
|
|
3321
|
+
for (const key of Object.keys(states)) {
|
|
3322
|
+
delete states[key];
|
|
3323
|
+
}
|
|
2990
3324
|
},
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
};
|
|
3325
|
+
diff(uid, modules, numbers) {
|
|
3326
|
+
const {
|
|
3327
|
+
newState,
|
|
3328
|
+
oldState
|
|
3329
|
+
} = states[uid];
|
|
3330
|
+
const diffResult = [];
|
|
3331
|
+
for (let i = 0; i < modules.length; i++) {
|
|
3332
|
+
const fn = modules[i];
|
|
3333
|
+
if (!fn(oldState, newState)) {
|
|
3334
|
+
diffResult.push(numbers[i]);
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
return diffResult;
|
|
2996
3338
|
},
|
|
2997
3339
|
dispose(uid) {
|
|
2998
3340
|
delete states[uid];
|
|
2999
3341
|
},
|
|
3342
|
+
get(uid) {
|
|
3343
|
+
return states[uid];
|
|
3344
|
+
},
|
|
3345
|
+
getCommandIds() {
|
|
3346
|
+
const keys = Object.keys(commandMapRef);
|
|
3347
|
+
const ids = keys.map(toCommandId);
|
|
3348
|
+
return ids;
|
|
3349
|
+
},
|
|
3000
3350
|
getKeys() {
|
|
3001
3351
|
return Object.keys(states).map(key => {
|
|
3002
3352
|
return Number.parseInt(key);
|
|
3003
3353
|
});
|
|
3004
3354
|
},
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3355
|
+
registerCommands(commandMap) {
|
|
3356
|
+
Object.assign(commandMapRef, commandMap);
|
|
3357
|
+
},
|
|
3358
|
+
set(uid, oldState, newState) {
|
|
3359
|
+
states[uid] = {
|
|
3360
|
+
newState,
|
|
3361
|
+
oldState
|
|
3362
|
+
};
|
|
3009
3363
|
},
|
|
3010
3364
|
wrapCommand(fn) {
|
|
3011
3365
|
const wrapped = async (uid, ...args) => {
|
|
3012
3366
|
const {
|
|
3013
|
-
|
|
3014
|
-
|
|
3367
|
+
newState,
|
|
3368
|
+
oldState
|
|
3015
3369
|
} = states[uid];
|
|
3016
3370
|
const newerState = await fn(newState, ...args);
|
|
3017
3371
|
if (oldState === newerState || newState === newerState) {
|
|
3018
3372
|
return;
|
|
3019
3373
|
}
|
|
3020
|
-
const
|
|
3374
|
+
const latestOld = states[uid];
|
|
3375
|
+
const latestNew = {
|
|
3376
|
+
...latestOld.newState,
|
|
3377
|
+
...newerState
|
|
3378
|
+
};
|
|
3021
3379
|
states[uid] = {
|
|
3022
|
-
|
|
3023
|
-
|
|
3380
|
+
newState: latestNew,
|
|
3381
|
+
oldState: latestOld.oldState
|
|
3024
3382
|
};
|
|
3025
3383
|
};
|
|
3026
3384
|
return wrapped;
|
|
@@ -3033,28 +3391,6 @@ const create$1 = () => {
|
|
|
3033
3391
|
return fn(newState, ...args);
|
|
3034
3392
|
};
|
|
3035
3393
|
return wrapped;
|
|
3036
|
-
},
|
|
3037
|
-
diff(uid, modules, numbers) {
|
|
3038
|
-
const {
|
|
3039
|
-
oldState,
|
|
3040
|
-
newState
|
|
3041
|
-
} = states[uid];
|
|
3042
|
-
const diffResult = [];
|
|
3043
|
-
for (let i = 0; i < modules.length; i++) {
|
|
3044
|
-
const fn = modules[i];
|
|
3045
|
-
if (!fn(oldState, newState)) {
|
|
3046
|
-
diffResult.push(numbers[i]);
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
return diffResult;
|
|
3050
|
-
},
|
|
3051
|
-
getCommandIds() {
|
|
3052
|
-
const keys = Object.keys(commandMapRef);
|
|
3053
|
-
const ids = keys.map(toCommandId);
|
|
3054
|
-
return ids;
|
|
3055
|
-
},
|
|
3056
|
-
registerCommands(commandMap) {
|
|
3057
|
-
Object.assign(commandMapRef, commandMap);
|
|
3058
3394
|
}
|
|
3059
3395
|
};
|
|
3060
3396
|
};
|
|
@@ -3166,6 +3502,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3166
3502
|
hasReadme: false,
|
|
3167
3503
|
iconSrc: '',
|
|
3168
3504
|
importTime: 0,
|
|
3505
|
+
initial: true,
|
|
3169
3506
|
installationEntries: [],
|
|
3170
3507
|
jsonValidation: [],
|
|
3171
3508
|
lastUpdated: null,
|
|
@@ -3230,9 +3567,10 @@ const RenderItems = 3;
|
|
|
3230
3567
|
const RenderScrollTop = 4;
|
|
3231
3568
|
const RenderCss = 5;
|
|
3232
3569
|
const RenderFocusContext = 6;
|
|
3570
|
+
const RenderIncremental = 7;
|
|
3233
3571
|
|
|
3234
3572
|
const modules = [isEqual$1, isEqual$2, isEqual, isEqual$3, isEqual$2];
|
|
3235
|
-
const numbers = [
|
|
3573
|
+
const numbers = [RenderIncremental, RenderFocus, RenderScrollTop, RenderCss, RenderFocusContext];
|
|
3236
3574
|
|
|
3237
3575
|
const diff2 = uid => {
|
|
3238
3576
|
const {
|
|
@@ -3484,7 +3822,7 @@ const getExtension$1 = async (id, platform) => {
|
|
|
3484
3822
|
|
|
3485
3823
|
const getExtensionNew = async id => {
|
|
3486
3824
|
try {
|
|
3487
|
-
const rpc = get$
|
|
3825
|
+
const rpc = get$2(ExtensionManagementWorker);
|
|
3488
3826
|
return await rpc.invoke('Extensions.getExtension', id);
|
|
3489
3827
|
} catch {
|
|
3490
3828
|
// ignore
|
|
@@ -4425,6 +4763,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4425
4763
|
hasColorTheme,
|
|
4426
4764
|
hasReadme,
|
|
4427
4765
|
iconSrc,
|
|
4766
|
+
initial: false,
|
|
4428
4767
|
installationEntries,
|
|
4429
4768
|
lastUpdated,
|
|
4430
4769
|
linkProtectionEnabled,
|
|
@@ -4827,7 +5166,7 @@ const sendMessagePortToMarkdownWorker = async port => {
|
|
|
4827
5166
|
|
|
4828
5167
|
const createMarkdownWorkerRpc = async () => {
|
|
4829
5168
|
try {
|
|
4830
|
-
const rpc = await
|
|
5169
|
+
const rpc = await LazyTransferMessagePortRpcParent.create({
|
|
4831
5170
|
commandMap: {},
|
|
4832
5171
|
send: sendMessagePortToMarkdownWorker
|
|
4833
5172
|
});
|
|
@@ -5387,8 +5726,15 @@ const getExtensionDetailVirtualDom = (newState, selectedTab) => {
|
|
|
5387
5726
|
};
|
|
5388
5727
|
|
|
5389
5728
|
const renderDom = (oldState, newState) => {
|
|
5729
|
+
const {
|
|
5730
|
+
initial,
|
|
5731
|
+
uid
|
|
5732
|
+
} = newState;
|
|
5733
|
+
if (initial) {
|
|
5734
|
+
return [SetDom2, uid, []];
|
|
5735
|
+
}
|
|
5390
5736
|
const dom = getExtensionDetailVirtualDom(newState, newState.selectedTab);
|
|
5391
|
-
return [
|
|
5737
|
+
return [SetDom2, uid, dom];
|
|
5392
5738
|
};
|
|
5393
5739
|
|
|
5394
5740
|
const renderFocus = (oldState, newState) => {
|
|
@@ -5419,6 +5765,16 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
5419
5765
|
return [FocusElementByName, ''];
|
|
5420
5766
|
};
|
|
5421
5767
|
|
|
5768
|
+
const renderIncremental = (oldState, newState) => {
|
|
5769
|
+
const {
|
|
5770
|
+
uid
|
|
5771
|
+
} = newState;
|
|
5772
|
+
const oldDom = renderDom(oldState, oldState)[2];
|
|
5773
|
+
const newDom = renderDom(newState, newState)[2];
|
|
5774
|
+
const patches = diffTree(oldDom, newDom);
|
|
5775
|
+
return [SetPatches, uid, patches];
|
|
5776
|
+
};
|
|
5777
|
+
|
|
5422
5778
|
const getScrollTop = (selectedTab, readmeScrollTop, changelogScrollTop) => {
|
|
5423
5779
|
if (selectedTab === Details) {
|
|
5424
5780
|
return readmeScrollTop;
|
|
@@ -5452,6 +5808,8 @@ const getRenderer = diffType => {
|
|
|
5452
5808
|
return renderFocus;
|
|
5453
5809
|
case RenderFocusContext:
|
|
5454
5810
|
return renderFocusContext;
|
|
5811
|
+
case RenderIncremental:
|
|
5812
|
+
return renderIncremental;
|
|
5455
5813
|
case RenderItems:
|
|
5456
5814
|
return renderDom;
|
|
5457
5815
|
case RenderScrollTop:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/extension-detail-view",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Extension Detail View Worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/extensionDetailViewWorkerMain.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@lvce-editor/constants": "^
|
|
14
|
+
"@lvce-editor/constants": "^3.1.0"
|
|
15
15
|
}
|
|
16
16
|
}
|