@lvce-editor/extension-management-worker 4.75.2 → 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 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
- return getExtensionsWithState(compatibleExtensions, extensionsState, resolvedPlatform);
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
- const local = await invoke$3('ExtensionManagement.getAllExtensions');
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 = () => {
@@ -3130,8 +3148,8 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
3130
3148
  }
3131
3149
  };
3132
3150
 
3133
- const getAllExtensions = async (assetDir, platform) => {
3134
- return getAllExtensionsWithState(get$7(), assetDir, platform);
3151
+ const getAllExtensions = async (assetDir, platform, fields) => {
3152
+ return getAllExtensionsWithState(get$7(), assetDir, platform, fields);
3135
3153
  };
3136
3154
 
3137
3155
  /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
@@ -5233,10 +5251,10 @@ const getDynamicWebExtensions = () => {
5233
5251
  return get$7().webExtensions;
5234
5252
  };
5235
5253
 
5236
- const DisabledGlobally = 'disabledGlobally';
5237
- const DisabledWorkspace = 'disabledWorkspace';
5238
- const EnabledGlobally = 'enabledGlobally';
5239
- const EnabledWorkspace = 'enabledWorkspace';
5254
+ const DisabledGlobally = 1;
5255
+ const DisabledWorkspace = 2;
5256
+ const EnabledGlobally = 3;
5257
+ const EnabledWorkspace = 4;
5240
5258
 
5241
5259
  const getEnablementState = (id, disabled, workspaceDisabledIds, workspaceEnabledIds) => {
5242
5260
  if (workspaceEnabledIds.includes(id)) {
@@ -6092,7 +6110,7 @@ const invokeForApplication = async (applicationId, method, ...args) => {
6092
6110
  case 'Extensions.createWebViewWorkerRpc2':
6093
6111
  return createWorker$1(application, args[0], args[1]);
6094
6112
  case 'Extensions.getAllExtensions':
6095
- return getAllExtensionsWithState(application, args[0] || '', args[1] ?? application.platform);
6113
+ return getAllExtensionsWithState(application, args[0] || '', args[1] ?? application.platform, args[2]);
6096
6114
  case 'Extensions.getDynamicWebExtensions':
6097
6115
  return application.webExtensions;
6098
6116
  case 'Extensions.getRpcInfo':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "4.75.2",
3
+ "version": "4.76.0",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"