@theia/plugin-ext 1.75.0-next.3 → 1.75.0-next.34

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.
Files changed (191) hide show
  1. package/lib/common/errors.d.ts +1 -14
  2. package/lib/common/errors.d.ts.map +1 -1
  3. package/lib/common/errors.js +3 -16
  4. package/lib/common/errors.js.map +1 -1
  5. package/lib/common/plugin-api-rpc.d.ts +1 -1
  6. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  7. package/lib/common/plugin-protocol.d.ts +53 -648
  8. package/lib/common/plugin-protocol.d.ts.map +1 -1
  9. package/lib/common/plugin-protocol.js +11 -34
  10. package/lib/common/plugin-protocol.js.map +1 -1
  11. package/lib/hosted/browser/hosted-plugin.d.ts +2 -1
  12. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  13. package/lib/hosted/browser/hosted-plugin.js +8 -3
  14. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  15. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  16. package/lib/hosted/browser/worker/plugin-manifest-loader.js +5 -36
  17. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  18. package/lib/hosted/browser/worker/worker-main.js +2 -1
  19. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  20. package/lib/hosted/common/hosted-plugin.js +10 -9
  21. package/lib/hosted/common/hosted-plugin.js.map +1 -1
  22. package/lib/hosted/common/hosted-plugin.spec.js +2 -0
  23. package/lib/hosted/common/hosted-plugin.spec.js.map +1 -1
  24. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  25. package/lib/hosted/node/hosted-plugin-localization-service.js +4 -68
  26. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-process.js +1 -0
  28. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  29. package/lib/hosted/node/hosted-plugin.js +1 -0
  30. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  31. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  32. package/lib/hosted/node/plugin-host-rpc.js +2 -2
  33. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  34. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  35. package/lib/hosted/node/plugin-reader.js +6 -4
  36. package/lib/hosted/node/plugin-reader.js.map +1 -1
  37. package/lib/hosted/node/plugin-service.js +1 -0
  38. package/lib/hosted/node/plugin-service.js.map +1 -1
  39. package/lib/hosted/node/scanners/grammars-reader.d.ts +3 -2
  40. package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
  41. package/lib/hosted/node/scanners/grammars-reader.js +5 -23
  42. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  43. package/lib/hosted/node/scanners/scanner-theia.d.ts +38 -71
  44. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  45. package/lib/hosted/node/scanners/scanner-theia.js +117 -768
  46. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  47. package/lib/hosted/node/scanners/scanner-theia.spec.js +191 -0
  48. package/lib/hosted/node/scanners/scanner-theia.spec.js.map +1 -1
  49. package/lib/main/browser/comments/comments-service.d.ts +2 -0
  50. package/lib/main/browser/comments/comments-service.d.ts.map +1 -1
  51. package/lib/main/browser/comments/comments-service.js +7 -1
  52. package/lib/main/browser/comments/comments-service.js.map +1 -1
  53. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +2 -1
  54. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
  55. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +6 -1
  56. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  57. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.d.ts +2 -0
  58. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.d.ts.map +1 -1
  59. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js +7 -1
  60. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js.map +1 -1
  61. package/lib/main/browser/menus/menus-contribution-handler.d.ts +2 -1
  62. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  63. package/lib/main/browser/menus/menus-contribution-handler.js +9 -4
  64. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  65. package/lib/main/browser/plugin-contribution-handler.js +1 -1
  66. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  67. package/lib/main/browser/plugin-icon-service.d.ts.map +1 -1
  68. package/lib/main/browser/plugin-icon-service.js +2 -1
  69. package/lib/main/browser/plugin-icon-service.js.map +1 -1
  70. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  71. package/lib/main/browser/plugin-icon-theme-service.js +2 -1
  72. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  73. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  74. package/lib/main/browser/plugin-shared-style.js +2 -1
  75. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  76. package/lib/main/browser/scm-main.d.ts.map +1 -1
  77. package/lib/main/browser/scm-main.js +3 -1
  78. package/lib/main/browser/scm-main.js.map +1 -1
  79. package/lib/main/browser/text-editor-model-service.d.ts +2 -1
  80. package/lib/main/browser/text-editor-model-service.d.ts.map +1 -1
  81. package/lib/main/browser/text-editor-model-service.js +6 -1
  82. package/lib/main/browser/text-editor-model-service.js.map +1 -1
  83. package/lib/main/browser/view/plugin-view-registry.d.ts +2 -0
  84. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  85. package/lib/main/browser/view/plugin-view-registry.js +14 -9
  86. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  87. package/lib/main/browser/view/tree-view-widget.d.ts +3 -0
  88. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  89. package/lib/main/browser/view/tree-view-widget.js +17 -6
  90. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  91. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  92. package/lib/main/browser/webview/webview.js +4 -2
  93. package/lib/main/browser/webview/webview.js.map +1 -1
  94. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  95. package/lib/main/browser/webview-views/webview-views-main.js +3 -2
  96. package/lib/main/browser/webview-views/webview-views-main.js.map +1 -1
  97. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +2 -1
  98. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  99. package/lib/main/node/handlers/plugin-theia-directory-handler.js +10 -4
  100. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  101. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +2 -0
  102. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  103. package/lib/main/node/handlers/plugin-theia-file-handler.js +9 -3
  104. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  105. package/lib/main/node/paths/plugin-paths-service.js +1 -0
  106. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  107. package/lib/main/node/plugin-deployer-contribution.js +1 -0
  108. package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
  109. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  110. package/lib/main/node/plugin-deployer-impl.js +16 -13
  111. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  112. package/lib/main/node/plugin-service.d.ts +2 -0
  113. package/lib/main/node/plugin-service.d.ts.map +1 -1
  114. package/lib/main/node/plugin-service.js +7 -1
  115. package/lib/main/node/plugin-service.js.map +1 -1
  116. package/lib/main/node/plugin-uninstallation-manager.d.ts +2 -1
  117. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -1
  118. package/lib/main/node/plugin-uninstallation-manager.js +6 -1
  119. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -1
  120. package/lib/main/node/plugins-key-value-storage.d.ts +2 -0
  121. package/lib/main/node/plugins-key-value-storage.d.ts.map +1 -1
  122. package/lib/main/node/plugins-key-value-storage.js +9 -3
  123. package/lib/main/node/plugins-key-value-storage.js.map +1 -1
  124. package/lib/main/node/resolvers/local-plugin-deployer-resolver.d.ts +2 -0
  125. package/lib/main/node/resolvers/local-plugin-deployer-resolver.d.ts.map +1 -1
  126. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js +7 -1
  127. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js.map +1 -1
  128. package/lib/main/node/webview-backend-security-warnings.d.ts +2 -0
  129. package/lib/main/node/webview-backend-security-warnings.d.ts.map +1 -1
  130. package/lib/main/node/webview-backend-security-warnings.js +7 -1
  131. package/lib/main/node/webview-backend-security-warnings.js.map +1 -1
  132. package/lib/plugin/scm.js +1 -1
  133. package/lib/plugin/scm.js.map +1 -1
  134. package/package.json +31 -30
  135. package/src/common/errors.ts +1 -25
  136. package/src/common/plugin-api-rpc.ts +1 -1
  137. package/src/common/plugin-protocol.ts +203 -662
  138. package/src/hosted/browser/hosted-plugin.ts +8 -5
  139. package/src/hosted/browser/worker/plugin-manifest-loader.ts +8 -41
  140. package/src/hosted/browser/worker/worker-main.ts +2 -1
  141. package/src/hosted/common/hosted-plugin.spec.ts +2 -0
  142. package/src/hosted/common/hosted-plugin.ts +10 -10
  143. package/src/hosted/node/hosted-plugin-localization-service.ts +3 -82
  144. package/src/hosted/node/hosted-plugin-process.ts +1 -1
  145. package/src/hosted/node/hosted-plugin.ts +2 -2
  146. package/src/hosted/node/plugin-host-rpc.ts +3 -3
  147. package/src/hosted/node/plugin-reader.ts +7 -6
  148. package/src/hosted/node/plugin-service.ts +1 -1
  149. package/src/hosted/node/scanners/grammars-reader.ts +14 -23
  150. package/src/hosted/node/scanners/scanner-theia.spec.ts +225 -1
  151. package/src/hosted/node/scanners/scanner-theia.ts +204 -881
  152. package/src/main/browser/comments/comments-service.ts +6 -2
  153. package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +6 -3
  154. package/src/main/browser/debug/plugin-debug-session-contribution-registry.ts +5 -1
  155. package/src/main/browser/menus/menus-contribution-handler.ts +9 -6
  156. package/src/main/browser/plugin-contribution-handler.ts +1 -1
  157. package/src/main/browser/plugin-icon-service.ts +2 -1
  158. package/src/main/browser/plugin-icon-theme-service.ts +2 -1
  159. package/src/main/browser/plugin-shared-style.ts +2 -1
  160. package/src/main/browser/scm-main.ts +3 -1
  161. package/src/main/browser/text-editor-model-service.ts +6 -3
  162. package/src/main/browser/view/plugin-view-registry.ts +14 -11
  163. package/src/main/browser/view/tree-view-widget.tsx +14 -7
  164. package/src/main/browser/webview/webview.ts +4 -2
  165. package/src/main/browser/webview-views/webview-views-main.ts +4 -4
  166. package/src/main/node/handlers/plugin-theia-directory-handler.ts +9 -6
  167. package/src/main/node/handlers/plugin-theia-file-handler.ts +8 -5
  168. package/src/main/node/paths/plugin-paths-service.ts +2 -2
  169. package/src/main/node/plugin-deployer-contribution.ts +2 -2
  170. package/src/main/node/plugin-deployer-impl.ts +20 -14
  171. package/src/main/node/plugin-service.ts +6 -2
  172. package/src/main/node/plugin-uninstallation-manager.ts +7 -4
  173. package/src/main/node/plugins-key-value-storage.ts +8 -4
  174. package/src/main/node/resolvers/local-plugin-deployer-resolver.ts +7 -2
  175. package/src/main/node/webview-backend-security-warnings.ts +6 -2
  176. package/src/plugin/scm.ts +1 -1
  177. package/lib/hosted/node/plugin-activation-events.d.ts +0 -7
  178. package/lib/hosted/node/plugin-activation-events.d.ts.map +0 -1
  179. package/lib/hosted/node/plugin-activation-events.js +0 -95
  180. package/lib/hosted/node/plugin-activation-events.js.map +0 -1
  181. package/lib/hosted/node/plugin-manifest-loader.d.ts +0 -3
  182. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +0 -1
  183. package/lib/hosted/node/plugin-manifest-loader.js +0 -34
  184. package/lib/hosted/node/plugin-manifest-loader.js.map +0 -1
  185. package/lib/main/node/errors.spec.d.ts +0 -2
  186. package/lib/main/node/errors.spec.d.ts.map +0 -1
  187. package/lib/main/node/errors.spec.js +0 -36
  188. package/lib/main/node/errors.spec.js.map +0 -1
  189. package/src/hosted/node/plugin-activation-events.ts +0 -112
  190. package/src/hosted/node/plugin-manifest-loader.ts +0 -32
  191. package/src/main/node/errors.spec.ts +0 -37
