@lvce-editor/extension-host-worker 7.1.0 → 8.1.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 +151 -242
- package/package.json +1 -1
|
@@ -112,7 +112,7 @@ const fn = value => {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
const state$
|
|
115
|
+
const state$b = {
|
|
116
116
|
/** @type{any[]} */
|
|
117
117
|
onDidChangeTextDocumentListeners: [],
|
|
118
118
|
/** @type{any[]} */
|
|
@@ -122,19 +122,19 @@ const state$c = {
|
|
|
122
122
|
textDocuments: Object.create(null)
|
|
123
123
|
};
|
|
124
124
|
const setDocument = (textDocumentId, textDocument) => {
|
|
125
|
-
state$
|
|
125
|
+
state$b.textDocuments[textDocumentId] = textDocument;
|
|
126
126
|
};
|
|
127
127
|
const getDidOpenListeners = () => {
|
|
128
|
-
return state$
|
|
128
|
+
return state$b.onDidSaveTextDocumentListeners;
|
|
129
129
|
};
|
|
130
130
|
const getWillChangeListeners = () => {
|
|
131
|
-
return state$
|
|
131
|
+
return state$b.onWillChangeEditorListeners;
|
|
132
132
|
};
|
|
133
133
|
const getDidChangeListeners = () => {
|
|
134
|
-
return state$
|
|
134
|
+
return state$b.onDidChangeTextDocumentListeners;
|
|
135
135
|
};
|
|
136
136
|
const getDocument = textDocumentId => {
|
|
137
|
-
return state$
|
|
137
|
+
return state$b.textDocuments[textDocumentId];
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
const getOffset$1 = (textDocument, position) => {
|
|
@@ -684,7 +684,7 @@ const executeOrganizeImports = async uid => {
|
|
|
684
684
|
return edits;
|
|
685
685
|
};
|
|
686
686
|
|
|
687
|
-
const state$
|
|
687
|
+
const state$a = {
|
|
688
688
|
commands: Object.create(null)
|
|
689
689
|
};
|
|
690
690
|
const getCommandDisplay = command => {
|
|
@@ -707,10 +707,10 @@ const registerCommand = command => {
|
|
|
707
707
|
if (!command.execute) {
|
|
708
708
|
throw new Error('command is missing execute function');
|
|
709
709
|
}
|
|
710
|
-
if (command.id in state$
|
|
710
|
+
if (command.id in state$a.commands) {
|
|
711
711
|
throw new Error(`command cannot be registered multiple times`);
|
|
712
712
|
}
|
|
713
|
-
state$
|
|
713
|
+
state$a.commands[command.id] = command;
|
|
714
714
|
} catch (error) {
|
|
715
715
|
const commandDisplayId = getCommandDisplay(command);
|
|
716
716
|
throw new VError(error, `Failed to register command${commandDisplayId}`);
|
|
@@ -718,7 +718,7 @@ const registerCommand = command => {
|
|
|
718
718
|
};
|
|
719
719
|
const executeCommand$1 = async (id, ...args) => {
|
|
720
720
|
try {
|
|
721
|
-
const command = state$
|
|
721
|
+
const command = state$a.commands[id];
|
|
722
722
|
if (!command) {
|
|
723
723
|
throw new Error(`command ${id} not found`);
|
|
724
724
|
}
|
|
@@ -767,21 +767,25 @@ const {
|
|
|
767
767
|
}
|
|
768
768
|
});
|
|
769
769
|
|
|
770
|
-
const state$
|
|
770
|
+
const state$9 = {
|
|
771
771
|
configuration: Object.create(null)
|
|
772
772
|
};
|
|
773
773
|
const getConfiguration = key => {
|
|
774
|
-
return state$
|
|
774
|
+
return state$9.configuration[key] ?? '';
|
|
775
775
|
};
|
|
776
776
|
const setConfigurations = preferences => {
|
|
777
|
-
state$
|
|
777
|
+
state$9.configuration = preferences;
|
|
778
778
|
};
|
|
779
779
|
|
|
780
780
|
const DebugWorker$1 = 55;
|
|
781
|
+
const ExtensionManagementWorker = 9006;
|
|
781
782
|
const RendererWorker$1 = 1;
|
|
782
783
|
|
|
783
784
|
const rpcs$2 = Object.create(null);
|
|
784
785
|
const set$c = (id, rpc) => {
|
|
786
|
+
if (rpcs$2[id]) {
|
|
787
|
+
throw new Error(`rpc with id ${id} is already registered`);
|
|
788
|
+
}
|
|
785
789
|
rpcs$2[id] = rpc;
|
|
786
790
|
};
|
|
787
791
|
const get$b = id => {
|
|
@@ -814,16 +818,16 @@ const create$9 = rpcId => {
|
|
|
814
818
|
|
|
815
819
|
const {
|
|
816
820
|
dispose,
|
|
817
|
-
invoke: invoke$
|
|
818
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
821
|
+
invoke: invoke$7,
|
|
822
|
+
invokeAndTransfer: invokeAndTransfer$5,
|
|
819
823
|
set: set$b
|
|
820
824
|
} = create$9(DebugWorker$1);
|
|
821
825
|
|
|
822
826
|
const DebugWorker = {
|
|
823
827
|
__proto__: null,
|
|
824
828
|
dispose,
|
|
825
|
-
invoke: invoke$
|
|
826
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
829
|
+
invoke: invoke$7,
|
|
830
|
+
invokeAndTransfer: invokeAndTransfer$5,
|
|
827
831
|
set: set$b
|
|
828
832
|
};
|
|
829
833
|
|
|
@@ -1711,10 +1715,10 @@ const send$1 = (transport, method, ...params) => {
|
|
|
1711
1715
|
const message = create$4$2(method, params);
|
|
1712
1716
|
transport.send(message);
|
|
1713
1717
|
};
|
|
1714
|
-
const invoke$
|
|
1718
|
+
const invoke$6 = (ipc, method, ...params) => {
|
|
1715
1719
|
return invokeHelper(ipc, method, params, false);
|
|
1716
1720
|
};
|
|
1717
|
-
const invokeAndTransfer$
|
|
1721
|
+
const invokeAndTransfer$4 = (ipc, method, ...params) => {
|
|
1718
1722
|
return invokeHelper(ipc, method, params, true);
|
|
1719
1723
|
};
|
|
1720
1724
|
|
|
@@ -1750,10 +1754,10 @@ const createRpc$1 = ipc => {
|
|
|
1750
1754
|
send$1(ipc, method, ...params);
|
|
1751
1755
|
},
|
|
1752
1756
|
invoke(method, ...params) {
|
|
1753
|
-
return invoke$
|
|
1757
|
+
return invoke$6(ipc, method, ...params);
|
|
1754
1758
|
},
|
|
1755
1759
|
invokeAndTransfer(method, ...params) {
|
|
1756
|
-
return invokeAndTransfer$
|
|
1760
|
+
return invokeAndTransfer$4(ipc, method, ...params);
|
|
1757
1761
|
},
|
|
1758
1762
|
async dispose() {
|
|
1759
1763
|
await ipc?.dispose();
|
|
@@ -1909,22 +1913,59 @@ const WebWorkerRpcClient = {
|
|
|
1909
1913
|
};
|
|
1910
1914
|
|
|
1911
1915
|
const {
|
|
1912
|
-
invoke: invoke$
|
|
1913
|
-
|
|
1916
|
+
invoke: invoke$5} = create$9(ExtensionManagementWorker);
|
|
1917
|
+
|
|
1918
|
+
const {
|
|
1919
|
+
invoke: invoke$4,
|
|
1920
|
+
invokeAndTransfer: invokeAndTransfer$3} = create$9(RendererWorker$1);
|
|
1914
1921
|
const sendMessagePortToIframeWorker = async (port, rpcId) => {
|
|
1915
1922
|
const command = 'Iframes.handleMessagePort';
|
|
1916
|
-
await invokeAndTransfer$
|
|
1923
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToIframeWorker', port, command, rpcId);
|
|
1924
|
+
};
|
|
1925
|
+
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
1926
|
+
const command = 'Extensions.handleMessagePort';
|
|
1927
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
const createLazyRpc = rpcId => {
|
|
1931
|
+
let rpcPromise;
|
|
1932
|
+
let factory;
|
|
1933
|
+
const createRpc = async () => {
|
|
1934
|
+
const rpc = await factory();
|
|
1935
|
+
set$c(rpcId, rpc);
|
|
1936
|
+
};
|
|
1937
|
+
const ensureRpc = async () => {
|
|
1938
|
+
if (!rpcPromise) {
|
|
1939
|
+
rpcPromise = createRpc();
|
|
1940
|
+
}
|
|
1941
|
+
await rpcPromise;
|
|
1942
|
+
};
|
|
1943
|
+
return {
|
|
1944
|
+
async invoke(method, ...params) {
|
|
1945
|
+
await ensureRpc();
|
|
1946
|
+
const rpc = get$b(rpcId);
|
|
1947
|
+
return rpc.invoke(method, ...params);
|
|
1948
|
+
},
|
|
1949
|
+
async invokeAndTransfer(method, ...params) {
|
|
1950
|
+
await ensureRpc();
|
|
1951
|
+
const rpc = get$b(rpcId);
|
|
1952
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1953
|
+
},
|
|
1954
|
+
setFactory(value) {
|
|
1955
|
+
factory = value;
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1917
1958
|
};
|
|
1918
1959
|
|
|
1919
1960
|
const {
|
|
1920
|
-
invoke: invoke$
|
|
1961
|
+
invoke: invoke$3
|
|
1921
1962
|
} = DebugWorker;
|
|
1922
1963
|
|
|
1923
|
-
const state$
|
|
1964
|
+
const state$8 = {
|
|
1924
1965
|
debugProviderMap: Object.create(null)
|
|
1925
1966
|
};
|
|
1926
1967
|
const getDebugProvider = id => {
|
|
1927
|
-
const provider = state$
|
|
1968
|
+
const provider = state$8.debugProviderMap[id];
|
|
1928
1969
|
if (!provider) {
|
|
1929
1970
|
// @ts-ignore
|
|
1930
1971
|
throw new VError(`no debug provider "${id}" found`);
|
|
@@ -1935,24 +1976,24 @@ const registerDebugProvider = debugProvider => {
|
|
|
1935
1976
|
if (!debugProvider.id) {
|
|
1936
1977
|
throw new Error('Failed to register debug system provider: missing id');
|
|
1937
1978
|
}
|
|
1938
|
-
state$
|
|
1979
|
+
state$8.debugProviderMap[debugProvider.id] = debugProvider;
|
|
1939
1980
|
};
|
|
1940
1981
|
const handlePaused = async params => {
|
|
1941
1982
|
// @ts-ignore
|
|
1942
|
-
await invoke$
|
|
1983
|
+
await invoke$3('Debug.paused', params);
|
|
1943
1984
|
};
|
|
1944
1985
|
const handleResumed = async () => {
|
|
1945
1986
|
// @ts-ignore
|
|
1946
|
-
await invoke$
|
|
1987
|
+
await invoke$3('Debug.resumed');
|
|
1947
1988
|
};
|
|
1948
1989
|
const handleScriptParsed = async parsedScript => {
|
|
1949
1990
|
// @ts-ignore
|
|
1950
|
-
await invoke$
|
|
1991
|
+
await invoke$3('Debug.scriptParsed', parsedScript);
|
|
1951
1992
|
};
|
|
1952
1993
|
const handleChange = async params => {
|
|
1953
1994
|
object(params);
|
|
1954
1995
|
// @ts-ignore
|
|
1955
|
-
await invoke$
|
|
1996
|
+
await invoke$3('Debug.handleChange', params);
|
|
1956
1997
|
};
|
|
1957
1998
|
const start = async (protocol, path) => {
|
|
1958
1999
|
try {
|
|
@@ -2138,18 +2179,18 @@ const {
|
|
|
2138
2179
|
|
|
2139
2180
|
const RendererWorker = 1;
|
|
2140
2181
|
|
|
2141
|
-
const invoke$
|
|
2182
|
+
const invoke$2 = (method, ...params) => {
|
|
2142
2183
|
const rpc = get$b(RendererWorker);
|
|
2143
2184
|
return rpc.invoke(method, ...params);
|
|
2144
2185
|
};
|
|
2145
|
-
const invokeAndTransfer$
|
|
2186
|
+
const invokeAndTransfer$2 = (method, ...params) => {
|
|
2146
2187
|
const rpc = get$b(RendererWorker);
|
|
2147
2188
|
return rpc.invokeAndTransfer(method, ...params);
|
|
2148
2189
|
};
|
|
2149
2190
|
|
|
2150
2191
|
const showInformationMessage = message => {
|
|
2151
2192
|
string(message);
|
|
2152
|
-
const result = invoke$
|
|
2193
|
+
const result = invoke$2('ExtensionHostDialog.showInformationMessage', message);
|
|
2153
2194
|
return result;
|
|
2154
2195
|
};
|
|
2155
2196
|
|
|
@@ -2212,24 +2253,24 @@ const readFileExternal = async path => {
|
|
|
2212
2253
|
// this avoid parsing the potentially large message
|
|
2213
2254
|
// and improve performance by not blocking the renderer worker
|
|
2214
2255
|
// when reading / writing large files
|
|
2215
|
-
const content = await invoke$
|
|
2256
|
+
const content = await invoke$2('FileSystem.readFile', path);
|
|
2216
2257
|
return content;
|
|
2217
2258
|
};
|
|
2218
2259
|
const removeExternal = async path => {
|
|
2219
|
-
const content = await invoke$
|
|
2260
|
+
const content = await invoke$2('FileSystem.remove', path);
|
|
2220
2261
|
return content;
|
|
2221
2262
|
};
|
|
2222
2263
|
const existsExternal = async uri => {
|
|
2223
|
-
return await invoke$
|
|
2264
|
+
return await invoke$2('FileSystem.exists', uri);
|
|
2224
2265
|
};
|
|
2225
2266
|
const mkdirExternal = async uri => {
|
|
2226
|
-
return await invoke$
|
|
2267
|
+
return await invoke$2('FileSystem.mkdir', uri);
|
|
2227
2268
|
};
|
|
2228
2269
|
const writeFileExternal = async (uri, content) => {
|
|
2229
|
-
return await invoke$
|
|
2270
|
+
return await invoke$2('FileSystem.writeFile', uri, content);
|
|
2230
2271
|
};
|
|
2231
2272
|
const statExternal = async uri => {
|
|
2232
|
-
return await invoke$
|
|
2273
|
+
return await invoke$2('FileSystem.stat', uri);
|
|
2233
2274
|
};
|
|
2234
2275
|
const readDirWithFileTypesExternal = async path => {
|
|
2235
2276
|
// TODO when file is local,
|
|
@@ -2238,7 +2279,7 @@ const readDirWithFileTypesExternal = async path => {
|
|
|
2238
2279
|
// this avoid parsing the potentially large message
|
|
2239
2280
|
// and improve performance by not blocking the renderer worker
|
|
2240
2281
|
// when reading / writing large files
|
|
2241
|
-
const content = await invoke$
|
|
2282
|
+
const content = await invoke$2('FileSystem.readDirWithFileTypes', path);
|
|
2242
2283
|
return content;
|
|
2243
2284
|
};
|
|
2244
2285
|
const remove$3 = async (protocol, path) => {
|
|
@@ -2381,7 +2422,7 @@ const sendPort = async ({
|
|
|
2381
2422
|
port,
|
|
2382
2423
|
url
|
|
2383
2424
|
}) => {
|
|
2384
|
-
await invokeAndTransfer$
|
|
2425
|
+
await invokeAndTransfer$2('IpcParent.create', {
|
|
2385
2426
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
2386
2427
|
name,
|
|
2387
2428
|
port,
|
|
@@ -2422,7 +2463,7 @@ const IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug = {
|
|
|
2422
2463
|
};
|
|
2423
2464
|
|
|
2424
2465
|
const sendMessagePortToElectron = async (port, initialCommand) => {
|
|
2425
|
-
await invokeAndTransfer$
|
|
2466
|
+
await invokeAndTransfer$2('SendMessagePortToElectron.sendMessagePortToElectron', port, initialCommand);
|
|
2426
2467
|
};
|
|
2427
2468
|
|
|
2428
2469
|
const getPort = async type => {
|
|
@@ -2582,7 +2623,7 @@ const createNodeRpc = async ({
|
|
|
2582
2623
|
|
|
2583
2624
|
const send = async port => {
|
|
2584
2625
|
const initialCommand = 'FileSystem.handleMessagePort';
|
|
2585
|
-
await invokeAndTransfer$
|
|
2626
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, initialCommand);
|
|
2586
2627
|
};
|
|
2587
2628
|
const launchFileSystemProcess = async () => {
|
|
2588
2629
|
const rpc = await TransferMessagePortRpcParent.create({
|
|
@@ -2663,7 +2704,7 @@ const getEnabledProviders = () => {
|
|
|
2663
2704
|
|
|
2664
2705
|
const confirm = message => {
|
|
2665
2706
|
string(message);
|
|
2666
|
-
const result = invoke$
|
|
2707
|
+
const result = invoke$2('ConfirmPrompt.prompt', message);
|
|
2667
2708
|
return result;
|
|
2668
2709
|
};
|
|
2669
2710
|
|
|
@@ -2675,7 +2716,7 @@ const showQuickPick = async ({
|
|
|
2675
2716
|
}) => {
|
|
2676
2717
|
const rawPicks = await getPicks();
|
|
2677
2718
|
const picks = rawPicks.map(toPick);
|
|
2678
|
-
return invoke$
|
|
2719
|
+
return invoke$2(ExtensionHostQuickPickShow, picks);
|
|
2679
2720
|
};
|
|
2680
2721
|
|
|
2681
2722
|
const {
|
|
@@ -2766,7 +2807,7 @@ const extensionHostSubWorkerUrl = getExtensionHostSubWorkerUrl();
|
|
|
2766
2807
|
|
|
2767
2808
|
const set$8 = async (url, contentSecurityPolicy) => {
|
|
2768
2809
|
const pathName = new URL(url).pathname;
|
|
2769
|
-
await invoke$
|
|
2810
|
+
await invoke$2('ExtensionHostWorkerContentSecurityPolicy.set', pathName, contentSecurityPolicy);
|
|
2770
2811
|
};
|
|
2771
2812
|
|
|
2772
2813
|
/**
|
|
@@ -2921,62 +2962,16 @@ const getProtocol = uri => {
|
|
|
2921
2962
|
return '';
|
|
2922
2963
|
};
|
|
2923
2964
|
|
|
2924
|
-
|
|
2925
|
-
const {
|
|
2926
|
-
origin,
|
|
2927
|
-
uid
|
|
2928
|
-
} = webView;
|
|
2929
|
-
const {
|
|
2930
|
-
port1,
|
|
2931
|
-
port2
|
|
2932
|
-
} = getPortTuple();
|
|
2933
|
-
const rpcPromise = MessagePortRpcParent.create({
|
|
2934
|
-
commandMap: {},
|
|
2935
|
-
isMessagePortOpen: false,
|
|
2936
|
-
messagePort: port2
|
|
2937
|
-
});
|
|
2938
|
-
const portType = 'test';
|
|
2939
|
-
await invokeAndTransfer$1('WebView.setPort', uid, port1, origin, portType);
|
|
2940
|
-
// TODO maybe don't send a message port only to get object url?
|
|
2941
|
-
// TODO dispose rpc to avoid memory leak
|
|
2942
|
-
const rpc = await rpcPromise;
|
|
2943
|
-
return rpc;
|
|
2944
|
-
};
|
|
2945
|
-
|
|
2946
|
-
const webViews = Object.create(null);
|
|
2947
|
-
const webViewProviders = Object.create(null);
|
|
2948
|
-
const getProvider = providerId => {
|
|
2949
|
-
return webViewProviders[providerId];
|
|
2950
|
-
};
|
|
2951
|
-
const setProvider = (providerId, provider) => {
|
|
2952
|
-
webViewProviders[providerId] = provider;
|
|
2953
|
-
};
|
|
2954
|
-
const getWebView = id => {
|
|
2955
|
-
return webViews[id];
|
|
2956
|
-
};
|
|
2957
|
-
const setWebView = (id, webView) => {
|
|
2958
|
-
webViews[id] = webView;
|
|
2959
|
-
};
|
|
2960
|
-
const getWebViews$1 = () => {
|
|
2961
|
-
return webViews;
|
|
2962
|
-
};
|
|
2965
|
+
// @ts-ignore
|
|
2963
2966
|
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
// 5. provide objectUrl to extension
|
|
2967
|
+
const {
|
|
2968
|
+
invoke: invoke$1,
|
|
2969
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
2970
|
+
setFactory
|
|
2971
|
+
} = createLazyRpc(ExtensionManagementWorker);
|
|
2970
2972
|
|
|
2971
2973
|
const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
2972
|
-
|
|
2973
|
-
const webView = getWebView(options.webViewId);
|
|
2974
|
-
if (!webView) {
|
|
2975
|
-
throw new Error(`webview ${options.webViewId} not found`);
|
|
2976
|
-
}
|
|
2977
|
-
const [rpc, blob] = await Promise.all([createWebViewIpc(webView), invoke$1('FileSystem.getBlob', uri)]);
|
|
2978
|
-
const objectUrl = await rpc.invoke('createObjectUrl', blob);
|
|
2979
|
-
return objectUrl;
|
|
2974
|
+
return await invoke$1('Extensions.getRemoteUrlForWebView', uri, options);
|
|
2980
2975
|
};
|
|
2981
2976
|
|
|
2982
2977
|
const isFileProtocol = protocol => {
|
|
@@ -3013,16 +3008,12 @@ const getRemoteUrl$1 = async (uri, options = {}) => {
|
|
|
3013
3008
|
return getRemoteUrlForWebView(uri, options);
|
|
3014
3009
|
}
|
|
3015
3010
|
if (uri.startsWith('html://')) {
|
|
3016
|
-
const url = await invoke$
|
|
3011
|
+
const url = await invoke$2('Blob.getSrc', uri);
|
|
3017
3012
|
return url;
|
|
3018
3013
|
}
|
|
3019
3014
|
throw new Error(`unsupported platform for remote url`);
|
|
3020
3015
|
};
|
|
3021
3016
|
|
|
3022
|
-
const state$8 = {
|
|
3023
|
-
webExtensions: []
|
|
3024
|
-
};
|
|
3025
|
-
|
|
3026
3017
|
const getJson = async url => {
|
|
3027
3018
|
try {
|
|
3028
3019
|
const response = await fetch(url);
|
|
@@ -3056,10 +3047,10 @@ const getWebExtensions = async () => {
|
|
|
3056
3047
|
};
|
|
3057
3048
|
|
|
3058
3049
|
const getSharedProcessExtensions = () => {
|
|
3059
|
-
return invoke$
|
|
3050
|
+
return invoke$2(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
|
|
3060
3051
|
};
|
|
3061
3052
|
const doGetExtensions = async () => {
|
|
3062
|
-
const meta =
|
|
3053
|
+
const meta = await invoke$1('Extensions.getDynamicWebExtensions');
|
|
3063
3054
|
if (platform === Web) {
|
|
3064
3055
|
const webExtensions = await getWebExtensions();
|
|
3065
3056
|
return [...webExtensions, ...meta];
|
|
@@ -3193,7 +3184,8 @@ const getEnabledProviderIds = async (scheme, root) => {
|
|
|
3193
3184
|
};
|
|
3194
3185
|
const getIconDefinitions = async providerId => {
|
|
3195
3186
|
const extensions = await getExtensions();
|
|
3196
|
-
const
|
|
3187
|
+
const webextensions = await invoke$5(`Extensions.getDynamicWebExtensions`);
|
|
3188
|
+
const allExtensions = [...extensions, ...webextensions];
|
|
3197
3189
|
for (const extension of allExtensions) {
|
|
3198
3190
|
const id = extension.id.split('.');
|
|
3199
3191
|
const shortId = id[1];
|
|
@@ -3278,6 +3270,24 @@ const {
|
|
|
3278
3270
|
}
|
|
3279
3271
|
});
|
|
3280
3272
|
|
|
3273
|
+
const webViews = Object.create(null);
|
|
3274
|
+
const webViewProviders = Object.create(null);
|
|
3275
|
+
const getProvider = providerId => {
|
|
3276
|
+
return webViewProviders[providerId];
|
|
3277
|
+
};
|
|
3278
|
+
const setProvider = (providerId, provider) => {
|
|
3279
|
+
webViewProviders[providerId] = provider;
|
|
3280
|
+
};
|
|
3281
|
+
const getWebView = id => {
|
|
3282
|
+
return webViews[id];
|
|
3283
|
+
};
|
|
3284
|
+
const setWebView = (id, webView) => {
|
|
3285
|
+
webViews[id] = webView;
|
|
3286
|
+
};
|
|
3287
|
+
const getWebViews$1 = () => {
|
|
3288
|
+
return webViews;
|
|
3289
|
+
};
|
|
3290
|
+
|
|
3281
3291
|
// TODO pass uuid to allow having multiple webviews open at the same time
|
|
3282
3292
|
|
|
3283
3293
|
/**
|
|
@@ -3364,7 +3374,7 @@ const getWorkspaceFolder = path => {
|
|
|
3364
3374
|
};
|
|
3365
3375
|
const handleWorkspaceRefresh = async () => {
|
|
3366
3376
|
// @ts-ignore
|
|
3367
|
-
await invoke$
|
|
3377
|
+
await invoke$4('Layout.handleWorkspaceRefresh');
|
|
3368
3378
|
};
|
|
3369
3379
|
|
|
3370
3380
|
class FormattingError extends Error {
|
|
@@ -4137,39 +4147,8 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
|
|
|
4137
4147
|
// console.info('activated', path)
|
|
4138
4148
|
};
|
|
4139
4149
|
|
|
4140
|
-
const NewLine = '\n';
|
|
4141
|
-
const Slash$1 = '/';
|
|
4142
|
-
|
|
4143
|
-
const interExtensionId = path => {
|
|
4144
|
-
const slashIndex = path.lastIndexOf(Slash$1);
|
|
4145
|
-
return path.slice(slashIndex + 1);
|
|
4146
|
-
};
|
|
4147
|
-
|
|
4148
|
-
const getWebExtensionManifest = async (path, manifestPath) => {
|
|
4149
|
-
try {
|
|
4150
|
-
const manifest = await getJson(manifestPath);
|
|
4151
|
-
return {
|
|
4152
|
-
...manifest,
|
|
4153
|
-
path,
|
|
4154
|
-
uri: path
|
|
4155
|
-
};
|
|
4156
|
-
} catch (error) {
|
|
4157
|
-
const id = interExtensionId(path);
|
|
4158
|
-
throw new VError(error, `Failed to load extension manifest for ${id}`);
|
|
4159
|
-
}
|
|
4160
|
-
};
|
|
4161
|
-
|
|
4162
|
-
const getWebManifestPath = path => {
|
|
4163
|
-
const manifestPath = `${path}/extension.json`;
|
|
4164
|
-
return manifestPath;
|
|
4165
|
-
};
|
|
4166
|
-
|
|
4167
4150
|
const addWebExtension = async path => {
|
|
4168
|
-
const
|
|
4169
|
-
const manifest = await getWebExtensionManifest(path, manifestPath);
|
|
4170
|
-
// TODO avoid mutation if possible
|
|
4171
|
-
state$8.webExtensions.push(manifest);
|
|
4172
|
-
clear();
|
|
4151
|
+
const manifest = await invoke$1('Extensions.addWebExtension', path);
|
|
4173
4152
|
return manifest;
|
|
4174
4153
|
};
|
|
4175
4154
|
|
|
@@ -4184,9 +4163,11 @@ const applyBulkReplacement = async (files, ranges, replacement) => {
|
|
|
4184
4163
|
};
|
|
4185
4164
|
|
|
4186
4165
|
const addCssStyleSheet = (id, css) => {
|
|
4187
|
-
return invoke$
|
|
4166
|
+
return invoke$2('Css.addCssStyleSheet', id, css);
|
|
4188
4167
|
};
|
|
4189
4168
|
|
|
4169
|
+
const NewLine = '\n';
|
|
4170
|
+
|
|
4190
4171
|
const warn = (...args) => {
|
|
4191
4172
|
console.warn(...args);
|
|
4192
4173
|
};
|
|
@@ -4617,10 +4598,10 @@ const GetColorThemeCssCachedIndexedDb = {
|
|
|
4617
4598
|
};
|
|
4618
4599
|
|
|
4619
4600
|
const getText$1 = key => {
|
|
4620
|
-
return invoke$
|
|
4601
|
+
return invoke$2('LocalStorage.getText', key);
|
|
4621
4602
|
};
|
|
4622
4603
|
const setText = (key, value) => {
|
|
4623
|
-
return invoke$
|
|
4604
|
+
return invoke$2('LocalStorage.setText', key, value);
|
|
4624
4605
|
};
|
|
4625
4606
|
|
|
4626
4607
|
const getCacheKey = colorThemeId => {
|
|
@@ -4655,7 +4636,7 @@ const GetColorThemeCssCachedNoop = {
|
|
|
4655
4636
|
};
|
|
4656
4637
|
|
|
4657
4638
|
const get = key => {
|
|
4658
|
-
return invoke$
|
|
4639
|
+
return invoke$2('Preferences.get', key);
|
|
4659
4640
|
};
|
|
4660
4641
|
|
|
4661
4642
|
const getCacheFn = config => {
|
|
@@ -4681,7 +4662,7 @@ const getColorThemeCssCached = async (colorThemeId, getData) => {
|
|
|
4681
4662
|
};
|
|
4682
4663
|
|
|
4683
4664
|
const readJson = url => {
|
|
4684
|
-
return invoke$
|
|
4665
|
+
return invoke$2('FileSystem.readJson', url);
|
|
4685
4666
|
};
|
|
4686
4667
|
|
|
4687
4668
|
const dirname = (pathSeparator, path) => {
|
|
@@ -4763,7 +4744,7 @@ const getMetaThemeColor = colorThemeJson => {
|
|
|
4763
4744
|
};
|
|
4764
4745
|
|
|
4765
4746
|
const setThemeColor = async themeColor => {
|
|
4766
|
-
await invoke$
|
|
4747
|
+
await invoke$2(/* Meta.setThemeColor */'Meta.setThemeColor', /* color */themeColor);
|
|
4767
4748
|
};
|
|
4768
4749
|
|
|
4769
4750
|
// TODO by default color theme should come from local storage, session storage, cache storage, indexeddb or blob url -> fast initial load
|
|
@@ -4799,7 +4780,7 @@ const watch = async id => {
|
|
|
4799
4780
|
return;
|
|
4800
4781
|
}
|
|
4801
4782
|
state$1.watchedTheme = id;
|
|
4802
|
-
await invoke$
|
|
4783
|
+
await invoke$2('ExtensionHost.watchColorTheme', id);
|
|
4803
4784
|
};
|
|
4804
4785
|
const getPreferredColorTheme = () => {
|
|
4805
4786
|
const preferredColorTheme = get('workbench.colorTheme');
|
|
@@ -4872,46 +4853,18 @@ const createWebView3 = async ({
|
|
|
4872
4853
|
};
|
|
4873
4854
|
|
|
4874
4855
|
const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
|
|
4875
|
-
|
|
4876
|
-
// connection between a webview/iframe and it's webworker. For this to work
|
|
4877
|
-
// the iframe worker creates a messagechannel and sends one messageport to the webview
|
|
4878
|
-
// and the other messageport to the webworker. This enables direct communication via
|
|
4879
|
-
// the two message ports
|
|
4880
|
-
|
|
4881
|
-
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4882
|
-
// host subworker doesn't need to import the other file
|
|
4883
|
-
await invokeAndTransfer$1('IpcParent.create', {
|
|
4884
|
-
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4885
|
-
name: rpcInfo.name,
|
|
4886
|
-
port,
|
|
4887
|
-
raw: true,
|
|
4888
|
-
url: rpcInfo.url
|
|
4889
|
-
});
|
|
4856
|
+
await invokeAndTransfer$1('Extensions.createWebViewWorkerRpc2', rpcInfo, port);
|
|
4890
4857
|
};
|
|
4891
4858
|
|
|
4892
4859
|
/**
|
|
4893
4860
|
* @deprecated use createWebViewWorkerRpc2 which passes the worker url as a parameter
|
|
4894
4861
|
*/
|
|
4895
4862
|
const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
4896
|
-
|
|
4897
|
-
// connection between a webview/iframe and it's webworker. For this to work
|
|
4898
|
-
// the iframe worker creates a messagechannel and sends one messageport to the webview
|
|
4899
|
-
// and the other messageport to the webworker. This enables direct communication via
|
|
4900
|
-
// the two message ports
|
|
4901
|
-
|
|
4902
|
-
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4903
|
-
// host subworker doesn't need to import the other file
|
|
4904
|
-
await invokeAndTransfer$1('IpcParent.create', {
|
|
4905
|
-
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4906
|
-
name: rpcInfo.name,
|
|
4907
|
-
port,
|
|
4908
|
-
raw: true,
|
|
4909
|
-
url: extensionHostSubWorkerUrl
|
|
4910
|
-
});
|
|
4863
|
+
await invokeAndTransfer$1('Extensions.createWebViewWorkerRpc', rpcInfo, port);
|
|
4911
4864
|
};
|
|
4912
4865
|
|
|
4913
4866
|
const executeExternalCommand = (method, ...params) => {
|
|
4914
|
-
return invoke$
|
|
4867
|
+
return invoke$2(method, ...params);
|
|
4915
4868
|
};
|
|
4916
4869
|
|
|
4917
4870
|
const BraceCompletionExecuteBraceCompletionProvider = 'ExtensionHostBraceCompletion.executeBraceCompletionProvider';
|
|
@@ -4979,7 +4932,7 @@ const mockExec = () => {
|
|
|
4979
4932
|
try {
|
|
4980
4933
|
// @ts-ignore
|
|
4981
4934
|
api.exec = async (command, args, options) => {
|
|
4982
|
-
const result = await invoke$
|
|
4935
|
+
const result = await invoke$2('Test.executeMockExecFunction', command, args, options);
|
|
4983
4936
|
const {
|
|
4984
4937
|
exitCode,
|
|
4985
4938
|
stderr,
|
|
@@ -5005,7 +4958,7 @@ const mockRpc = () => {
|
|
|
5005
4958
|
try {
|
|
5006
4959
|
return {
|
|
5007
4960
|
async invoke(method, ...params) {
|
|
5008
|
-
const result = await invoke$
|
|
4961
|
+
const result = await invoke$2('Test.executeMockRpcFunction', options.name, method, ...params);
|
|
5009
4962
|
return result;
|
|
5010
4963
|
}
|
|
5011
4964
|
};
|
|
@@ -5420,71 +5373,16 @@ const getExtension = async id => {
|
|
|
5420
5373
|
return undefined;
|
|
5421
5374
|
};
|
|
5422
5375
|
|
|
5423
|
-
const findMatchingIconThemeExtension = (extensions, iconThemeId) => {
|
|
5424
|
-
for (const extension of extensions) {
|
|
5425
|
-
if (extension && extension.iconThemes) {
|
|
5426
|
-
for (const iconTheme of extension.iconThemes) {
|
|
5427
|
-
if (iconTheme.id === iconThemeId) {
|
|
5428
|
-
return {
|
|
5429
|
-
...iconTheme,
|
|
5430
|
-
extensionPath: extension.path
|
|
5431
|
-
};
|
|
5432
|
-
}
|
|
5433
|
-
}
|
|
5434
|
-
}
|
|
5435
|
-
}
|
|
5436
|
-
return undefined;
|
|
5437
|
-
};
|
|
5438
|
-
|
|
5439
|
-
const getIconThemeUrl = iconThemeId => {
|
|
5440
|
-
return `${assetDir}/extensions/builtin.${iconThemeId}/icon-theme.json`;
|
|
5441
|
-
};
|
|
5442
|
-
|
|
5443
5376
|
const getIconThemeJson$1 = async iconThemeId => {
|
|
5444
|
-
|
|
5445
|
-
const url = getIconThemeUrl(iconThemeId);
|
|
5446
|
-
const json = await getJson(url);
|
|
5447
|
-
return {
|
|
5448
|
-
extensionPath: `${assetDir}/extensions/builtin.${iconThemeId}`,
|
|
5449
|
-
json
|
|
5450
|
-
};
|
|
5451
|
-
}
|
|
5452
|
-
for (const webExtension of state$8.webExtensions) {
|
|
5453
|
-
if (webExtension.iconThemes) {
|
|
5454
|
-
for (const iconTheme of webExtension.iconThemes) {
|
|
5455
|
-
// TODO handle error when icon theme path is not of type string
|
|
5456
|
-
const iconThemeUrl = `${webExtension.path}/${iconTheme.path}`;
|
|
5457
|
-
const json = await getJson(iconThemeUrl);
|
|
5458
|
-
return {
|
|
5459
|
-
extensionPath: webExtension.path,
|
|
5460
|
-
json
|
|
5461
|
-
};
|
|
5462
|
-
}
|
|
5463
|
-
}
|
|
5464
|
-
}
|
|
5465
|
-
const extensions = await getExtensions();
|
|
5466
|
-
const iconTheme = findMatchingIconThemeExtension(extensions, iconThemeId);
|
|
5467
|
-
if (!iconTheme) {
|
|
5468
|
-
return undefined;
|
|
5469
|
-
}
|
|
5470
|
-
const iconThemePath = `${iconTheme.extensionPath}/${iconTheme.path}`;
|
|
5471
|
-
const iconThemeJson = await readJson(iconThemePath);
|
|
5472
|
-
return {
|
|
5473
|
-
extensionPath: iconTheme.extensionPath,
|
|
5474
|
-
json: iconThemeJson
|
|
5475
|
-
};
|
|
5377
|
+
throw new Error(`getIconThemeJson is deprecated. Use icon-theme-worker instead`);
|
|
5476
5378
|
};
|
|
5477
5379
|
|
|
5478
5380
|
const getIconThemeJson = async iconThemeId => {
|
|
5479
|
-
return getIconThemeJson$1(
|
|
5381
|
+
return getIconThemeJson$1();
|
|
5480
5382
|
};
|
|
5481
5383
|
|
|
5482
|
-
const getRpcInfo = rpcId => {
|
|
5483
|
-
|
|
5484
|
-
if (!info) {
|
|
5485
|
-
throw new Error(`Rpc not found ${rpcId}`);
|
|
5486
|
-
}
|
|
5487
|
-
return info;
|
|
5384
|
+
const getRpcInfo = async rpcId => {
|
|
5385
|
+
return await invoke$1('Extensions.getRpcInfo', rpcId);
|
|
5488
5386
|
};
|
|
5489
5387
|
|
|
5490
5388
|
const emptyStatus = {
|
|
@@ -5571,7 +5469,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
5571
5469
|
};
|
|
5572
5470
|
|
|
5573
5471
|
const handleIconThemeChange = async () => {
|
|
5574
|
-
await invoke$
|
|
5472
|
+
await invoke$2('IconTheme.handleIconThemeChange');
|
|
5575
5473
|
};
|
|
5576
5474
|
|
|
5577
5475
|
const initialIconTheme = undefined;
|
|
@@ -6326,7 +6224,18 @@ const commandMap = {
|
|
|
6326
6224
|
'WebViews.getWebViews': getWebViews
|
|
6327
6225
|
};
|
|
6328
6226
|
|
|
6227
|
+
const launchExtensionManagementWorker = async () => {
|
|
6228
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
6229
|
+
commandMap: {},
|
|
6230
|
+
async send(port) {
|
|
6231
|
+
await sendMessagePortToExtensionManagementWorker(port, 0);
|
|
6232
|
+
}
|
|
6233
|
+
});
|
|
6234
|
+
return rpc;
|
|
6235
|
+
};
|
|
6236
|
+
|
|
6329
6237
|
const listen = async () => {
|
|
6238
|
+
setFactory(launchExtensionManagementWorker);
|
|
6330
6239
|
const rpc = await WebWorkerRpcClient.create({
|
|
6331
6240
|
commandMap: commandMap
|
|
6332
6241
|
});
|