@lvce-editor/extension-detail-view 6.7.0 → 6.8.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 +105 -104
- package/package.json +2 -2
|
@@ -1045,17 +1045,17 @@ const RendererWorker = 1;
|
|
|
1045
1045
|
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1046
1046
|
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1047
1047
|
|
|
1048
|
-
const
|
|
1048
|
+
const FocusExtensionDetailTabs = 451;
|
|
1049
1049
|
|
|
1050
1050
|
const rpcs = Object.create(null);
|
|
1051
|
-
const set$
|
|
1051
|
+
const set$a = (id, rpc) => {
|
|
1052
1052
|
rpcs[id] = rpc;
|
|
1053
1053
|
};
|
|
1054
1054
|
const get$3 = id => {
|
|
1055
1055
|
return rpcs[id];
|
|
1056
1056
|
};
|
|
1057
1057
|
|
|
1058
|
-
const create$
|
|
1058
|
+
const create$4 = rpcId => {
|
|
1059
1059
|
return {
|
|
1060
1060
|
async dispose() {
|
|
1061
1061
|
const rpc = get$3(rpcId);
|
|
@@ -1074,7 +1074,7 @@ const create$7 = rpcId => {
|
|
|
1074
1074
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1075
1075
|
},
|
|
1076
1076
|
set(rpc) {
|
|
1077
|
-
set$
|
|
1077
|
+
set$a(rpcId, rpc);
|
|
1078
1078
|
}
|
|
1079
1079
|
};
|
|
1080
1080
|
};
|
|
@@ -1593,56 +1593,14 @@ const IpcParentWithMessagePort$1 = {
|
|
|
1593
1593
|
wrap: wrap$5
|
|
1594
1594
|
};
|
|
1595
1595
|
|
|
1596
|
-
const Two = '2.0';
|
|
1597
|
-
const create$4 = (method, params) => {
|
|
1598
|
-
return {
|
|
1599
|
-
jsonrpc: Two,
|
|
1600
|
-
method,
|
|
1601
|
-
params
|
|
1602
|
-
};
|
|
1603
|
-
};
|
|
1596
|
+
const Two$1 = '2.0';
|
|
1604
1597
|
const callbacks = Object.create(null);
|
|
1605
|
-
const set$a = (id, fn) => {
|
|
1606
|
-
callbacks[id] = fn;
|
|
1607
|
-
};
|
|
1608
1598
|
const get$2 = id => {
|
|
1609
1599
|
return callbacks[id];
|
|
1610
1600
|
};
|
|
1611
1601
|
const remove$1 = id => {
|
|
1612
1602
|
delete callbacks[id];
|
|
1613
1603
|
};
|
|
1614
|
-
let id = 0;
|
|
1615
|
-
const create$3$1 = () => {
|
|
1616
|
-
return ++id;
|
|
1617
|
-
};
|
|
1618
|
-
const registerPromise = () => {
|
|
1619
|
-
const id = create$3$1();
|
|
1620
|
-
const {
|
|
1621
|
-
resolve,
|
|
1622
|
-
promise
|
|
1623
|
-
} = Promise.withResolvers();
|
|
1624
|
-
set$a(id, resolve);
|
|
1625
|
-
return {
|
|
1626
|
-
id,
|
|
1627
|
-
promise
|
|
1628
|
-
};
|
|
1629
|
-
};
|
|
1630
|
-
const create$2$1 = (method, params) => {
|
|
1631
|
-
const {
|
|
1632
|
-
id,
|
|
1633
|
-
promise
|
|
1634
|
-
} = registerPromise();
|
|
1635
|
-
const message = {
|
|
1636
|
-
jsonrpc: Two,
|
|
1637
|
-
method,
|
|
1638
|
-
params,
|
|
1639
|
-
id
|
|
1640
|
-
};
|
|
1641
|
-
return {
|
|
1642
|
-
message,
|
|
1643
|
-
promise
|
|
1644
|
-
};
|
|
1645
|
-
};
|
|
1646
1604
|
class JsonRpcError extends Error {
|
|
1647
1605
|
constructor(message) {
|
|
1648
1606
|
super(message);
|
|
@@ -1838,7 +1796,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
1838
1796
|
};
|
|
1839
1797
|
const create$1$1 = (id, error) => {
|
|
1840
1798
|
return {
|
|
1841
|
-
jsonrpc: Two,
|
|
1799
|
+
jsonrpc: Two$1,
|
|
1842
1800
|
id,
|
|
1843
1801
|
error
|
|
1844
1802
|
};
|
|
@@ -1849,20 +1807,20 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
1849
1807
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
1850
1808
|
return create$1$1(id, errorProperty);
|
|
1851
1809
|
};
|
|
1852
|
-
const create$
|
|
1810
|
+
const create$3 = (message, result) => {
|
|
1853
1811
|
return {
|
|
1854
|
-
jsonrpc: Two,
|
|
1812
|
+
jsonrpc: Two$1,
|
|
1855
1813
|
id: message.id,
|
|
1856
1814
|
result: result ?? null
|
|
1857
1815
|
};
|
|
1858
1816
|
};
|
|
1859
1817
|
const getSuccessResponse = (message, result) => {
|
|
1860
1818
|
const resultProperty = result ?? null;
|
|
1861
|
-
return create$
|
|
1819
|
+
return create$3(message, resultProperty);
|
|
1862
1820
|
};
|
|
1863
1821
|
const getErrorResponseSimple = (id, error) => {
|
|
1864
1822
|
return {
|
|
1865
|
-
jsonrpc: Two,
|
|
1823
|
+
jsonrpc: Two$1,
|
|
1866
1824
|
id,
|
|
1867
1825
|
error: {
|
|
1868
1826
|
code: Custom,
|
|
@@ -1949,29 +1907,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
1949
1907
|
}
|
|
1950
1908
|
throw new JsonRpcError('unexpected message');
|
|
1951
1909
|
};
|
|
1952
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
1953
|
-
const {
|
|
1954
|
-
message,
|
|
1955
|
-
promise
|
|
1956
|
-
} = create$2$1(method, params);
|
|
1957
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1958
|
-
ipc.sendAndTransfer(message);
|
|
1959
|
-
} else {
|
|
1960
|
-
ipc.send(message);
|
|
1961
|
-
}
|
|
1962
|
-
const responseMessage = await promise;
|
|
1963
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
1964
|
-
};
|
|
1965
|
-
const send = (transport, method, ...params) => {
|
|
1966
|
-
const message = create$4(method, params);
|
|
1967
|
-
transport.send(message);
|
|
1968
|
-
};
|
|
1969
|
-
const invoke$6 = (ipc, method, ...params) => {
|
|
1970
|
-
return invokeHelper(ipc, method, params, false);
|
|
1971
|
-
};
|
|
1972
|
-
const invokeAndTransfer$4 = (ipc, method, ...params) => {
|
|
1973
|
-
return invokeHelper(ipc, method, params, true);
|
|
1974
|
-
};
|
|
1975
1910
|
|
|
1976
1911
|
class CommandNotFoundError extends Error {
|
|
1977
1912
|
constructor(command) {
|
|
@@ -1994,24 +1929,87 @@ const execute = (command, ...args) => {
|
|
|
1994
1929
|
return fn(...args);
|
|
1995
1930
|
};
|
|
1996
1931
|
|
|
1932
|
+
const Two = '2.0';
|
|
1933
|
+
const create$p = (method, params) => {
|
|
1934
|
+
return {
|
|
1935
|
+
jsonrpc: Two,
|
|
1936
|
+
method,
|
|
1937
|
+
params
|
|
1938
|
+
};
|
|
1939
|
+
};
|
|
1940
|
+
const create$o = (id, method, params) => {
|
|
1941
|
+
const message = {
|
|
1942
|
+
id,
|
|
1943
|
+
jsonrpc: Two,
|
|
1944
|
+
method,
|
|
1945
|
+
params
|
|
1946
|
+
};
|
|
1947
|
+
return message;
|
|
1948
|
+
};
|
|
1949
|
+
let id = 0;
|
|
1950
|
+
const create$n = () => {
|
|
1951
|
+
return ++id;
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
1955
|
+
|
|
1956
|
+
const registerPromise = map => {
|
|
1957
|
+
const id = create$n();
|
|
1958
|
+
const {
|
|
1959
|
+
promise,
|
|
1960
|
+
resolve
|
|
1961
|
+
} = Promise.withResolvers();
|
|
1962
|
+
map[id] = resolve;
|
|
1963
|
+
return {
|
|
1964
|
+
id,
|
|
1965
|
+
promise
|
|
1966
|
+
};
|
|
1967
|
+
};
|
|
1968
|
+
|
|
1969
|
+
// @ts-ignore
|
|
1970
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
1971
|
+
const {
|
|
1972
|
+
id,
|
|
1973
|
+
promise
|
|
1974
|
+
} = registerPromise(callbacks);
|
|
1975
|
+
const message = create$o(id, method, params);
|
|
1976
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1977
|
+
ipc.sendAndTransfer(message);
|
|
1978
|
+
} else {
|
|
1979
|
+
ipc.send(message);
|
|
1980
|
+
}
|
|
1981
|
+
const responseMessage = await promise;
|
|
1982
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
1983
|
+
};
|
|
1997
1984
|
const createRpc = ipc => {
|
|
1985
|
+
const callbacks = Object.create(null);
|
|
1986
|
+
ipc._resolve = (id, response) => {
|
|
1987
|
+
const fn = callbacks[id];
|
|
1988
|
+
if (!fn) {
|
|
1989
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
fn(response);
|
|
1993
|
+
delete callbacks[id];
|
|
1994
|
+
};
|
|
1998
1995
|
const rpc = {
|
|
1996
|
+
async dispose() {
|
|
1997
|
+
await ipc?.dispose();
|
|
1998
|
+
},
|
|
1999
|
+
invoke(method, ...params) {
|
|
2000
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
2001
|
+
},
|
|
2002
|
+
invokeAndTransfer(method, ...params) {
|
|
2003
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
2004
|
+
},
|
|
1999
2005
|
// @ts-ignore
|
|
2000
2006
|
ipc,
|
|
2001
2007
|
/**
|
|
2002
2008
|
* @deprecated
|
|
2003
2009
|
*/
|
|
2004
2010
|
send(method, ...params) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
invoke(method, ...params) {
|
|
2008
|
-
return invoke$6(ipc, method, ...params);
|
|
2009
|
-
},
|
|
2010
|
-
invokeAndTransfer(method, ...params) {
|
|
2011
|
-
return invokeAndTransfer$4(ipc, method, ...params);
|
|
2012
|
-
},
|
|
2013
|
-
async dispose() {
|
|
2014
|
-
await ipc?.dispose();
|
|
2011
|
+
const message = create$p(method, params);
|
|
2012
|
+
ipc.send(message);
|
|
2015
2013
|
}
|
|
2016
2014
|
};
|
|
2017
2015
|
return rpc;
|
|
@@ -2028,7 +2026,7 @@ const logError = () => {
|
|
|
2028
2026
|
const handleMessage = event => {
|
|
2029
2027
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
2030
2028
|
const actualExecute = event?.target?.execute || execute;
|
|
2031
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
2029
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
2032
2030
|
};
|
|
2033
2031
|
const handleIpc = ipc => {
|
|
2034
2032
|
if ('addEventListener' in ipc) {
|
|
@@ -2046,15 +2044,16 @@ const listen$1 = async (module, options) => {
|
|
|
2046
2044
|
const ipc = module.wrap(rawIpc);
|
|
2047
2045
|
return ipc;
|
|
2048
2046
|
};
|
|
2049
|
-
const create$
|
|
2047
|
+
const create$7 = async ({
|
|
2050
2048
|
commandMap,
|
|
2049
|
+
isMessagePortOpen = true,
|
|
2051
2050
|
messagePort
|
|
2052
2051
|
}) => {
|
|
2053
2052
|
// TODO create a commandMap per rpc instance
|
|
2054
2053
|
register(commandMap);
|
|
2055
2054
|
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
2056
|
-
|
|
2057
|
-
|
|
2055
|
+
isMessagePortOpen,
|
|
2056
|
+
messagePort
|
|
2058
2057
|
});
|
|
2059
2058
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2060
2059
|
handleIpc(ipc);
|
|
@@ -2062,8 +2061,9 @@ const create$5 = async ({
|
|
|
2062
2061
|
messagePort.start();
|
|
2063
2062
|
return rpc;
|
|
2064
2063
|
};
|
|
2065
|
-
const create$
|
|
2064
|
+
const create$5 = async ({
|
|
2066
2065
|
commandMap,
|
|
2066
|
+
isMessagePortOpen,
|
|
2067
2067
|
send
|
|
2068
2068
|
}) => {
|
|
2069
2069
|
const {
|
|
@@ -2071,14 +2071,15 @@ const create$3 = async ({
|
|
|
2071
2071
|
port2
|
|
2072
2072
|
} = new MessageChannel();
|
|
2073
2073
|
await send(port1);
|
|
2074
|
-
return create$
|
|
2074
|
+
return create$7({
|
|
2075
2075
|
commandMap,
|
|
2076
|
+
isMessagePortOpen,
|
|
2076
2077
|
messagePort: port2
|
|
2077
2078
|
});
|
|
2078
2079
|
};
|
|
2079
2080
|
const TransferMessagePortRpcParent = {
|
|
2080
2081
|
__proto__: null,
|
|
2081
|
-
create: create$
|
|
2082
|
+
create: create$5
|
|
2082
2083
|
};
|
|
2083
2084
|
const create$2 = async ({
|
|
2084
2085
|
commandMap
|
|
@@ -2107,9 +2108,9 @@ const createMockRpc = ({
|
|
|
2107
2108
|
return command(...params);
|
|
2108
2109
|
};
|
|
2109
2110
|
const mockRpc = {
|
|
2111
|
+
invocations,
|
|
2110
2112
|
invoke,
|
|
2111
|
-
invokeAndTransfer: invoke
|
|
2112
|
-
invocations
|
|
2113
|
+
invokeAndTransfer: invoke
|
|
2113
2114
|
};
|
|
2114
2115
|
return mockRpc;
|
|
2115
2116
|
};
|
|
@@ -2119,7 +2120,7 @@ const {
|
|
|
2119
2120
|
invoke: invoke$5,
|
|
2120
2121
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
2121
2122
|
set: set$9
|
|
2122
|
-
} = create$
|
|
2123
|
+
} = create$4(ExtensionHostWorker);
|
|
2123
2124
|
const executeReferenceProvider = async (id, offset) => {
|
|
2124
2125
|
// @ts-ignore
|
|
2125
2126
|
return invoke$5('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
@@ -2155,7 +2156,7 @@ const ExtensionHost = {
|
|
|
2155
2156
|
const {
|
|
2156
2157
|
invoke: invoke$4,
|
|
2157
2158
|
set: set$8
|
|
2158
|
-
} = create$
|
|
2159
|
+
} = create$4(ExtensionManagementWorker);
|
|
2159
2160
|
const enable2 = (id, platform) => {
|
|
2160
2161
|
return invoke$4(`Extensions.enable2`, id, platform);
|
|
2161
2162
|
};
|
|
@@ -2168,7 +2169,7 @@ const {
|
|
|
2168
2169
|
invoke: invoke$3,
|
|
2169
2170
|
invokeAndTransfer: invokeAndTransfer$2,
|
|
2170
2171
|
set: set$7
|
|
2171
|
-
} = create$
|
|
2172
|
+
} = create$4(FileSystemWorker$1);
|
|
2172
2173
|
const remove = async dirent => {
|
|
2173
2174
|
return invoke$3('FileSystem.remove', dirent);
|
|
2174
2175
|
};
|
|
@@ -2256,7 +2257,7 @@ const {
|
|
|
2256
2257
|
invoke: invoke$2,
|
|
2257
2258
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
2258
2259
|
set: set$6
|
|
2259
|
-
} = create$
|
|
2260
|
+
} = create$4(MarkdownWorker$1);
|
|
2260
2261
|
const getVirtualDom$1 = async html => {
|
|
2261
2262
|
// @ts-ignore
|
|
2262
2263
|
return invoke$2('Markdown.getVirtualDom', html);
|
|
@@ -2288,7 +2289,7 @@ const {
|
|
|
2288
2289
|
invoke: invoke$1,
|
|
2289
2290
|
invokeAndTransfer,
|
|
2290
2291
|
set: set$5
|
|
2291
|
-
} = create$
|
|
2292
|
+
} = create$4(RendererWorker);
|
|
2292
2293
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
2293
2294
|
number(uid);
|
|
2294
2295
|
number(menuId);
|
|
@@ -3285,11 +3286,11 @@ const getKeyBindings = () => {
|
|
|
3285
3286
|
return [{
|
|
3286
3287
|
command: 'ExtensionDetail.focusNextTab',
|
|
3287
3288
|
key: RightArrow,
|
|
3288
|
-
when:
|
|
3289
|
+
when: FocusExtensionDetailTabs
|
|
3289
3290
|
}, {
|
|
3290
3291
|
command: 'ExtensionDetail.focusPreviousTab',
|
|
3291
3292
|
key: LeftArrow,
|
|
3292
|
-
when:
|
|
3293
|
+
when: FocusExtensionDetailTabs
|
|
3293
3294
|
}];
|
|
3294
3295
|
};
|
|
3295
3296
|
|
|
@@ -4097,7 +4098,7 @@ const formatLastUpdated = lastUpdated => {
|
|
|
4097
4098
|
return 'n/a';
|
|
4098
4099
|
}
|
|
4099
4100
|
try {
|
|
4100
|
-
const date = new Date(lastUpdated);
|
|
4101
|
+
const date = new Date(lastUpdated * 1000);
|
|
4101
4102
|
if (Number.isNaN(date.getTime())) {
|
|
4102
4103
|
return 'n/a';
|
|
4103
4104
|
}
|
|
@@ -4591,7 +4592,7 @@ const handleTabFocus = (state, name) => {
|
|
|
4591
4592
|
const newFocusedTabIndex = tabIndex === -1 ? focusedTabIndex : tabIndex;
|
|
4592
4593
|
return {
|
|
4593
4594
|
...state,
|
|
4594
|
-
focus:
|
|
4595
|
+
focus: FocusExtensionDetailTabs,
|
|
4595
4596
|
focusedTabIndex: newFocusedTabIndex
|
|
4596
4597
|
};
|
|
4597
4598
|
};
|
|
@@ -5411,7 +5412,7 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
5411
5412
|
focus,
|
|
5412
5413
|
uid
|
|
5413
5414
|
} = newState;
|
|
5414
|
-
if (focus ===
|
|
5415
|
+
if (focus === FocusExtensionDetailTabs) {
|
|
5415
5416
|
return [SetFocusContext, uid, focus];
|
|
5416
5417
|
}
|
|
5417
5418
|
// TODO set focus context
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/extension-detail-view",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.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": "^2.
|
|
14
|
+
"@lvce-editor/constants": "^2.7.0"
|
|
15
15
|
}
|
|
16
16
|
}
|