@@ -293,30 +293,36 @@ export class PluginDeployerImpl implements PluginDeployer {
293
293
  * deploy all plugins that have been accepted
294
294
  */
295
295
  async deployPlugins(pluginsToDeploy: PluginDeployerEntry[]): Promise<number> {
296
- const acceptedPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted());
296
+ const acceptedPlugins = pluginsToDeploy.filter(pluginDeployerEntry =>
297
+ pluginDeployerEntry.isAccepted(PluginDeployerEntryType.FRONTEND, PluginDeployerEntryType.BACKEND, PluginDeployerEntryType.HEADLESS));
297
298
  const acceptedFrontendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.FRONTEND));
298
299
  const acceptedBackendPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.BACKEND));
299
300
  const acceptedHeadlessPlugins = pluginsToDeploy.filter(pluginDeployerEntry => pluginDeployerEntry.isAccepted(PluginDeployerEntryType.HEADLESS));
300
301
 
301
- this.logger.debug('the accepted plugins are', acceptedPlugins);
302
- this.logger.debug('the acceptedFrontendPlugins plugins are', acceptedFrontendPlugins);
303
- this.logger.debug('the acceptedBackendPlugins plugins are', acceptedBackendPlugins);
304
- this.logger.debug('the acceptedHeadlessPlugins plugins are', acceptedHeadlessPlugins);
305
-
306
- acceptedPlugins.forEach(plugin => {
307
- this.logger.debug('will deploy plugin', plugin.id(), 'with changes', JSON.stringify(plugin.getChanges()), 'and this plugin has been resolved by', plugin.resolvedBy());
302
+ this.logger.debug(log => {
303
+ log('the accepted plugins are', acceptedPlugins);
304
+ log('the acceptedFrontendPlugins plugins are', acceptedFrontendPlugins);
305
+ log('the acceptedBackendPlugins plugins are', acceptedBackendPlugins);
306
+ log('the acceptedHeadlessPlugins plugins are', acceptedHeadlessPlugins);
307
+ acceptedPlugins.forEach(plugin => {
308
+ log(
309
+ 'will deploy plugin', plugin.id(), 'with changes', JSON.stringify(plugin.getChanges()),
310
+ 'and this plugin has been resolved by', plugin.resolvedBy()
311
+ );
312
+ });
308
313
  });
309
314
 
310
315
  // local path to launch
311
316
  const pluginPaths = [...acceptedBackendPlugins, ...acceptedHeadlessPlugins].map(pluginEntry => pluginEntry.path());
312
317
  this.logger.debug('local path to deploy on remote instance', pluginPaths);
313
318
 
314
- const deployments = [];
315
- // start the backend plugins
316
- deployments.push(await this.pluginDeployerHandler.deployBackendPlugins(acceptedBackendPlugins));
317
- // headless plugins are deployed like backend plugins
318
- deployments.push(await this.pluginDeployerHandler.deployBackendPlugins(acceptedHeadlessPlugins));
319
- deployments.push(await this.pluginDeployerHandler.deployFrontendPlugins(acceptedFrontendPlugins));
319
+ const deployPluginsMeasurement = this.measure('deployPluginsBatch');
320
+ const deployments = await Promise.all([
321
+ // start the backend and headless plugins
322
+ this.pluginDeployerHandler.deployBackendPlugins([...acceptedBackendPlugins, ...acceptedHeadlessPlugins]),
323
+ this.pluginDeployerHandler.deployFrontendPlugins(acceptedFrontendPlugins)
324
+ ]);
325
+ deployPluginsMeasurement.log(`Deploy batch of ${acceptedPlugins.length} accepted plugins`);
320
326
  this.onDidDeployEmitter.fire(undefined);
321
327
  return deployments.reduce<number>((accumulated, current) => accumulated += current ?? 0, 0);
322
328
  }
@@ -19,13 +19,14 @@ import * as path from 'path';
19
19
  const vhost = require('vhost');
20
20
  import * as express from '@theia/core/shared/express';
21
21
  import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
22
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
22
+ import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
23
23
  import { WebviewExternalEndpoint } from '../common/webview-protocol';
24
24
  import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
25
25
  import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
26
26
  import { MaybePromise } from '@theia/core/lib/common';
27
27
  import { ApplicationPackage } from '@theia/core/shared/@theia/application-package';
28
28
  import { BackendRemoteService } from '@theia/core/lib/node/remote/backend-remote-service';
29
+ import { ILogger } from '@theia/core';
29
30
 
30
31
  @injectable()
31
32
  export class PluginApiContribution implements BackendApplicationContribution, WsRequestValidatorContribution {
@@ -40,10 +41,13 @@ export class PluginApiContribution implements BackendApplicationContribution, Ws
40
41
  @inject(BackendRemoteService)
41
42
  protected readonly remoteService: BackendRemoteService;
42
43
 
44
+ @inject(ILogger) @named('plugin-ext:PluginApiContribution')
45
+ protected readonly logger: ILogger;
46
+
43
47
  @postConstruct()
44
48
  protected init(): void {
45
49
  const webviewExternalEndpoint = this.webviewExternalEndpoint();
46
- console.log(`Configuring to accept webviews on '${webviewExternalEndpoint}' hostname.`);
50
+ this.logger.info(`Configuring to accept webviews on '${webviewExternalEndpoint}' hostname.`);
47
51
  this.webviewExternalEndpointRegExp = new RegExp(webviewExternalEndpoint, 'i');
48
52
  }
49
53
 
@@ -14,8 +14,8 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { Emitter, Event } from '@theia/core';
18
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
17
+ import { Emitter, Event, ILogger } from '@theia/core';
18
+ import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
19
19
  import { PluginIdentifiers } from '../../common';
20
20
  import { SettingService } from '@theia/core/lib/node';
21
21
  import { Deferred } from '@theia/core/lib/common/promise-util';
@@ -27,6 +27,9 @@ export class PluginUninstallationManager {
27
27
  @inject(SettingService)
28
28
  protected readonly settingService: SettingService;
29
29
 
30
+ @inject(ILogger) @named('plugin-ext:PluginUninstallationManager')
31
+ protected readonly logger: ILogger;
32
+
30
33
  protected readonly onDidChangeUninstalledPluginsEmitter = new Emitter<readonly PluginIdentifiers.VersionedId[]>();
31
34
  onDidChangeUninstalledPlugins: Event<readonly PluginIdentifiers.VersionedId[]> = this.onDidChangeUninstalledPluginsEmitter.event;
32
35
 
@@ -46,12 +49,12 @@ export class PluginUninstallationManager {
46
49
  protected async load(): Promise<void> {
47
50
  try {
48
51
  const disabled: (PluginIdentifiers.VersionedId | PluginIdentifiers.UnversionedId)[] =
49
- JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
52
+ JSON.parse(await this.settingService.get(PluginUninstallationManager.DISABLED_PLUGINS) || '[]');
50
53
 
51
54
  disabled.forEach(id => this.disabledPlugins.add(PluginIdentifiers.toUnversioned(id)));
52
55
  } catch (e) {
53
56
  // settings may be corrupt; just carry on
54
- console.warn(e);
57
+ this.logger.warn(e);
55
58
  }
56
59
  }
57
60
 
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
18
18
  import { FileSystemLocking } from '@theia/core/lib/node';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
20
  import * as path from 'path';
@@ -25,6 +25,7 @@ import { PluginPaths } from './paths/const';
25
25
  import { PluginPathsService } from '../common/plugin-paths-protocol';
26
26
  import { KeysToAnyValues, KeysToKeysToAnyValue } from '../../common/types';
27
27
  import { PluginStorageKind } from '../../common';
28
+ import { ILogger } from '@theia/core';
28
29
 
29
30
  export interface Store {
30
31
  fsPath: string
@@ -49,10 +50,13 @@ export class PluginsKeyValueStorage {
49
50
  @inject(FileSystemLocking)
50
51
  private fsLocking: FileSystemLocking;
51
52
 
53
+ @inject(ILogger) @named('plugin-ext:PluginsKeyValueStorage')
54
+ protected readonly logger: ILogger;
55
+
52
56
  @postConstruct()
53
57
  protected init(): void {
54
58
  this.deferredGlobalDataPath.resolve(this.getGlobalDataPath().catch(error => {
55
- console.error('Failed to initialize global state path:', error);
59
+ this.logger.error('Failed to initialize global state path:', error);
56
60
  return undefined;
57
61
  }));
58
62
  process.once('beforeExit', () => this.dispose());
@@ -62,7 +66,7 @@ export class PluginsKeyValueStorage {
62
66
  async set(key: string, value: KeysToAnyValues, kind: PluginStorageKind): Promise<boolean> {
63
67
  const store = await this.getStore(kind);
64
68
  if (!store) {
65
- console.warn('Cannot save data: no opened workspace');
69
+ this.logger.warn('Cannot save data: no opened workspace');
66
70
  return false;
67
71
  }
68
72
  if (value === undefined || Object.keys(value).length === 0) {
@@ -144,7 +148,7 @@ export class PluginsKeyValueStorage {
144
148
  try {
145
149
  return await fs.readJSON(pathToFile);
146
150
  } catch (error) {
147
- console.error('Failed to parse data from "', pathToFile, '". Reason:', error);
151
+ this.logger.error('Failed to parse data from "', pathToFile, '". Reason:', error);
148
152
  return {};
149
153
  }
150
154
  }
@@ -14,15 +14,20 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable } from '@theia/core/shared/inversify';
17
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
18
18
  import { PluginDeployerResolver, PluginDeployerResolverContext } from '../../../common/plugin-protocol';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
20
  import * as path from 'path';
21
21
  import { FileUri } from '@theia/core/lib/node';
22
22
  import URI from '@theia/core/lib/common/uri';
23
+ import { ILogger } from '@theia/core';
23
24
 
24
25
  @injectable()
25
26
  export abstract class LocalPluginDeployerResolver implements PluginDeployerResolver {
27
+
28
+ @inject(ILogger) @named('plugin-ext:LocalPluginDeployerResolver')
29
+ protected readonly logger: ILogger;
30
+
26
31
  async resolve(pluginResolverContext: PluginDeployerResolverContext): Promise<void> {
27
32
  const localPath = await this.resolveLocalPluginPath(pluginResolverContext, this.supportedScheme);
28
33
  if (localPath) {
@@ -48,7 +53,7 @@ export abstract class LocalPluginDeployerResolver implements PluginDeployerResol
48
53
  fsPath = path.resolve(process.cwd(), fsPath);
49
54
  }
50
55
  if (!await fs.pathExists(fsPath)) {
51
- console.warn(`The local plugin referenced by ${pluginResolverContext.getOriginId()} does not exist.`);
56
+ this.logger.warn(`The local plugin referenced by ${pluginResolverContext.getOriginId()} does not exist.`);
52
57
  return null;
53
58
  }
54
59
  return fsPath;
@@ -16,12 +16,16 @@
16
16
 
17
17
  import { BackendApplicationContribution } from '@theia/core/lib/node';
18
18
  import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
19
- import { injectable } from '@theia/core/shared/inversify';
19
+ import { injectable, inject, named } from '@theia/core/shared/inversify';
20
20
  import { WebviewExternalEndpoint } from '../common/webview-protocol';
21
+ import { ILogger } from '@theia/core';
21
22
 
22
23
  @injectable()
23
24
  export class WebviewBackendSecurityWarnings implements BackendApplicationContribution {
24
25
 
26
+ @inject(ILogger) @named('plugin-ext:WebviewBackendSecurityWarnings')
27
+ protected readonly logger: ILogger;
28
+
25
29
  initialize(): void {
26
30
  this.checkHostPattern();
27
31
  }
@@ -32,7 +36,7 @@ export class WebviewBackendSecurityWarnings implements BackendApplicationContrib
32
36
  }
33
37
  const envHostPattern = process.env[WebviewExternalEndpoint.pattern];
34
38
  if (envHostPattern && envHostPattern !== WebviewExternalEndpoint.defaultPattern) {
35
- console.warn(`\
39
+ this.logger.warn(`\
36
40
  WEBVIEW SECURITY WARNING
37
41
 
38
42
  Changing the @theia/plugin-ext webview host pattern can lead to security vulnerabilities.
package/src/plugin/scm.ts CHANGED
@@ -566,7 +566,7 @@ function historyItemToDto(item: theia.SourceControlHistoryItem): ScmHistoryItemD
566
566
  authorIcon: item.authorIcon,
567
567
  displayId: item.displayId,
568
568
  timestamp: item.timestamp,
569
- tooltip: item.tooltip,
569
+ tooltip: Array.isArray(item.tooltip) ? [...item.tooltip] : item.tooltip,
570
570
  statistics: item.statistics ? {
571
571
  files: item.statistics.files,
572
572
  insertions: item.statistics.insertions,
@@ -1,7 +0,0 @@
1
- import { PluginPackage } from '../../common/plugin-protocol';
2
- /**
3
- * Most activation events can be automatically deduced from the package manifest.
4
- * This function will update the manifest based on the plugin contributions.
5
- */
6
- export declare function updateActivationEvents(manifest: PluginPackage): void;
7
- //# sourceMappingURL=plugin-activation-events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-activation-events.d.ts","sourceRoot":"","sources":["../../../src/hosted/node/plugin-activation-events.ts"],"names":[],"mappings":"AAkBA,OAAO,EACH,aAAa,EAQhB,MAAM,8BAA8B,CAAC;AAEtC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CA8BpE"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2023 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.updateActivationEvents = updateActivationEvents;
19
- const arrays_1 = require("../../common/arrays");
20
- const types_1 = require("@theia/core/lib/common/types");
21
- /**
22
- * Most activation events can be automatically deduced from the package manifest.
23
- * This function will update the manifest based on the plugin contributions.
24
- */
25
- function updateActivationEvents(manifest) {
26
- if (!(0, types_1.isObject)(manifest) || !(0, types_1.isObject)(manifest.contributes) || !manifest.contributes) {
27
- return;
28
- }
29
- const activationEvents = new Set((0, types_1.isStringArray)(manifest.activationEvents) ? manifest.activationEvents : []);
30
- if (manifest.contributes.commands) {
31
- const value = manifest.contributes.commands;
32
- const commands = Array.isArray(value) ? value : [value];
33
- updateCommandsContributions(commands, activationEvents);
34
- }
35
- if ((0, types_1.isObject)(manifest.contributes.views)) {
36
- const views = (0, arrays_1.flatten)(Object.values(manifest.contributes.views));
37
- updateViewsContribution(views, activationEvents);
38
- }
39
- if (Array.isArray(manifest.contributes.customEditors)) {
40
- updateCustomEditorsContribution(manifest.contributes.customEditors, activationEvents);
41
- }
42
- if (Array.isArray(manifest.contributes.authentication)) {
43
- updateAuthenticationProviderContributions(manifest.contributes.authentication, activationEvents);
44
- }
45
- if (Array.isArray(manifest.contributes.languages)) {
46
- updateLanguageContributions(manifest.contributes.languages, activationEvents);
47
- }
48
- if (Array.isArray(manifest.contributes.notebooks)) {
49
- updateNotebookContributions(manifest.contributes.notebooks, activationEvents);
50
- }
51
- manifest.activationEvents = Array.from(activationEvents);
52
- }
53
- function updateViewsContribution(views, activationEvents) {
54
- for (const view of views) {
55
- if ((0, types_1.isObject)(view) && typeof view.id === 'string') {
56
- activationEvents.add(`onView:${view.id}`);
57
- }
58
- }
59
- }
60
- function updateCustomEditorsContribution(customEditors, activationEvents) {
61
- for (const customEditor of customEditors) {
62
- if ((0, types_1.isObject)(customEditor) && typeof customEditor.viewType === 'string') {
63
- activationEvents.add(`onCustomEditor:${customEditor.viewType}`);
64
- }
65
- }
66
- }
67
- function updateCommandsContributions(commands, activationEvents) {
68
- for (const command of commands) {
69
- if ((0, types_1.isObject)(command) && typeof command.command === 'string') {
70
- activationEvents.add(`onCommand:${command.command}`);
71
- }
72
- }
73
- }
74
- function updateAuthenticationProviderContributions(authProviders, activationEvents) {
75
- for (const authProvider of authProviders) {
76
- if ((0, types_1.isObject)(authProvider) && typeof authProvider.id === 'string') {
77
- activationEvents.add(`onAuthenticationRequest:${authProvider.id}`);
78
- }
79
- }
80
- }
81
- function updateLanguageContributions(languages, activationEvents) {
82
- for (const language of languages) {
83
- if ((0, types_1.isObject)(language) && typeof language.id === 'string') {
84
- activationEvents.add(`onLanguage:${language.id}`);
85
- }
86
- }
87
- }
88
- function updateNotebookContributions(notebooks, activationEvents) {
89
- for (const notebook of notebooks) {
90
- if ((0, types_1.isObject)(notebook) && typeof notebook.type === 'string') {
91
- activationEvents.add(`onNotebookSerializer:${notebook.type}`);
92
- }
93
- }
94
- }
95
- //# sourceMappingURL=plugin-activation-events.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-activation-events.js","sourceRoot":"","sources":["../../../src/hosted/node/plugin-activation-events.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAmBhF,wDA8BC;AA/CD,gDAA8C;AAC9C,wDAAuE;AAYvE;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,QAAuB;IAC1D,IAAI,CAAC,IAAA,gBAAQ,EAAgB,QAAQ,CAAC,IAAI,CAAC,IAAA,gBAAQ,EAA4B,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC5H,OAAO;IACX,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,IAAA,qBAAa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAE5G,IAAI,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC;QAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxD,2BAA2B,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,IAAA,gBAAQ,EAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QACjE,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;QACpD,+BAA+B,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAC1F,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;QACrD,yCAAyC,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;IACrG,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QAChD,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAClF,CAAC;IAED,QAAQ,CAAC,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,uBAAuB,CAAC,KAA0B,EAAE,gBAA6B;IACtF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAA,gBAAQ,EAAoB,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YACnE,gBAAgB,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,+BAA+B,CAAC,aAA0C,EAAE,gBAA6B;IAC9G,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACvC,IAAI,IAAA,gBAAQ,EAA4B,YAAY,CAAC,IAAI,OAAO,YAAY,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjG,gBAAgB,CAAC,GAAG,CAAC,kBAAkB,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpE,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,2BAA2B,CAAC,QAAgC,EAAE,gBAA6B;IAChG,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,IAAA,gBAAQ,EAAuB,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACjF,gBAAgB,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,yCAAyC,CAAC,aAAoD,EAAE,gBAA6B;IAClI,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;QACvC,IAAI,IAAA,gBAAQ,EAAsC,YAAY,CAAC,IAAI,OAAO,YAAY,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YACrG,gBAAgB,CAAC,GAAG,CAAC,2BAA2B,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;QACvE,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,2BAA2B,CAAC,SAA8C,EAAE,gBAA6B;IAC9G,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,IAAA,gBAAQ,EAAoC,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC3F,gBAAgB,CAAC,GAAG,CAAC,cAAc,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,2BAA2B,CAAC,SAAkC,EAAE,gBAA6B;IAClG,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,IAAA,gBAAQ,EAAwB,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACjF,gBAAgB,CAAC,GAAG,CAAC,wBAAwB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,3 +0,0 @@
1
- import { PluginPackage } from '../../common';
2
- export declare function loadManifest(pluginPath: string): Promise<PluginPackage>;
3
- //# sourceMappingURL=plugin-manifest-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-manifest-loader.d.ts","sourceRoot":"","sources":["../../../src/hosted/node/plugin-manifest-loader.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAqB,aAAa,EAAE,MAAM,cAAc,CAAC;AAGhE,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAU7E"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 Red Hat, Inc. and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.loadManifest = loadManifest;
19
- const path = require("path");
20
- const fs = require("@theia/core/shared/fs-extra");
21
- const common_1 = require("../../common");
22
- const plugin_activation_events_1 = require("./plugin-activation-events");
23
- async function loadManifest(pluginPath) {
24
- const manifest = await fs.readJson(path.join(pluginPath, 'package.json'));
25
- // translate vscode builtins, as they are published with a prefix. See https://github.com/theia-ide/vscode-builtin-extensions/blob/master/src/republish.js#L50
26
- const built_prefix = '@theia/vscode-builtin-';
27
- if (manifest && manifest.name && manifest.name.startsWith(built_prefix)) {
28
- manifest.name = manifest.name.substring(built_prefix.length);
29
- }
30
- manifest.publisher ??= common_1.PluginIdentifiers.UNPUBLISHED;
31
- (0, plugin_activation_events_1.updateActivationEvents)(manifest);
32
- return manifest;
33
- }
34
- //# sourceMappingURL=plugin-manifest-loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-manifest-loader.js","sourceRoot":"","sources":["../../../src/hosted/node/plugin-manifest-loader.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAOhF,oCAUC;AAfD,6BAA6B;AAC7B,kDAAkD;AAClD,yCAAgE;AAChE,yEAAoE;AAE7D,KAAK,UAAU,YAAY,CAAC,UAAkB;IACjD,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;IAC1E,8JAA8J;IAC9J,MAAM,YAAY,GAAG,wBAAwB,CAAC;IAC9C,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACtE,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;IACD,QAAQ,CAAC,SAAS,KAAK,0BAAiB,CAAC,WAAW,CAAC;IACrD,IAAA,iDAAsB,EAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=errors.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.spec.d.ts","sourceRoot":"","sources":["../../../src/main/node/errors.spec.ts"],"names":[],"mappings":""}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2023 Arduino SA and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const assert_1 = require("assert");
19
- const strict_1 = require("assert/strict");
20
- const fs_1 = require("fs");
21
- const uuid_1 = require("@theia/core/lib/common/uuid");
22
- const errors_1 = require("../../common/errors");
23
- describe('errors', () => {
24
- describe('errno-exception', () => {
25
- it('should be ENOENT error', async () => {
26
- await (0, assert_1.rejects)(fs_1.promises.readFile((0, uuid_1.generateUuid)()), reason => (0, errors_1.isENOENT)(reason));
27
- });
28
- it('should not be ENOENT error (no code)', () => {
29
- (0, strict_1.strictEqual)((0, errors_1.isENOENT)(new Error('I am not ENOENT')), false);
30
- });
31
- it('should not be ENOENT error (other code)', async () => {
32
- await (0, assert_1.rejects)(fs_1.promises.readdir(__filename), reason => !(0, errors_1.isENOENT)(reason));
33
- });
34
- });
35
- });
36
- //# sourceMappingURL=errors.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.spec.js","sourceRoot":"","sources":["../../../src/main/node/errors.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,4CAA4C;AAC5C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,mCAAiC;AACjC,0CAA4C;AAC5C,2BAAoC;AACpC,sDAA2D;AAC3D,gDAA+C;AAE/C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;YACpC,MAAM,IAAA,gBAAO,EAAC,aAAE,CAAC,QAAQ,CAAC,IAAA,mBAAY,GAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,IAAA,iBAAQ,EAAC,MAAM,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC5C,IAAA,oBAAW,EAAC,IAAA,iBAAQ,EAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,IAAA,gBAAO,EAAC,aAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAA,iBAAQ,EAAC,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,112 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { flatten } from '../../common/arrays';
18
- import { isStringArray, isObject } from '@theia/core/lib/common/types';
19
- import {
20
- PluginPackage,
21
- PluginPackageAuthenticationProvider,
22
- PluginPackageCommand,
23
- PluginPackageContribution,
24
- PluginPackageCustomEditor,
25
- PluginPackageLanguageContribution,
26
- PluginPackageNotebook,
27
- PluginPackageView
28
- } from '../../common/plugin-protocol';
29
-
30
- /**
31
- * Most activation events can be automatically deduced from the package manifest.
32
- * This function will update the manifest based on the plugin contributions.
33
- */
34
- export function updateActivationEvents(manifest: PluginPackage): void {
35
- if (!isObject<PluginPackage>(manifest) || !isObject<PluginPackageContribution>(manifest.contributes) || !manifest.contributes) {
36
- return;
37
- }
38
-
39
- const activationEvents = new Set(isStringArray(manifest.activationEvents) ? manifest.activationEvents : []);
40
-
41
- if (manifest.contributes.commands) {
42
- const value = manifest.contributes.commands;
43
- const commands = Array.isArray(value) ? value : [value];
44
- updateCommandsContributions(commands, activationEvents);
45
- }
46
- if (isObject(manifest.contributes.views)) {
47
- const views = flatten(Object.values(manifest.contributes.views));
48
- updateViewsContribution(views, activationEvents);
49
- }
50
- if (Array.isArray(manifest.contributes.customEditors)) {
51
- updateCustomEditorsContribution(manifest.contributes.customEditors, activationEvents);
52
- }
53
- if (Array.isArray(manifest.contributes.authentication)) {
54
- updateAuthenticationProviderContributions(manifest.contributes.authentication, activationEvents);
55
- }
56
- if (Array.isArray(manifest.contributes.languages)) {
57
- updateLanguageContributions(manifest.contributes.languages, activationEvents);
58
- }
59
- if (Array.isArray(manifest.contributes.notebooks)) {
60
- updateNotebookContributions(manifest.contributes.notebooks, activationEvents);
61
- }
62
-
63
- manifest.activationEvents = Array.from(activationEvents);
64
- }
65
-
66
- function updateViewsContribution(views: PluginPackageView[], activationEvents: Set<string>): void {
67
- for (const view of views) {
68
- if (isObject<PluginPackageView>(view) && typeof view.id === 'string') {
69
- activationEvents.add(`onView:${view.id}`);
70
- }
71
- }
72
- }
73
-
74
- function updateCustomEditorsContribution(customEditors: PluginPackageCustomEditor[], activationEvents: Set<string>): void {
75
- for (const customEditor of customEditors) {
76
- if (isObject<PluginPackageCustomEditor>(customEditor) && typeof customEditor.viewType === 'string') {
77
- activationEvents.add(`onCustomEditor:${customEditor.viewType}`);
78
- }
79
- }
80
- }
81
-
82
- function updateCommandsContributions(commands: PluginPackageCommand[], activationEvents: Set<string>): void {
83
- for (const command of commands) {
84
- if (isObject<PluginPackageCommand>(command) && typeof command.command === 'string') {
85
- activationEvents.add(`onCommand:${command.command}`);
86
- }
87
- }
88
- }
89
-
90
- function updateAuthenticationProviderContributions(authProviders: PluginPackageAuthenticationProvider[], activationEvents: Set<string>): void {
91
- for (const authProvider of authProviders) {
92
- if (isObject<PluginPackageAuthenticationProvider>(authProvider) && typeof authProvider.id === 'string') {
93
- activationEvents.add(`onAuthenticationRequest:${authProvider.id}`);
94
- }
95
- }
96
- }
97
-
98
- function updateLanguageContributions(languages: PluginPackageLanguageContribution[], activationEvents: Set<string>): void {
99
- for (const language of languages) {
100
- if (isObject<PluginPackageLanguageContribution>(language) && typeof language.id === 'string') {
101
- activationEvents.add(`onLanguage:${language.id}`);
102
- }
103
- }
104
- }
105
-
106
- function updateNotebookContributions(notebooks: PluginPackageNotebook[], activationEvents: Set<string>): void {
107
- for (const notebook of notebooks) {
108
- if (isObject<PluginPackageNotebook>(notebook) && typeof notebook.type === 'string') {
109
- activationEvents.add(`onNotebookSerializer:${notebook.type}`);
110
- }
111
- }
112
- }
@@ -1,32 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import * as path from 'path';
18
- import * as fs from '@theia/core/shared/fs-extra';
19
- import { PluginIdentifiers, PluginPackage } from '../../common';
20
- import { updateActivationEvents } from './plugin-activation-events';
21
-
22
- export async function loadManifest(pluginPath: string): Promise<PluginPackage> {
23
- const manifest = await fs.readJson(path.join(pluginPath, 'package.json'));
24
- // translate vscode builtins, as they are published with a prefix. See https://github.com/theia-ide/vscode-builtin-extensions/blob/master/src/republish.js#L50
25
- const built_prefix = '@theia/vscode-builtin-';
26
- if (manifest && manifest.name && manifest.name.startsWith(built_prefix)) {
27
- manifest.name = manifest.name.substring(built_prefix.length);
28
- }
29
- manifest.publisher ??= PluginIdentifiers.UNPUBLISHED;
30
- updateActivationEvents(manifest);
31
- return manifest;
32
- }
@@ -1,37 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 Arduino SA and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { rejects } from 'assert';
18
- import { strictEqual } from 'assert/strict';
19
- import { promises as fs } from 'fs';
20
- import { generateUuid } from '@theia/core/lib/common/uuid';
21
- import { isENOENT } from '../../common/errors';
22
-
23
- describe('errors', () => {
24
- describe('errno-exception', () => {
25
- it('should be ENOENT error', async () => {
26
- await rejects(fs.readFile(generateUuid()), reason => isENOENT(reason));
27
- });
28
-
29
- it('should not be ENOENT error (no code)', () => {
30
- strictEqual(isENOENT(new Error('I am not ENOENT')), false);
31
- });
32
-
33
- it('should not be ENOENT error (other code)', async () => {
34
- await rejects(fs.readdir(__filename), reason => !isENOENT(reason));
35
- });
36
- });
37
- });