@lvce-editor/extension-host-worker 8.10.0 → 8.12.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.
@@ -3325,12 +3325,37 @@ const executeCommand = async name => {
3325
3325
  await executeCommand$1(name);
3326
3326
  };
3327
3327
  const providers = Object.create(null);
3328
+ const getStatusBarItemProviderDisplay = provider => {
3329
+ if (provider && provider.id && typeof provider.id === 'string') {
3330
+ return ` ${provider.id}`;
3331
+ }
3332
+ return '';
3333
+ };
3334
+ const notifyChange = async id => {
3335
+ await invoke$1('StatusBar.handleChange', id);
3336
+ };
3328
3337
  const executeStatusBarItemProvider = id => {
3329
3338
  const provider = providers[id];
3330
3339
  return provider.getStatusBarItem();
3331
3340
  };
3332
3341
  const registerStatuBarItemProvider = provider => {
3333
- providers[provider.id] = provider;
3342
+ try {
3343
+ if (!provider.id) {
3344
+ throw new Error('status bar item provider is missing id');
3345
+ }
3346
+ if (provider.id in providers) {
3347
+ throw new Error('status bar item provider cannot be registered multiple times');
3348
+ }
3349
+ providers[provider.id] = provider;
3350
+ return {
3351
+ refresh() {
3352
+ return notifyChange(provider.id);
3353
+ }
3354
+ };
3355
+ } catch (error) {
3356
+ const providerDisplay = getStatusBarItemProviderDisplay(provider);
3357
+ throw new VError(error, `Failed to register status bar item provider${providerDisplay}`);
3358
+ }
3334
3359
  };
3335
3360
 
3336
3361
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "8.10.0",
3
+ "version": "8.12.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"