@lvce-editor/extension-host-worker 5.3.0 → 5.4.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 +57 -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
|
|
@@ -4754,11 +4752,43 @@ const remove = uri => {
|
|
|
4754
4752
|
remove$1(key);
|
|
4755
4753
|
}
|
|
4756
4754
|
};
|
|
4757
|
-
const
|
|
4755
|
+
const renameFile = (oldUri, newUri) => {
|
|
4758
4756
|
const content = readFile(oldUri);
|
|
4759
4757
|
writeFile(newUri, content);
|
|
4760
4758
|
remove(oldUri);
|
|
4761
4759
|
};
|
|
4760
|
+
const renameDirectory = (oldUri, newUri) => {
|
|
4761
|
+
if (!oldUri.endsWith(Slash)) {
|
|
4762
|
+
oldUri += Slash;
|
|
4763
|
+
}
|
|
4764
|
+
if (!newUri.endsWith(Slash)) {
|
|
4765
|
+
newUri += Slash;
|
|
4766
|
+
}
|
|
4767
|
+
ensureParentDir(newUri);
|
|
4768
|
+
setDirent(newUri, {
|
|
4769
|
+
type: Directory$1,
|
|
4770
|
+
content: ''
|
|
4771
|
+
});
|
|
4772
|
+
const allFiles = getAll();
|
|
4773
|
+
for (const [key, value] of Object.entries(allFiles)) {
|
|
4774
|
+
if (key.startsWith(oldUri)) {
|
|
4775
|
+
const newPath = key.replace(oldUri, newUri);
|
|
4776
|
+
setDirent(newPath, value);
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
remove(oldUri);
|
|
4780
|
+
};
|
|
4781
|
+
const rename = (oldUri, newUri) => {
|
|
4782
|
+
const item = getDirent(oldUri);
|
|
4783
|
+
if (!item) {
|
|
4784
|
+
throw new FileNotFoundError(oldUri);
|
|
4785
|
+
}
|
|
4786
|
+
if (item.type === Directory$1) {
|
|
4787
|
+
renameDirectory(oldUri, newUri);
|
|
4788
|
+
return;
|
|
4789
|
+
}
|
|
4790
|
+
renameFile(oldUri, newUri);
|
|
4791
|
+
};
|
|
4762
4792
|
const readDirWithFileTypes = uri => {
|
|
4763
4793
|
if (!uri.endsWith(Slash)) {
|
|
4764
4794
|
uri += Slash;
|
|
@@ -4959,7 +4989,7 @@ const handleMessagePort2 = async (port, rpcId) => {
|
|
|
4959
4989
|
commandMap: {}
|
|
4960
4990
|
});
|
|
4961
4991
|
if (rpcId) {
|
|
4962
|
-
set$
|
|
4992
|
+
set$5$1(rpcId, rpc);
|
|
4963
4993
|
}
|
|
4964
4994
|
};
|
|
4965
4995
|
|
|
@@ -4969,7 +4999,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
4969
4999
|
commandMap: {}
|
|
4970
5000
|
});
|
|
4971
5001
|
if (rpcId) {
|
|
4972
|
-
set$
|
|
5002
|
+
set$5$1(rpcId, rpc);
|
|
4973
5003
|
}
|
|
4974
5004
|
};
|
|
4975
5005
|
|
|
@@ -5643,7 +5673,7 @@ const listen = async () => {
|
|
|
5643
5673
|
const rpc = await WebWorkerRpcClient.create({
|
|
5644
5674
|
commandMap: commandMap
|
|
5645
5675
|
});
|
|
5646
|
-
set$
|
|
5676
|
+
set$5$1(RendererWorker, rpc);
|
|
5647
5677
|
};
|
|
5648
5678
|
|
|
5649
5679
|
const main = async () => {
|