@lvce-editor/extension-management-worker 4.24.1 → 4.25.1
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.
|
@@ -1417,7 +1417,7 @@ const setPlatform = platform => {
|
|
|
1417
1417
|
const hasWebExtensionUri = uri => {
|
|
1418
1418
|
return state$1.extensionsState.webExtensions.some(extension => extension.uri === uri);
|
|
1419
1419
|
};
|
|
1420
|
-
const
|
|
1420
|
+
const addExtension$1 = extension => {
|
|
1421
1421
|
update({
|
|
1422
1422
|
webExtensions: [...state$1.extensionsState.webExtensions, extension]
|
|
1423
1423
|
});
|
|
@@ -1991,25 +1991,6 @@ const activateByEvent = async (event, assetDir, platform) => {
|
|
|
1991
1991
|
}
|
|
1992
1992
|
};
|
|
1993
1993
|
|
|
1994
|
-
const getWebExtensionManifest = async (path, manifestPath) => {
|
|
1995
|
-
try {
|
|
1996
|
-
const manifest = await getJson$1(manifestPath);
|
|
1997
|
-
return {
|
|
1998
|
-
...manifest,
|
|
1999
|
-
path,
|
|
2000
|
-
uri: path
|
|
2001
|
-
};
|
|
2002
|
-
} catch (error) {
|
|
2003
|
-
const id = interExtensionId(path);
|
|
2004
|
-
throw new VError(error, `Failed to load extension manifest for ${id}`);
|
|
2005
|
-
}
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
const getWebManifestPath = path => {
|
|
2009
|
-
const manifestPath = `${path}/extension.json`;
|
|
2010
|
-
return manifestPath;
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
1994
|
const invalidateExtensionsCache = async () => {
|
|
2014
1995
|
await invoke$3('ExtensionManagement.invalidateExtensionsCache');
|
|
2015
1996
|
};
|
|
@@ -2031,22 +2012,45 @@ const handleChange = async id => {
|
|
|
2031
2012
|
await invoke('StatusBar.handleChange', id);
|
|
2032
2013
|
};
|
|
2033
2014
|
|
|
2034
|
-
const hasStatusBarItems =
|
|
2035
|
-
return Array.isArray(
|
|
2015
|
+
const hasStatusBarItems = extension => {
|
|
2016
|
+
return Array.isArray(extension.statusBarItems) && extension.statusBarItems.length > 0;
|
|
2036
2017
|
};
|
|
2018
|
+
const addExtension = async extension => {
|
|
2019
|
+
addExtension$1(extension);
|
|
2020
|
+
clearCachedExtensions();
|
|
2021
|
+
await invalidateExtensionsCache();
|
|
2022
|
+
if (hasStatusBarItems(extension)) {
|
|
2023
|
+
await handleChange(extension.id || extension.path);
|
|
2024
|
+
}
|
|
2025
|
+
return extension;
|
|
2026
|
+
};
|
|
2027
|
+
|
|
2028
|
+
const getWebExtensionManifest = async (path, manifestPath) => {
|
|
2029
|
+
try {
|
|
2030
|
+
const manifest = await getJson$1(manifestPath);
|
|
2031
|
+
return {
|
|
2032
|
+
...manifest,
|
|
2033
|
+
path,
|
|
2034
|
+
uri: path
|
|
2035
|
+
};
|
|
2036
|
+
} catch (error) {
|
|
2037
|
+
const id = interExtensionId(path);
|
|
2038
|
+
throw new VError(error, `Failed to load extension manifest for ${id}`);
|
|
2039
|
+
}
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
const getWebManifestPath = path => {
|
|
2043
|
+
const manifestPath = `${path}/extension.json`;
|
|
2044
|
+
return manifestPath;
|
|
2045
|
+
};
|
|
2046
|
+
|
|
2037
2047
|
const addWebExtension = async path => {
|
|
2038
2048
|
if (hasWebExtensionUri(path)) {
|
|
2039
2049
|
return undefined;
|
|
2040
2050
|
}
|
|
2041
2051
|
const manifestPath = getWebManifestPath(path);
|
|
2042
2052
|
const manifest = await getWebExtensionManifest(path, manifestPath);
|
|
2043
|
-
|
|
2044
|
-
clearCachedExtensions();
|
|
2045
|
-
await invalidateExtensionsCache();
|
|
2046
|
-
if (hasStatusBarItems(manifest)) {
|
|
2047
|
-
await handleChange(manifest.id || path);
|
|
2048
|
-
}
|
|
2049
|
-
return manifest;
|
|
2053
|
+
return addExtension(manifest);
|
|
2050
2054
|
};
|
|
2051
2055
|
|
|
2052
2056
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
@@ -2371,7 +2375,7 @@ const executeDiagnosticProvider = async (extensionsState, textDocument, ...args)
|
|
|
2371
2375
|
const extensions = await getMatchingExtensions$3(extensionsState, textDocument, assetDir, platform);
|
|
2372
2376
|
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2373
2377
|
const results = await Promise.all(rpcs.map(rpc => executeRpcDiagnosticProvider(rpc, textDocument, args)));
|
|
2374
|
-
return results
|
|
2378
|
+
return results.flat();
|
|
2375
2379
|
};
|
|
2376
2380
|
|
|
2377
2381
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
@@ -3264,6 +3268,7 @@ const commandMap = {
|
|
|
3264
3268
|
'Extensions.activate2': activateExtension2,
|
|
3265
3269
|
'Extensions.activate3': activateExtension3,
|
|
3266
3270
|
'Extensions.activateByEvent': activateByEvent,
|
|
3271
|
+
'Extensions.addExtension': addExtension,
|
|
3267
3272
|
'Extensions.addWebExtension': addWebExtension,
|
|
3268
3273
|
'Extensions.createViewInstance': createViewInstance,
|
|
3269
3274
|
'Extensions.createWebViewWorkerRpc': createWebViewWorkerRpc,
|