@lvce-editor/extension-management-worker 4.75.1 → 4.76.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/README.md +6 -0
- package/dist/extensionManagementWorkerMain.js +31 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,3 +9,9 @@ Node RPC declarations run on the local application host by default. A declaratio
|
|
|
9
9
|
Transport commands are reserved for extension management and cannot be invoked as ordinary extension commands. The transport extension owns authentication, WebSockets, and connection disposal. Disabled or missing transports fail without launching a local replacement process. File workspaces retain local Node RPC connections.
|
|
10
10
|
|
|
11
11
|
Transports can additionally declare a `requestCommand` for `text-search`, `file-search`, and `terminal-options` requests. These receive the workspace URI, request type, and request arguments, and return the result through the extension RPC.
|
|
12
|
+
|
|
13
|
+
## Extension query fields
|
|
14
|
+
|
|
15
|
+
`Extensions.getAllExtensions(assetDir, platform, fields?)` accepts an optional array of top-level field names, for example `['source-control-actions']`. Projection happens inside extension management before its RPC response is cloned. The same argument is supported through `Extensions.invokeForApplication(applicationId, 'Extensions.getAllExtensions', assetDir, platform, fields)`.
|
|
16
|
+
|
|
17
|
+
Omitting `fields` preserves the complete metadata response. An empty array returns an empty object for each extension. Missing fields are omitted; extension ordering and membership are unchanged. Fields such as `disabled` and `applicationId` reflect the resolved extension state when requested. Nested values are returned whole, and field names are literal rather than dotted paths. Projection does not change cached manifests or reduce the underlying shared-process catalog fetch.
|
|
@@ -278,6 +278,12 @@ const number = value => {
|
|
|
278
278
|
throw new AssertionError('expected value to be of type number');
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
+
const array = value => {
|
|
282
|
+
const type = getType(value);
|
|
283
|
+
if (type !== Array$1) {
|
|
284
|
+
throw new AssertionError('expected value to be of type array');
|
|
285
|
+
}
|
|
286
|
+
};
|
|
281
287
|
const string = value => {
|
|
282
288
|
const type = getType(value);
|
|
283
289
|
if (type !== String$1) {
|
|
@@ -2066,21 +2072,33 @@ const getExtensionsWithState = async (extensions, extensionsState, platform) =>
|
|
|
2066
2072
|
} = await getWorkspaceExtensionEnablementSafe();
|
|
2067
2073
|
return withDisabledState(extensionsWithDisabledState, workspaceDisabledIds, workspaceEnabledIds);
|
|
2068
2074
|
};
|
|
2069
|
-
const getAllExtensionsWithState = async (extensionsState, assetDir, platform) => {
|
|
2075
|
+
const getAllExtensionsWithState = async (extensionsState, assetDir, platform, fields) => {
|
|
2070
2076
|
const {
|
|
2071
2077
|
assetDir: resolvedAssetDir,
|
|
2072
2078
|
platform: resolvedPlatform
|
|
2073
2079
|
} = await getRuntimeContext(assetDir, platform);
|
|
2074
2080
|
string(resolvedAssetDir);
|
|
2075
2081
|
number(resolvedPlatform);
|
|
2082
|
+
if (fields !== undefined) {
|
|
2083
|
+
array(fields);
|
|
2084
|
+
for (const field of fields) {
|
|
2085
|
+
string(field);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2076
2088
|
const meta = extensionsState.webExtensions;
|
|
2089
|
+
let extensions;
|
|
2077
2090
|
if (resolvedPlatform === Web) {
|
|
2078
2091
|
const webExtensions = await getWebExtensions(resolvedAssetDir);
|
|
2079
2092
|
const compatibleExtensions = [...webExtensions, ...meta].filter(extension => isExtensionCompatible(extension, resolvedPlatform));
|
|
2080
|
-
|
|
2093
|
+
extensions = await getExtensionsWithState(compatibleExtensions, extensionsState, resolvedPlatform);
|
|
2094
|
+
} else {
|
|
2095
|
+
const local = await invoke$3('ExtensionManagement.getAllExtensions');
|
|
2096
|
+
extensions = await getExtensionsWithState([...local, ...meta], extensionsState, resolvedPlatform);
|
|
2097
|
+
}
|
|
2098
|
+
if (fields === undefined) {
|
|
2099
|
+
return extensions;
|
|
2081
2100
|
}
|
|
2082
|
-
|
|
2083
|
-
return getExtensionsWithState([...local, ...meta], extensionsState, resolvedPlatform);
|
|
2101
|
+
return extensions.map(extension => Object.fromEntries(fields.filter(field => Object.hasOwn(extension, field)).map(field => [field, extension[field]])));
|
|
2084
2102
|
};
|
|
2085
2103
|
|
|
2086
2104
|
const getOrigin = () => {
|
|
@@ -2229,7 +2247,8 @@ const getExtensionAbsolutePath = (id, isWeb, isBuiltin, path, relativePath, orig
|
|
|
2229
2247
|
return path + '/' + relativePath;
|
|
2230
2248
|
}
|
|
2231
2249
|
if (isBuiltin) {
|
|
2232
|
-
|
|
2250
|
+
const folderName = path.split(/[/\\]/).findLast(Boolean) || id;
|
|
2251
|
+
return `${assetDir}/extensions/${folderName}/${relativePath}`;
|
|
2233
2252
|
}
|
|
2234
2253
|
return new URL('/remote' + path + '/' + relativePath, origin).href;
|
|
2235
2254
|
};
|
|
@@ -3129,8 +3148,8 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
|
|
|
3129
3148
|
}
|
|
3130
3149
|
};
|
|
3131
3150
|
|
|
3132
|
-
const getAllExtensions = async (assetDir, platform) => {
|
|
3133
|
-
return getAllExtensionsWithState(get$7(), assetDir, platform);
|
|
3151
|
+
const getAllExtensions = async (assetDir, platform, fields) => {
|
|
3152
|
+
return getAllExtensionsWithState(get$7(), assetDir, platform, fields);
|
|
3134
3153
|
};
|
|
3135
3154
|
|
|
3136
3155
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
@@ -5232,10 +5251,10 @@ const getDynamicWebExtensions = () => {
|
|
|
5232
5251
|
return get$7().webExtensions;
|
|
5233
5252
|
};
|
|
5234
5253
|
|
|
5235
|
-
const DisabledGlobally =
|
|
5236
|
-
const DisabledWorkspace =
|
|
5237
|
-
const EnabledGlobally =
|
|
5238
|
-
const EnabledWorkspace =
|
|
5254
|
+
const DisabledGlobally = 1;
|
|
5255
|
+
const DisabledWorkspace = 2;
|
|
5256
|
+
const EnabledGlobally = 3;
|
|
5257
|
+
const EnabledWorkspace = 4;
|
|
5239
5258
|
|
|
5240
5259
|
const getEnablementState = (id, disabled, workspaceDisabledIds, workspaceEnabledIds) => {
|
|
5241
5260
|
if (workspaceEnabledIds.includes(id)) {
|
|
@@ -6091,7 +6110,7 @@ const invokeForApplication = async (applicationId, method, ...args) => {
|
|
|
6091
6110
|
case 'Extensions.createWebViewWorkerRpc2':
|
|
6092
6111
|
return createWorker$1(application, args[0], args[1]);
|
|
6093
6112
|
case 'Extensions.getAllExtensions':
|
|
6094
|
-
return getAllExtensionsWithState(application, args[0] || '', args[1] ?? application.platform);
|
|
6113
|
+
return getAllExtensionsWithState(application, args[0] || '', args[1] ?? application.platform, args[2]);
|
|
6095
6114
|
case 'Extensions.getDynamicWebExtensions':
|
|
6096
6115
|
return application.webExtensions;
|
|
6097
6116
|
case 'Extensions.getRpcInfo':
|