@lvce-editor/extension-management-worker 4.88.0 → 4.88.2

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.
@@ -3427,7 +3427,7 @@ const deferInvalidateExtensionsCache = (extensionId, disabled) => {
3427
3427
  }, 0);
3428
3428
  };
3429
3429
 
3430
- const handleChange = async _id => {
3430
+ const handleChange$1 = async _id => {
3431
3431
  const statusBarVisible = await invoke$4('Layout.getStatusBarVisible');
3432
3432
  if (!statusBarVisible) {
3433
3433
  return;
@@ -3443,7 +3443,7 @@ const addExtension = async extension => {
3443
3443
  clearCachedExtensions();
3444
3444
  await invalidateExtensionsCache();
3445
3445
  if (hasStatusBarItems(extension)) {
3446
- await handleChange();
3446
+ await handleChange$1();
3447
3447
  }
3448
3448
  return extension;
3449
3449
  };
@@ -5924,6 +5924,31 @@ const getViews = async (assetDir, platform) => {
5924
5924
  return getViewsFromExtensions(extensions, resolvedAssetDir, resolvedPlatform);
5925
5925
  };
5926
5926
 
5927
+ const isWorkspaceProgressData = value => {
5928
+ if (!value || typeof value !== 'object') return false;
5929
+ const data = value;
5930
+ return typeof data.message === 'string' && ['idle', 'in-progress', 'finished', 'error'].includes(String(data.status));
5931
+ };
5932
+ const getWorkspaceProgressData = async applicationId => {
5933
+ const extensionIds = getIds(applicationId);
5934
+ for (const extensionId of extensionIds) {
5935
+ const rpc = get$2(extensionId, applicationId);
5936
+ if (!rpc) continue;
5937
+ try {
5938
+ const values = await rpc.invoke('ExtensionApi.getWorkspaceProgressData');
5939
+ if (!Array.isArray(values)) continue;
5940
+ const value = values.find(item => isWorkspaceProgressData(item) && item.status !== 'idle');
5941
+ if (value && isWorkspaceProgressData(value)) return value;
5942
+ } catch {
5943
+ // Extensions without a workspace progress provider are expected.
5944
+ }
5945
+ }
5946
+ return {
5947
+ message: '',
5948
+ status: 'idle'
5949
+ };
5950
+ };
5951
+
5927
5952
  const handleData = () => {};
5928
5953
 
5929
5954
  const invokeHandler = async (extensionId, changes, applicationId) => {
@@ -6215,6 +6240,18 @@ const getRemoteUrl = uri => {
6215
6240
  return `/remote/${normalized}`;
6216
6241
  };
6217
6242
 
6243
+ const builtinStaticPathRegex = /(?:^|\/)static\/([a-f\d]{7,40})\/extensions\/([^/]+)$/i;
6244
+ const getBuiltinTokenizerUrl = (extension, tokenizePath) => {
6245
+ if (typeof extension.id !== 'string' || !extension.id.startsWith('builtin.') || typeof extension.path !== 'string') {
6246
+ return '';
6247
+ }
6248
+ const match = extension.path.match(builtinStaticPathRegex);
6249
+ if (!match || match[2] !== extension.id) {
6250
+ return '';
6251
+ }
6252
+ const [, commitHash, extensionId] = match;
6253
+ return `/${commitHash}/extensions/${extensionId}/${tokenizePath}`;
6254
+ };
6218
6255
  const getLanguagesFromExtension = (extension, platform) => {
6219
6256
  // TODO what if extension is null? should not crash process, handle error gracefully
6220
6257
  // TODO what if extension languages is not of type array?
@@ -6237,7 +6274,8 @@ const getLanguagesFromExtension = (extension, platform) => {
6237
6274
  };
6238
6275
  }
6239
6276
  const relativePath = `${extensionPath}/${language.tokenize}`;
6240
- const absolutePath = platform === Web ? relativePath : getRemoteUrl(relativePath);
6277
+ const builtinTokenizerUrl = getBuiltinTokenizerUrl(extension, language.tokenize);
6278
+ const absolutePath = builtinTokenizerUrl || (platform === Web ? relativePath : getRemoteUrl(relativePath));
6241
6279
  return {
6242
6280
  ...language,
6243
6281
  extensionPath,
@@ -6362,6 +6400,16 @@ const readMicLevels = async options => {
6362
6400
  return await invoke$4('WebView.compatRendererProcessInvoke', 'WebRtc.readMicLevels', options);
6363
6401
  };
6364
6402
 
6403
+ const handleChange = async operationId => {
6404
+ if (!Number.isSafeInteger(operationId)) return;
6405
+ try {
6406
+ const data = await getWorkspaceProgressData();
6407
+ await invoke$4('Workspace.handleExtensionProgressChange', operationId, data);
6408
+ } catch {
6409
+ // Workspace progress is optional and the renderer may be closing.
6410
+ }
6411
+ };
6412
+
6365
6413
  /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
6366
6414
 
6367
6415
  const wrapCommand = command => {
@@ -6520,6 +6568,7 @@ const commandMap = {
6520
6568
  'Extensions.getViewInstanceState': getViewInstanceState,
6521
6569
  'Extensions.getViewMenuEntries': getViewMenuEntries,
6522
6570
  'Extensions.getViews': getViews,
6571
+ 'Extensions.getWorkspaceProgressData': wrapCommand(extensionsState => getWorkspaceProgressData(extensionsState.applicationId)),
6523
6572
  'Extensions.getWorkspaceTransportUri': getWorkspaceTransportUri,
6524
6573
  'Extensions.handleData': handleData,
6525
6574
  'Extensions.handleFileChanges': handleFileChanges,
@@ -6546,11 +6595,12 @@ const commandMap = {
6546
6595
  'Extensions.showViewContextMenu': showViewContextMenu,
6547
6596
  'Extensions.streamDiagnosticProvider': wrapCommand(streamDiagnosticProvider),
6548
6597
  'Extensions.uninstall': uninstallExtension,
6549
- 'StatusBar.handleChange': handleChange,
6598
+ 'StatusBar.handleChange': handleChange$1,
6550
6599
  'WebRtc.readMicLevels': readMicLevels,
6551
6600
  'WebRtc.setRemoteDescription': setRemoteDescription,
6552
6601
  'WebRtc.startWebRtcAudioStream': startWebRtcAudioStream,
6553
- 'WebRtc.stopWebRtcAudioStream': stopWebRtcAudioStream
6602
+ 'WebRtc.stopWebRtcAudioStream': stopWebRtcAudioStream,
6603
+ 'WorkspaceProgress.handleChange': handleChange
6554
6604
  };
6555
6605
 
6556
6606
  const initializeAuthWorker = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "4.88.0",
3
+ "version": "4.88.2",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"