@lvce-editor/extension-host-worker 8.0.0 → 8.1.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.
@@ -112,7 +112,7 @@ const fn = value => {
112
112
  }
113
113
  };
114
114
 
115
- const state$c = {
115
+ const state$b = {
116
116
  /** @type{any[]} */
117
117
  onDidChangeTextDocumentListeners: [],
118
118
  /** @type{any[]} */
@@ -122,19 +122,19 @@ const state$c = {
122
122
  textDocuments: Object.create(null)
123
123
  };
124
124
  const setDocument = (textDocumentId, textDocument) => {
125
- state$c.textDocuments[textDocumentId] = textDocument;
125
+ state$b.textDocuments[textDocumentId] = textDocument;
126
126
  };
127
127
  const getDidOpenListeners = () => {
128
- return state$c.onDidSaveTextDocumentListeners;
128
+ return state$b.onDidSaveTextDocumentListeners;
129
129
  };
130
130
  const getWillChangeListeners = () => {
131
- return state$c.onWillChangeEditorListeners;
131
+ return state$b.onWillChangeEditorListeners;
132
132
  };
133
133
  const getDidChangeListeners = () => {
134
- return state$c.onDidChangeTextDocumentListeners;
134
+ return state$b.onDidChangeTextDocumentListeners;
135
135
  };
136
136
  const getDocument = textDocumentId => {
137
- return state$c.textDocuments[textDocumentId];
137
+ return state$b.textDocuments[textDocumentId];
138
138
  };
139
139
 
140
140
  const getOffset$1 = (textDocument, position) => {
@@ -684,7 +684,7 @@ const executeOrganizeImports = async uid => {
684
684
  return edits;
685
685
  };
686
686
 
687
- const state$b = {
687
+ const state$a = {
688
688
  commands: Object.create(null)
689
689
  };
690
690
  const getCommandDisplay = command => {
@@ -707,10 +707,10 @@ const registerCommand = command => {
707
707
  if (!command.execute) {
708
708
  throw new Error('command is missing execute function');
709
709
  }
710
- if (command.id in state$b.commands) {
710
+ if (command.id in state$a.commands) {
711
711
  throw new Error(`command cannot be registered multiple times`);
712
712
  }
713
- state$b.commands[command.id] = command;
713
+ state$a.commands[command.id] = command;
714
714
  } catch (error) {
715
715
  const commandDisplayId = getCommandDisplay(command);
716
716
  throw new VError(error, `Failed to register command${commandDisplayId}`);
@@ -718,7 +718,7 @@ const registerCommand = command => {
718
718
  };
719
719
  const executeCommand$1 = async (id, ...args) => {
720
720
  try {
721
- const command = state$b.commands[id];
721
+ const command = state$a.commands[id];
722
722
  if (!command) {
723
723
  throw new Error(`command ${id} not found`);
724
724
  }
@@ -767,14 +767,14 @@ const {
767
767
  }
768
768
  });
769
769
 
770
- const state$a = {
770
+ const state$9 = {
771
771
  configuration: Object.create(null)
772
772
  };
773
773
  const getConfiguration = key => {
774
- return state$a.configuration[key] ?? '';
774
+ return state$9.configuration[key] ?? '';
775
775
  };
776
776
  const setConfigurations = preferences => {
777
- state$a.configuration = preferences;
777
+ state$9.configuration = preferences;
778
778
  };
779
779
 
780
780
  const DebugWorker$1 = 55;
@@ -818,7 +818,7 @@ const create$9 = rpcId => {
818
818
 
819
819
  const {
820
820
  dispose,
821
- invoke: invoke$6,
821
+ invoke: invoke$7,
822
822
  invokeAndTransfer: invokeAndTransfer$5,
823
823
  set: set$b
824
824
  } = create$9(DebugWorker$1);
@@ -826,7 +826,7 @@ const {
826
826
  const DebugWorker = {
827
827
  __proto__: null,
828
828
  dispose,
829
- invoke: invoke$6,
829
+ invoke: invoke$7,
830
830
  invokeAndTransfer: invokeAndTransfer$5,
831
831
  set: set$b
832
832
  };
@@ -1715,7 +1715,7 @@ const send$1 = (transport, method, ...params) => {
1715
1715
  const message = create$4$2(method, params);
1716
1716
  transport.send(message);
1717
1717
  };
1718
- const invoke$5 = (ipc, method, ...params) => {
1718
+ const invoke$6 = (ipc, method, ...params) => {
1719
1719
  return invokeHelper(ipc, method, params, false);
1720
1720
  };
1721
1721
  const invokeAndTransfer$4 = (ipc, method, ...params) => {
@@ -1754,7 +1754,7 @@ const createRpc$1 = ipc => {
1754
1754
  send$1(ipc, method, ...params);
1755
1755
  },
1756
1756
  invoke(method, ...params) {
1757
- return invoke$5(ipc, method, ...params);
1757
+ return invoke$6(ipc, method, ...params);
1758
1758
  },
1759
1759
  invokeAndTransfer(method, ...params) {
1760
1760
  return invokeAndTransfer$4(ipc, method, ...params);
@@ -1912,6 +1912,9 @@ const WebWorkerRpcClient = {
1912
1912
  create: create$6
1913
1913
  };
1914
1914
 
1915
+ const {
1916
+ invoke: invoke$5} = create$9(ExtensionManagementWorker);
1917
+
1915
1918
  const {
1916
1919
  invoke: invoke$4,
1917
1920
  invokeAndTransfer: invokeAndTransfer$3} = create$9(RendererWorker$1);
@@ -1958,11 +1961,11 @@ const {
1958
1961
  invoke: invoke$3
1959
1962
  } = DebugWorker;
1960
1963
 
1961
- const state$9 = {
1964
+ const state$8 = {
1962
1965
  debugProviderMap: Object.create(null)
1963
1966
  };
1964
1967
  const getDebugProvider = id => {
1965
- const provider = state$9.debugProviderMap[id];
1968
+ const provider = state$8.debugProviderMap[id];
1966
1969
  if (!provider) {
1967
1970
  // @ts-ignore
1968
1971
  throw new VError(`no debug provider "${id}" found`);
@@ -1973,7 +1976,7 @@ const registerDebugProvider = debugProvider => {
1973
1976
  if (!debugProvider.id) {
1974
1977
  throw new Error('Failed to register debug system provider: missing id');
1975
1978
  }
1976
- state$9.debugProviderMap[debugProvider.id] = debugProvider;
1979
+ state$8.debugProviderMap[debugProvider.id] = debugProvider;
1977
1980
  };
1978
1981
  const handlePaused = async params => {
1979
1982
  // @ts-ignore
@@ -3011,10 +3014,6 @@ const getRemoteUrl$1 = async (uri, options = {}) => {
3011
3014
  throw new Error(`unsupported platform for remote url`);
3012
3015
  };
3013
3016
 
3014
- const state$8 = {
3015
- webExtensions: []
3016
- };
3017
-
3018
3017
  const getJson = async url => {
3019
3018
  try {
3020
3019
  const response = await fetch(url);
@@ -3051,7 +3050,7 @@ const getSharedProcessExtensions = () => {
3051
3050
  return invoke$2(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
3052
3051
  };
3053
3052
  const doGetExtensions = async () => {
3054
- const meta = state$8.webExtensions;
3053
+ const meta = await invoke$1('Extensions.getDynamicWebExtensions');
3055
3054
  if (platform === Web) {
3056
3055
  const webExtensions = await getWebExtensions();
3057
3056
  return [...webExtensions, ...meta];
@@ -3185,7 +3184,8 @@ const getEnabledProviderIds = async (scheme, root) => {
3185
3184
  };
3186
3185
  const getIconDefinitions = async providerId => {
3187
3186
  const extensions = await getExtensions();
3188
- const allExtensions = [...extensions, ...state$8.webExtensions];
3187
+ const webextensions = await invoke$5(`Extensions.getDynamicWebExtensions`);
3188
+ const allExtensions = [...extensions, ...webextensions];
3189
3189
  for (const extension of allExtensions) {
3190
3190
  const id = extension.id.split('.');
3191
3191
  const shortId = id[1];
@@ -4147,39 +4147,8 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
4147
4147
  // console.info('activated', path)
4148
4148
  };
4149
4149
 
4150
- const NewLine = '\n';
4151
- const Slash$1 = '/';
4152
-
4153
- const interExtensionId = path => {
4154
- const slashIndex = path.lastIndexOf(Slash$1);
4155
- return path.slice(slashIndex + 1);
4156
- };
4157
-
4158
- const getWebExtensionManifest = async (path, manifestPath) => {
4159
- try {
4160
- const manifest = await getJson(manifestPath);
4161
- return {
4162
- ...manifest,
4163
- path,
4164
- uri: path
4165
- };
4166
- } catch (error) {
4167
- const id = interExtensionId(path);
4168
- throw new VError(error, `Failed to load extension manifest for ${id}`);
4169
- }
4170
- };
4171
-
4172
- const getWebManifestPath = path => {
4173
- const manifestPath = `${path}/extension.json`;
4174
- return manifestPath;
4175
- };
4176
-
4177
4150
  const addWebExtension = async path => {
4178
- const manifestPath = getWebManifestPath(path);
4179
- const manifest = await getWebExtensionManifest(path, manifestPath);
4180
- // TODO avoid mutation if possible
4181
- state$8.webExtensions.push(manifest);
4182
- clear();
4151
+ const manifest = await invoke$1('Extensions.addWebExtension', path);
4183
4152
  return manifest;
4184
4153
  };
4185
4154
 
@@ -4197,6 +4166,8 @@ const addCssStyleSheet = (id, css) => {
4197
4166
  return invoke$2('Css.addCssStyleSheet', id, css);
4198
4167
  };
4199
4168
 
4169
+ const NewLine = '\n';
4170
+
4200
4171
  const warn = (...args) => {
4201
4172
  console.warn(...args);
4202
4173
  };
@@ -5402,63 +5373,12 @@ const getExtension = async id => {
5402
5373
  return undefined;
5403
5374
  };
5404
5375
 
5405
- const findMatchingIconThemeExtension = (extensions, iconThemeId) => {
5406
- for (const extension of extensions) {
5407
- if (extension && extension.iconThemes) {
5408
- for (const iconTheme of extension.iconThemes) {
5409
- if (iconTheme.id === iconThemeId) {
5410
- return {
5411
- ...iconTheme,
5412
- extensionPath: extension.path
5413
- };
5414
- }
5415
- }
5416
- }
5417
- }
5418
- return undefined;
5419
- };
5420
-
5421
- const getIconThemeUrl = iconThemeId => {
5422
- return `${assetDir}/extensions/builtin.${iconThemeId}/icon-theme.json`;
5423
- };
5424
-
5425
5376
  const getIconThemeJson$1 = async iconThemeId => {
5426
- if (platform === Web) {
5427
- const url = getIconThemeUrl(iconThemeId);
5428
- const json = await getJson(url);
5429
- return {
5430
- extensionPath: `${assetDir}/extensions/builtin.${iconThemeId}`,
5431
- json
5432
- };
5433
- }
5434
- for (const webExtension of state$8.webExtensions) {
5435
- if (webExtension.iconThemes) {
5436
- for (const iconTheme of webExtension.iconThemes) {
5437
- // TODO handle error when icon theme path is not of type string
5438
- const iconThemeUrl = `${webExtension.path}/${iconTheme.path}`;
5439
- const json = await getJson(iconThemeUrl);
5440
- return {
5441
- extensionPath: webExtension.path,
5442
- json
5443
- };
5444
- }
5445
- }
5446
- }
5447
- const extensions = await getExtensions();
5448
- const iconTheme = findMatchingIconThemeExtension(extensions, iconThemeId);
5449
- if (!iconTheme) {
5450
- return undefined;
5451
- }
5452
- const iconThemePath = `${iconTheme.extensionPath}/${iconTheme.path}`;
5453
- const iconThemeJson = await readJson(iconThemePath);
5454
- return {
5455
- extensionPath: iconTheme.extensionPath,
5456
- json: iconThemeJson
5457
- };
5377
+ throw new Error(`getIconThemeJson is deprecated. Use icon-theme-worker instead`);
5458
5378
  };
5459
5379
 
5460
5380
  const getIconThemeJson = async iconThemeId => {
5461
- return getIconThemeJson$1(iconThemeId);
5381
+ return getIconThemeJson$1();
5462
5382
  };
5463
5383
 
5464
5384
  const getRpcInfo = async rpcId => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"