@lvce-editor/extension-host-worker 5.3.0 → 5.5.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/extensionHostWorkerMain.js +62 -27
- package/package.json +1 -1
|
@@ -756,7 +756,7 @@ const setConfigurations = preferences => {
|
|
|
756
756
|
};
|
|
757
757
|
|
|
758
758
|
const rpcs$2 = Object.create(null);
|
|
759
|
-
const set$
|
|
759
|
+
const set$5$1 = (id, rpc) => {
|
|
760
760
|
rpcs$2[id] = rpc;
|
|
761
761
|
};
|
|
762
762
|
const get$a = id => {
|
|
@@ -1400,22 +1400,11 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
1400
1400
|
const wrap$f = global => {
|
|
1401
1401
|
return new IpcChildWithModuleWorker(global);
|
|
1402
1402
|
};
|
|
1403
|
-
const withResolvers = () => {
|
|
1404
|
-
let _resolve;
|
|
1405
|
-
const promise = new Promise(resolve => {
|
|
1406
|
-
_resolve = resolve;
|
|
1407
|
-
});
|
|
1408
|
-
return {
|
|
1409
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1410
|
-
resolve: _resolve,
|
|
1411
|
-
promise
|
|
1412
|
-
};
|
|
1413
|
-
};
|
|
1414
1403
|
const waitForFirstMessage = async port => {
|
|
1415
1404
|
const {
|
|
1416
1405
|
resolve,
|
|
1417
1406
|
promise
|
|
1418
|
-
} = withResolvers();
|
|
1407
|
+
} = Promise.withResolvers();
|
|
1419
1408
|
port.addEventListener('message', resolve, {
|
|
1420
1409
|
once: true
|
|
1421
1410
|
});
|
|
@@ -1497,7 +1486,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
1497
1486
|
const {
|
|
1498
1487
|
resolve,
|
|
1499
1488
|
promise
|
|
1500
|
-
} = withResolvers();
|
|
1489
|
+
} = Promise.withResolvers();
|
|
1501
1490
|
const listenerMap = Object.create(null);
|
|
1502
1491
|
const cleanup = value => {
|
|
1503
1492
|
for (const event of Object.keys(eventMap)) {
|
|
@@ -1653,11 +1642,11 @@ const remove$3 = id => {
|
|
|
1653
1642
|
delete callbacks[id];
|
|
1654
1643
|
};
|
|
1655
1644
|
let id$1 = 0;
|
|
1656
|
-
const create$3$
|
|
1645
|
+
const create$3$2 = () => {
|
|
1657
1646
|
return ++id$1;
|
|
1658
1647
|
};
|
|
1659
1648
|
const registerPromise = () => {
|
|
1660
|
-
const id = create$3$
|
|
1649
|
+
const id = create$3$2();
|
|
1661
1650
|
const {
|
|
1662
1651
|
resolve,
|
|
1663
1652
|
promise
|
|
@@ -1871,7 +1860,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
1871
1860
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
1872
1861
|
return create$1$2(message, errorProperty);
|
|
1873
1862
|
};
|
|
1874
|
-
const create$
|
|
1863
|
+
const create$8 = (message, result) => {
|
|
1875
1864
|
return {
|
|
1876
1865
|
jsonrpc: Two,
|
|
1877
1866
|
id: message.id,
|
|
@@ -1880,7 +1869,7 @@ const create$a = (message, result) => {
|
|
|
1880
1869
|
};
|
|
1881
1870
|
const getSuccessResponse = (message, result) => {
|
|
1882
1871
|
const resultProperty = result ?? null;
|
|
1883
|
-
return create$
|
|
1872
|
+
return create$8(message, resultProperty);
|
|
1884
1873
|
};
|
|
1885
1874
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
1886
1875
|
try {
|
|
@@ -2047,7 +2036,7 @@ const listen$1 = async (module, options) => {
|
|
|
2047
2036
|
const ipc = module.wrap(rawIpc);
|
|
2048
2037
|
return ipc;
|
|
2049
2038
|
};
|
|
2050
|
-
const create$
|
|
2039
|
+
const create$a = async ({
|
|
2051
2040
|
commandMap,
|
|
2052
2041
|
messagePort
|
|
2053
2042
|
}) => {
|
|
@@ -2062,9 +2051,9 @@ const create$9 = async ({
|
|
|
2062
2051
|
};
|
|
2063
2052
|
const MessagePortRpcClient = {
|
|
2064
2053
|
__proto__: null,
|
|
2065
|
-
create: create$
|
|
2054
|
+
create: create$a
|
|
2066
2055
|
};
|
|
2067
|
-
const create$
|
|
2056
|
+
const create$9 = async ({
|
|
2068
2057
|
commandMap,
|
|
2069
2058
|
messagePort,
|
|
2070
2059
|
isMessagePortOpen
|
|
@@ -2082,9 +2071,9 @@ const create$8 = async ({
|
|
|
2082
2071
|
};
|
|
2083
2072
|
const MessagePortRpcParent = {
|
|
2084
2073
|
__proto__: null,
|
|
2085
|
-
create: create$
|
|
2074
|
+
create: create$9
|
|
2086
2075
|
};
|
|
2087
|
-
const create$
|
|
2076
|
+
const create$3$1 = async ({
|
|
2088
2077
|
commandMap,
|
|
2089
2078
|
messagePort
|
|
2090
2079
|
}) => {
|
|
@@ -2100,6 +2089,15 @@ const create$2$1 = async ({
|
|
|
2100
2089
|
messagePort.start();
|
|
2101
2090
|
return rpc;
|
|
2102
2091
|
};
|
|
2092
|
+
const create$2$1 = async ({
|
|
2093
|
+
commandMap,
|
|
2094
|
+
messagePort
|
|
2095
|
+
}) => {
|
|
2096
|
+
return create$3$1({
|
|
2097
|
+
commandMap,
|
|
2098
|
+
messagePort
|
|
2099
|
+
});
|
|
2100
|
+
};
|
|
2103
2101
|
const PlainMessagePortRpcParent = {
|
|
2104
2102
|
__proto__: null,
|
|
2105
2103
|
create: create$2$1
|
|
@@ -3990,6 +3988,10 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
3990
3988
|
});
|
|
3991
3989
|
};
|
|
3992
3990
|
|
|
3991
|
+
const executeExternalCommand = (method, ...params) => {
|
|
3992
|
+
return invoke$2(method, ...params);
|
|
3993
|
+
};
|
|
3994
|
+
|
|
3993
3995
|
const BraceCompletionExecuteBraceCompletionProvider = 'ExtensionHostBraceCompletion.executeBraceCompletionProvider';
|
|
3994
3996
|
const ClosingTagExecuteClosingTagProvider = 'ExtensionHostClosingTag.executeClosingTagProvider';
|
|
3995
3997
|
const CommandExecute = 'ExtensionHostCommand.executeCommand';
|
|
@@ -4754,11 +4756,43 @@ const remove = uri => {
|
|
|
4754
4756
|
remove$1(key);
|
|
4755
4757
|
}
|
|
4756
4758
|
};
|
|
4757
|
-
const
|
|
4759
|
+
const renameFile = (oldUri, newUri) => {
|
|
4758
4760
|
const content = readFile(oldUri);
|
|
4759
4761
|
writeFile(newUri, content);
|
|
4760
4762
|
remove(oldUri);
|
|
4761
4763
|
};
|
|
4764
|
+
const renameDirectory = (oldUri, newUri) => {
|
|
4765
|
+
if (!oldUri.endsWith(Slash)) {
|
|
4766
|
+
oldUri += Slash;
|
|
4767
|
+
}
|
|
4768
|
+
if (!newUri.endsWith(Slash)) {
|
|
4769
|
+
newUri += Slash;
|
|
4770
|
+
}
|
|
4771
|
+
ensureParentDir(newUri);
|
|
4772
|
+
setDirent(newUri, {
|
|
4773
|
+
type: Directory$1,
|
|
4774
|
+
content: ''
|
|
4775
|
+
});
|
|
4776
|
+
const allFiles = getAll();
|
|
4777
|
+
for (const [key, value] of Object.entries(allFiles)) {
|
|
4778
|
+
if (key.startsWith(oldUri)) {
|
|
4779
|
+
const newPath = key.replace(oldUri, newUri);
|
|
4780
|
+
setDirent(newPath, value);
|
|
4781
|
+
}
|
|
4782
|
+
}
|
|
4783
|
+
remove(oldUri);
|
|
4784
|
+
};
|
|
4785
|
+
const rename = (oldUri, newUri) => {
|
|
4786
|
+
const item = getDirent(oldUri);
|
|
4787
|
+
if (!item) {
|
|
4788
|
+
throw new FileNotFoundError(oldUri);
|
|
4789
|
+
}
|
|
4790
|
+
if (item.type === Directory$1) {
|
|
4791
|
+
renameDirectory(oldUri, newUri);
|
|
4792
|
+
return;
|
|
4793
|
+
}
|
|
4794
|
+
renameFile(oldUri, newUri);
|
|
4795
|
+
};
|
|
4762
4796
|
const readDirWithFileTypes = uri => {
|
|
4763
4797
|
if (!uri.endsWith(Slash)) {
|
|
4764
4798
|
uri += Slash;
|
|
@@ -4959,7 +4993,7 @@ const handleMessagePort2 = async (port, rpcId) => {
|
|
|
4959
4993
|
commandMap: {}
|
|
4960
4994
|
});
|
|
4961
4995
|
if (rpcId) {
|
|
4962
|
-
set$
|
|
4996
|
+
set$5$1(rpcId, rpc);
|
|
4963
4997
|
}
|
|
4964
4998
|
};
|
|
4965
4999
|
|
|
@@ -4969,7 +5003,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
4969
5003
|
commandMap: {}
|
|
4970
5004
|
});
|
|
4971
5005
|
if (rpcId) {
|
|
4972
|
-
set$
|
|
5006
|
+
set$5$1(rpcId, rpc);
|
|
4973
5007
|
}
|
|
4974
5008
|
};
|
|
4975
5009
|
|
|
@@ -5532,6 +5566,7 @@ const commandMap = {
|
|
|
5532
5566
|
'ColorTheme.getColorThemeNames': getColorThemeNames,
|
|
5533
5567
|
'ColorTheme.hydrate': hydrate$1,
|
|
5534
5568
|
'ExtensionHost.launchIframeWorker': launchIframeWorker,
|
|
5569
|
+
'ExecuteExternalCommand.executeExternalCommand': executeExternalCommand,
|
|
5535
5570
|
'ExtensionHostDebug.evaluate': evaluate,
|
|
5536
5571
|
'ExtensionHostDebug.getProperties': getProperties,
|
|
5537
5572
|
'ExtensionHostDebug.listProcesses': listProcesses,
|
|
@@ -5643,7 +5678,7 @@ const listen = async () => {
|
|
|
5643
5678
|
const rpc = await WebWorkerRpcClient.create({
|
|
5644
5679
|
commandMap: commandMap
|
|
5645
5680
|
});
|
|
5646
|
-
set$
|
|
5681
|
+
set$5$1(RendererWorker, rpc);
|
|
5647
5682
|
};
|
|
5648
5683
|
|
|
5649
5684
|
const main = async () => {
|