@theia/plugin-ext 1.45.1 → 1.46.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.
Files changed (291) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +9 -4
  2. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.js +3 -1
  4. package/lib/common/plugin-api-rpc.js.map +1 -1
  5. package/lib/common/plugin-ext-api-contribution.d.ts +35 -5
  6. package/lib/common/plugin-ext-api-contribution.d.ts.map +1 -1
  7. package/lib/common/plugin-ext-api-contribution.js.map +1 -1
  8. package/lib/common/plugin-protocol.d.ts +5 -2
  9. package/lib/common/plugin-protocol.d.ts.map +1 -1
  10. package/lib/common/plugin-protocol.js +1 -0
  11. package/lib/common/plugin-protocol.js.map +1 -1
  12. package/lib/common/proxy-handler.d.ts +7 -0
  13. package/lib/common/proxy-handler.d.ts.map +1 -1
  14. package/lib/common/proxy-handler.js +5 -1
  15. package/lib/common/proxy-handler.js.map +1 -1
  16. package/lib/common/rpc-protocol.d.ts +10 -0
  17. package/lib/common/rpc-protocol.d.ts.map +1 -1
  18. package/lib/common/rpc-protocol.js +32 -3
  19. package/lib/common/rpc-protocol.js.map +1 -1
  20. package/lib/hosted/browser/hosted-plugin.d.ts +16 -74
  21. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  22. package/lib/hosted/browser/hosted-plugin.js +41 -314
  23. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  24. package/lib/hosted/browser/worker/debug-stub.d.ts +2 -2
  25. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  26. package/lib/hosted/browser/worker/debug-stub.js +3 -3
  27. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  28. package/lib/hosted/browser/worker/worker-env-ext.d.ts +1 -2
  29. package/lib/hosted/browser/worker/worker-env-ext.d.ts.map +1 -1
  30. package/lib/hosted/browser/worker/worker-env-ext.js +18 -4
  31. package/lib/hosted/browser/worker/worker-env-ext.js.map +1 -1
  32. package/lib/hosted/browser/worker/worker-main.js +20 -32
  33. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  34. package/lib/hosted/browser/worker/worker-plugin-module.d.ts +5 -0
  35. package/lib/hosted/browser/worker/worker-plugin-module.d.ts.map +1 -0
  36. package/lib/hosted/browser/worker/worker-plugin-module.js +71 -0
  37. package/lib/hosted/browser/worker/worker-plugin-module.js.map +1 -0
  38. package/lib/hosted/common/hosted-plugin.d.ts +97 -0
  39. package/lib/hosted/common/hosted-plugin.d.ts.map +1 -0
  40. package/lib/hosted/common/hosted-plugin.js +408 -0
  41. package/lib/hosted/common/hosted-plugin.js.map +1 -0
  42. package/lib/hosted/node/hosted-plugin-process.d.ts +1 -1
  43. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  44. package/lib/hosted/node/hosted-plugin-process.js +2 -2
  45. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  46. package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
  47. package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
  48. package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
  49. package/lib/hosted/node/plugin-host-module.d.ts +5 -0
  50. package/lib/hosted/node/plugin-host-module.d.ts.map +1 -0
  51. package/lib/hosted/node/plugin-host-module.js +68 -0
  52. package/lib/hosted/node/plugin-host-module.js.map +1 -0
  53. package/lib/hosted/node/plugin-host-rpc.d.ts +93 -7
  54. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  55. package/lib/hosted/node/plugin-host-rpc.js +202 -53
  56. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  57. package/lib/hosted/node/plugin-host.js +6 -5
  58. package/lib/hosted/node/plugin-host.js.map +1 -1
  59. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  60. package/lib/hosted/node/plugin-reader.js +3 -0
  61. package/lib/hosted/node/plugin-reader.js.map +1 -1
  62. package/lib/hosted/node/plugin-service.d.ts +8 -0
  63. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  64. package/lib/hosted/node/plugin-service.js +14 -4
  65. package/lib/hosted/node/plugin-service.js.map +1 -1
  66. package/lib/hosted/node/scanners/file-plugin-uri-factory.js +1 -1
  67. package/lib/hosted/node/scanners/file-plugin-uri-factory.js.map +1 -1
  68. package/lib/hosted/node/scanners/scanner-theia.d.ts +17 -3
  69. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  70. package/lib/hosted/node/scanners/scanner-theia.js +48 -19
  71. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  72. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  73. package/lib/main/browser/authentication-main.js +3 -1
  74. package/lib/main/browser/authentication-main.js.map +1 -1
  75. package/lib/main/browser/env-main.d.ts +1 -10
  76. package/lib/main/browser/env-main.d.ts.map +1 -1
  77. package/lib/main/browser/env-main.js +2 -21
  78. package/lib/main/browser/env-main.js.map +1 -1
  79. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  80. package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
  81. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  82. package/lib/main/browser/menus/plugin-menu-command-adapter.js +1 -1
  83. package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
  84. package/lib/main/browser/message-registry-main.d.ts +6 -4
  85. package/lib/main/browser/message-registry-main.d.ts.map +1 -1
  86. package/lib/main/browser/message-registry-main.js +7 -19
  87. package/lib/main/browser/message-registry-main.js.map +1 -1
  88. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +1 -0
  89. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
  90. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +23 -22
  91. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
  92. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
  93. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +22 -14
  94. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
  95. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +2 -1
  96. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -1
  97. package/lib/main/browser/notification-main.d.ts +2 -14
  98. package/lib/main/browser/notification-main.d.ts.map +1 -1
  99. package/lib/main/browser/notification-main.js +3 -52
  100. package/lib/main/browser/notification-main.js.map +1 -1
  101. package/lib/main/browser/terminal-main.d.ts +1 -1
  102. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  103. package/lib/main/browser/terminal-main.js +2 -2
  104. package/lib/main/browser/terminal-main.js.map +1 -1
  105. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  106. package/lib/main/browser/view/plugin-view-registry.js +5 -2
  107. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  108. package/lib/main/browser/webview/webview-context-keys.d.ts +5 -1
  109. package/lib/main/browser/webview/webview-context-keys.d.ts.map +1 -1
  110. package/lib/main/browser/webview/webview-context-keys.js +13 -4
  111. package/lib/main/browser/webview/webview-context-keys.js.map +1 -1
  112. package/lib/main/browser/webview/webview-widget-factory.d.ts.map +1 -1
  113. package/lib/main/browser/webview/webview-widget-factory.js +2 -1
  114. package/lib/main/browser/webview/webview-widget-factory.js.map +1 -1
  115. package/lib/main/browser/webview/webview.d.ts +1 -0
  116. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  117. package/lib/main/browser/webview/webview.js +1 -0
  118. package/lib/main/browser/webview/webview.js.map +1 -1
  119. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  120. package/lib/main/browser/webviews-main.js +7 -2
  121. package/lib/main/browser/webviews-main.js.map +1 -1
  122. package/lib/main/common/basic-message-registry-main.d.ts +14 -0
  123. package/lib/main/common/basic-message-registry-main.d.ts.map +1 -0
  124. package/lib/main/common/basic-message-registry-main.js +50 -0
  125. package/lib/main/common/basic-message-registry-main.js.map +1 -0
  126. package/lib/main/common/basic-notification-main.d.ts +19 -0
  127. package/lib/main/common/basic-notification-main.d.ts.map +1 -0
  128. package/lib/main/common/basic-notification-main.js +75 -0
  129. package/lib/main/common/basic-notification-main.js.map +1 -0
  130. package/lib/main/common/env-main.d.ts +11 -0
  131. package/lib/main/common/env-main.d.ts.map +1 -0
  132. package/lib/main/common/env-main.js +40 -0
  133. package/lib/main/common/env-main.js.map +1 -0
  134. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +8 -3
  135. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  136. package/lib/main/node/handlers/plugin-theia-directory-handler.js +38 -20
  137. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  138. package/lib/main/node/handlers/plugin-theia-file-handler.js +1 -1
  139. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  140. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  141. package/lib/main/node/plugin-deployer-impl.js +5 -1
  142. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  143. package/lib/main/node/plugins-key-value-storage.js +1 -1
  144. package/lib/main/node/plugins-key-value-storage.js.map +1 -1
  145. package/lib/plugin/clipboard-ext.d.ts +3 -2
  146. package/lib/plugin/clipboard-ext.d.ts.map +1 -1
  147. package/lib/plugin/clipboard-ext.js +28 -4
  148. package/lib/plugin/clipboard-ext.js.map +1 -1
  149. package/lib/plugin/debug/debug-ext.d.ts +3 -1
  150. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  151. package/lib/plugin/debug/debug-ext.js +31 -4
  152. package/lib/plugin/debug/debug-ext.js.map +1 -1
  153. package/lib/plugin/documents.js +2 -2
  154. package/lib/plugin/documents.js.map +1 -1
  155. package/lib/plugin/editors-and-documents.d.ts +1 -2
  156. package/lib/plugin/editors-and-documents.d.ts.map +1 -1
  157. package/lib/plugin/editors-and-documents.js +21 -4
  158. package/lib/plugin/editors-and-documents.js.map +1 -1
  159. package/lib/plugin/env.d.ts +6 -2
  160. package/lib/plugin/env.d.ts.map +1 -1
  161. package/lib/plugin/env.js +37 -4
  162. package/lib/plugin/env.js.map +1 -1
  163. package/lib/plugin/localization-ext.d.ts +3 -2
  164. package/lib/plugin/localization-ext.d.ts.map +1 -1
  165. package/lib/plugin/localization-ext.js +30 -4
  166. package/lib/plugin/localization-ext.js.map +1 -1
  167. package/lib/plugin/message-registry.d.ts +2 -1
  168. package/lib/plugin/message-registry.d.ts.map +1 -1
  169. package/lib/plugin/message-registry.js +28 -4
  170. package/lib/plugin/message-registry.js.map +1 -1
  171. package/lib/plugin/node/debug/debug.spec.js +21 -1
  172. package/lib/plugin/node/debug/debug.spec.js.map +1 -1
  173. package/lib/plugin/node/env-node-ext.d.ts +1 -6
  174. package/lib/plugin/node/env-node-ext.d.ts.map +1 -1
  175. package/lib/plugin/node/env-node-ext.js +18 -10
  176. package/lib/plugin/node/env-node-ext.js.map +1 -1
  177. package/lib/plugin/node/plugin-container-module.d.ts +75 -0
  178. package/lib/plugin/node/plugin-container-module.d.ts.map +1 -0
  179. package/lib/plugin/node/plugin-container-module.js +115 -0
  180. package/lib/plugin/node/plugin-container-module.js.map +1 -0
  181. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  182. package/lib/plugin/notebook/notebook-kernels.js +0 -1
  183. package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
  184. package/lib/plugin/plugin-context.d.ts.map +1 -1
  185. package/lib/plugin/plugin-context.js +9 -1
  186. package/lib/plugin/plugin-context.js.map +1 -1
  187. package/lib/plugin/plugin-manager.d.ts +26 -17
  188. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  189. package/lib/plugin/plugin-manager.js +107 -37
  190. package/lib/plugin/plugin-manager.js.map +1 -1
  191. package/lib/plugin/plugin-storage.d.ts +11 -3
  192. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  193. package/lib/plugin/plugin-storage.js +25 -5
  194. package/lib/plugin/plugin-storage.js.map +1 -1
  195. package/lib/plugin/preference-registry.d.ts +3 -2
  196. package/lib/plugin/preference-registry.d.ts.map +1 -1
  197. package/lib/plugin/preference-registry.js +35 -5
  198. package/lib/plugin/preference-registry.js.map +1 -1
  199. package/lib/plugin/preference-registry.spec.js +8 -1
  200. package/lib/plugin/preference-registry.spec.js.map +1 -1
  201. package/lib/plugin/quick-open.js +3 -3
  202. package/lib/plugin/quick-open.js.map +1 -1
  203. package/lib/plugin/secrets-ext.d.ts +16 -7
  204. package/lib/plugin/secrets-ext.d.ts.map +1 -1
  205. package/lib/plugin/secrets-ext.js +23 -3
  206. package/lib/plugin/secrets-ext.js.map +1 -1
  207. package/lib/plugin/terminal-ext.d.ts +1 -1
  208. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  209. package/lib/plugin/terminal-ext.js +26 -6
  210. package/lib/plugin/terminal-ext.js.map +1 -1
  211. package/lib/plugin/types-impl.d.ts +22 -2
  212. package/lib/plugin/types-impl.d.ts.map +1 -1
  213. package/lib/plugin/types-impl.js +22 -6
  214. package/lib/plugin/types-impl.js.map +1 -1
  215. package/lib/plugin/webview-views.d.ts.map +1 -1
  216. package/lib/plugin/webview-views.js +2 -1
  217. package/lib/plugin/webview-views.js.map +1 -1
  218. package/lib/plugin/webviews.d.ts +7 -5
  219. package/lib/plugin/webviews.d.ts.map +1 -1
  220. package/lib/plugin/webviews.js +46 -12
  221. package/lib/plugin/webviews.js.map +1 -1
  222. package/lib/plugin/workspace.d.ts +4 -3
  223. package/lib/plugin/workspace.d.ts.map +1 -1
  224. package/lib/plugin/workspace.js +40 -6
  225. package/lib/plugin/workspace.js.map +1 -1
  226. package/package.json +29 -29
  227. package/src/common/plugin-api-rpc.ts +10 -6
  228. package/src/common/plugin-ext-api-contribution.ts +38 -5
  229. package/src/common/plugin-protocol.ts +7 -2
  230. package/src/common/proxy-handler.ts +14 -1
  231. package/src/common/rpc-protocol.ts +41 -3
  232. package/src/hosted/browser/hosted-plugin.ts +47 -337
  233. package/src/hosted/browser/worker/debug-stub.ts +4 -3
  234. package/src/hosted/browser/worker/worker-env-ext.ts +5 -4
  235. package/src/hosted/browser/worker/worker-main.ts +103 -115
  236. package/src/hosted/browser/worker/worker-plugin-module.ts +73 -0
  237. package/src/hosted/common/hosted-plugin.ts +456 -0
  238. package/src/hosted/node/hosted-plugin-process.ts +4 -4
  239. package/src/hosted/node/plugin-ext-hosted-backend-module.ts +3 -1
  240. package/src/hosted/node/plugin-host-module.ts +69 -0
  241. package/src/hosted/node/plugin-host-rpc.ts +232 -73
  242. package/src/hosted/node/plugin-host.ts +9 -7
  243. package/src/hosted/node/plugin-reader.ts +3 -0
  244. package/src/hosted/node/plugin-service.ts +21 -4
  245. package/src/hosted/node/scanners/file-plugin-uri-factory.ts +1 -1
  246. package/src/hosted/node/scanners/scanner-theia.ts +46 -12
  247. package/src/main/browser/authentication-main.ts +3 -1
  248. package/src/main/browser/env-main.ts +1 -28
  249. package/src/main/browser/menus/menus-contribution-handler.ts +8 -3
  250. package/src/main/browser/menus/plugin-menu-command-adapter.ts +1 -1
  251. package/src/main/browser/message-registry-main.ts +10 -23
  252. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +26 -24
  253. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +22 -13
  254. package/src/main/browser/notebooks/renderers/webview-communication.ts +2 -1
  255. package/src/main/browser/notification-main.ts +4 -64
  256. package/src/main/browser/terminal-main.ts +2 -2
  257. package/src/main/browser/view/plugin-view-registry.ts +6 -3
  258. package/src/main/browser/webview/webview-context-keys.ts +17 -4
  259. package/src/main/browser/webview/webview-widget-factory.ts +2 -1
  260. package/src/main/browser/webview/webview.ts +2 -0
  261. package/src/main/browser/webviews-main.ts +7 -2
  262. package/src/main/common/basic-message-registry-main.ts +53 -0
  263. package/src/main/common/basic-notification-main.ts +86 -0
  264. package/src/main/common/env-main.ts +44 -0
  265. package/src/main/node/handlers/plugin-theia-directory-handler.ts +38 -16
  266. package/src/main/node/handlers/plugin-theia-file-handler.ts +1 -1
  267. package/src/main/node/plugin-deployer-impl.ts +5 -1
  268. package/src/main/node/plugins-key-value-storage.ts +1 -1
  269. package/src/plugin/clipboard-ext.ts +9 -3
  270. package/src/plugin/debug/debug-ext.ts +11 -2
  271. package/src/plugin/documents.ts +2 -2
  272. package/src/plugin/editors-and-documents.ts +5 -3
  273. package/src/plugin/env.ts +19 -3
  274. package/src/plugin/localization-ext.ts +8 -3
  275. package/src/plugin/message-registry.ts +7 -2
  276. package/src/plugin/node/debug/debug.spec.ts +5 -1
  277. package/src/plugin/node/env-node-ext.ts +5 -10
  278. package/src/plugin/node/plugin-container-module.ts +165 -0
  279. package/src/plugin/notebook/notebook-kernels.ts +0 -1
  280. package/src/plugin/plugin-context.ts +11 -2
  281. package/src/plugin/plugin-manager.ts +99 -45
  282. package/src/plugin/plugin-storage.ts +22 -4
  283. package/src/plugin/preference-registry.spec.ts +6 -1
  284. package/src/plugin/preference-registry.ts +11 -5
  285. package/src/plugin/quick-open.ts +3 -3
  286. package/src/plugin/secrets-ext.ts +25 -5
  287. package/src/plugin/terminal-ext.ts +5 -3
  288. package/src/plugin/types-impl.ts +30 -2
  289. package/src/plugin/webview-views.ts +2 -1
  290. package/src/plugin/webviews.ts +22 -13
  291. package/src/plugin/workspace.ts +14 -4
@@ -21,26 +21,24 @@
21
21
 
22
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
23
23
 
24
- import debounce = require('@theia/core/shared/lodash.debounce');
25
- import { UUID } from '@theia/core/shared/@phosphor/coreutils';
26
- import { injectable, inject, interfaces, named, postConstruct } from '@theia/core/shared/inversify';
24
+ import { generateUuid } from '@theia/core/lib/common/uuid';
25
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
27
26
  import { PluginWorker } from './plugin-worker';
28
- import { PluginMetadata, getPluginId, HostedPluginServer, DeployedPlugin, PluginServer, PluginIdentifiers } from '../../common/plugin-protocol';
27
+ import { getPluginId, DeployedPlugin, HostedPluginServer } from '../../common/plugin-protocol';
29
28
  import { HostedPluginWatcher } from './hosted-plugin-watcher';
30
- import { MAIN_RPC_CONTEXT, PluginManagerExt, ConfigStorage, UIKind } from '../../common/plugin-api-rpc';
29
+ import { MAIN_RPC_CONTEXT, PluginManagerExt, UIKind } from '../../common/plugin-api-rpc';
31
30
  import { setUpPluginApi } from '../../main/browser/main-context';
32
31
  import { RPCProtocol, RPCProtocolImpl } from '../../common/rpc-protocol';
33
32
  import {
34
- Disposable, DisposableCollection, Emitter, isCancelled,
35
- ILogger, ContributionProvider, CommandRegistry, WillExecuteCommandEvent,
36
- CancellationTokenSource, RpcProxy, ProgressService, nls
33
+ Disposable, DisposableCollection, isCancelled,
34
+ CommandRegistry, WillExecuteCommandEvent,
35
+ CancellationTokenSource, ProgressService, nls,
36
+ RpcProxy
37
37
  } from '@theia/core';
38
38
  import { PreferenceServiceImpl, PreferenceProviderProvider } from '@theia/core/lib/browser/preferences';
39
39
  import { WorkspaceService } from '@theia/workspace/lib/browser';
40
40
  import { PluginContributionHandler } from '../../main/browser/plugin-contribution-handler';
41
41
  import { getQueryParameters } from '../../main/browser/env-main';
42
- import { MainPluginApiProvider } from '../../common/plugin-ext-api-contribution';
43
- import { PluginPathsService } from '../../main/common/plugin-paths-protocol';
44
42
  import { getPreferences } from '../../main/browser/preference-registry-main';
45
43
  import { Deferred } from '@theia/core/lib/common/promise-util';
46
44
  import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
@@ -55,7 +53,6 @@ import { WebviewEnvironment } from '../../main/browser/webview/webview-environme
55
53
  import { WebviewWidget } from '../../main/browser/webview/webview';
56
54
  import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
57
55
  import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
58
- import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
59
56
  import URI from '@theia/core/lib/common/uri';
60
57
  import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
61
58
  import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
@@ -66,19 +63,21 @@ import { CustomEditorWidget } from '../../main/browser/custom-editors/custom-edi
66
63
  import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
67
64
  import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
68
65
  import { LanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageService';
69
- import { Measurement, Stopwatch } from '@theia/core/lib/common';
70
66
  import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
71
67
  import { BasicChannel } from '@theia/core/lib/common/message-rpc/channel';
72
68
  import { NotebookTypeRegistry, NotebookService, NotebookRendererMessagingService } from '@theia/notebook/lib/browser';
69
+ import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
70
+ import {
71
+ AbstractHostedPluginSupport, PluginContributions, PluginHost,
72
+ ALL_ACTIVATION_EVENT, isConnectionScopedBackendPlugin
73
+ } from '../common/hosted-plugin';
73
74
 
74
- export type PluginHost = 'frontend' | string;
75
75
  export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
76
76
 
77
77
  export const PluginProgressLocation = 'plugin';
78
- export const ALL_ACTIVATION_EVENT = '*';
79
78
 
80
79
  @injectable()
81
- export class HostedPluginSupport {
80
+ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManagerExt, RpcProxy<HostedPluginServer>> {
82
81
 
83
82
  protected static ADDITIONAL_ACTIVATION_EVENTS_ENV = 'ADDITIONAL_ACTIVATION_EVENTS';
84
83
  protected static BUILTIN_ACTIVATION_EVENTS = [
@@ -104,38 +103,18 @@ export class HostedPluginSupport {
104
103
  'onNotebookSerializer'
105
104
  ];
106
105
 
107
- protected readonly clientId = UUID.uuid4();
108
-
109
- protected container: interfaces.Container;
110
-
111
- @inject(ILogger)
112
- protected readonly logger: ILogger;
113
-
114
- @inject(HostedPluginServer)
115
- protected readonly server: RpcProxy<HostedPluginServer>;
116
-
117
106
  @inject(HostedPluginWatcher)
118
107
  protected readonly watcher: HostedPluginWatcher;
119
108
 
120
109
  @inject(PluginContributionHandler)
121
110
  protected readonly contributionHandler: PluginContributionHandler;
122
111
 
123
- @inject(ContributionProvider)
124
- @named(MainPluginApiProvider)
125
- protected readonly mainPluginApiProviders: ContributionProvider<MainPluginApiProvider>;
126
-
127
- @inject(PluginServer)
128
- protected readonly pluginServer: PluginServer;
129
-
130
112
  @inject(PreferenceProviderProvider)
131
113
  protected readonly preferenceProviderProvider: PreferenceProviderProvider;
132
114
 
133
115
  @inject(PreferenceServiceImpl)
134
116
  protected readonly preferenceServiceImpl: PreferenceServiceImpl;
135
117
 
136
- @inject(PluginPathsService)
137
- protected readonly pluginPathsService: PluginPathsService;
138
-
139
118
  @inject(WorkspaceService)
140
119
  protected readonly workspaceService: WorkspaceService;
141
120
 
@@ -190,48 +169,23 @@ export class HostedPluginSupport {
190
169
  @inject(TerminalService)
191
170
  protected readonly terminalService: TerminalService;
192
171
 
193
- @inject(EnvVariablesServer)
194
- protected readonly envServer: EnvVariablesServer;
195
-
196
172
  @inject(JsonSchemaStore)
197
173
  protected readonly jsonSchemaStore: JsonSchemaStore;
198
174
 
199
175
  @inject(PluginCustomEditorRegistry)
200
176
  protected readonly customEditorRegistry: PluginCustomEditorRegistry;
201
177
 
202
- @inject(Stopwatch)
203
- protected readonly stopwatch: Stopwatch;
204
-
205
- protected theiaReadyPromise: Promise<any>;
206
-
207
- protected readonly managers = new Map<string, PluginManagerExt>();
208
-
209
- protected readonly contributions = new Map<PluginIdentifiers.UnversionedId, PluginContributions>();
178
+ @inject(ApplicationServer)
179
+ protected readonly applicationServer: ApplicationServer;
210
180
 
211
- protected readonly activationEvents = new Set<string>();
212
-
213
- protected readonly onDidChangePluginsEmitter = new Emitter<void>();
214
- readonly onDidChangePlugins = this.onDidChangePluginsEmitter.event;
215
-
216
- protected readonly deferredWillStart = new Deferred<void>();
217
- /**
218
- * Resolves when the initial plugins are loaded and about to be started.
219
- */
220
- get willStart(): Promise<void> {
221
- return this.deferredWillStart.promise;
222
- }
223
-
224
- protected readonly deferredDidStart = new Deferred<void>();
225
- /**
226
- * Resolves when the initial plugins are started.
227
- */
228
- get didStart(): Promise<void> {
229
- return this.deferredDidStart.promise;
181
+ constructor() {
182
+ super(generateUuid());
230
183
  }
231
184
 
232
185
  @postConstruct()
233
- protected init(): void {
234
- this.theiaReadyPromise = Promise.all([this.preferenceServiceImpl.ready, this.workspaceService.roots]);
186
+ protected override init(): void {
187
+ super.init();
188
+
235
189
  this.workspaceService.onWorkspaceChanged(() => this.updateStoragePath());
236
190
 
237
191
  const languageService = (StandaloneServices.get(ILanguageService) as LanguageService);
@@ -277,254 +231,49 @@ export class HostedPluginSupport {
277
231
  });
278
232
  }
279
233
 
280
- get plugins(): PluginMetadata[] {
281
- const plugins: PluginMetadata[] = [];
282
- this.contributions.forEach(contributions => plugins.push(contributions.plugin.metadata));
283
- return plugins;
234
+ protected createTheiaReadyPromise(): Promise<unknown> {
235
+ return Promise.all([this.preferenceServiceImpl.ready, this.workspaceService.roots]);
284
236
  }
285
237
 
286
- getPlugin(id: PluginIdentifiers.UnversionedId): DeployedPlugin | undefined {
287
- const contributions = this.contributions.get(id);
288
- return contributions && contributions.plugin;
238
+ protected override runOperation(operation: () => Promise<void>): Promise<void> {
239
+ return this.progressService.withProgress('', PluginProgressLocation, () => this.doLoad());
289
240
  }
290
241
 
291
- /** do not call it, except from the plugin frontend contribution */
292
- onStart(container: interfaces.Container): void {
293
- this.container = container;
294
- this.load();
295
- this.watcher.onDidDeploy(() => this.load());
242
+ protected override afterStart(): void {
296
243
  this.server.onDidOpenConnection(() => this.load());
297
244
  }
298
245
 
299
- protected loadQueue: Promise<void> = Promise.resolve(undefined);
300
- load = debounce(() => this.loadQueue = this.loadQueue.then(async () => {
301
- try {
302
- await this.progressService.withProgress('', PluginProgressLocation, () => this.doLoad());
303
- } catch (e) {
304
- console.error('Failed to load plugins:', e);
305
- }
306
- }), 50, { leading: true });
246
+ // Only load connection-scoped plugins
247
+ protected acceptPlugin(plugin: DeployedPlugin): boolean {
248
+ return isConnectionScopedBackendPlugin(plugin);
249
+ }
250
+
251
+ protected override async beforeSyncPlugins(toDisconnect: DisposableCollection): Promise<void> {
252
+ await super.beforeSyncPlugins(toDisconnect);
307
253
 
308
- protected async doLoad(): Promise<void> {
309
- const toDisconnect = new DisposableCollection(Disposable.create(() => { /* mark as connected */ }));
310
254
  toDisconnect.push(Disposable.create(() => this.preserveWebviews()));
311
255
  this.server.onDidCloseConnection(() => toDisconnect.dispose());
256
+ }
312
257
 
313
- // process empty plugins as well in order to properly remove stale plugin widgets
314
- await this.syncPlugins();
315
-
316
- // it has to be resolved before awaiting layout is initialized
317
- // otherwise clients can hang forever in the initialization phase
318
- this.deferredWillStart.resolve();
319
-
258
+ protected override async beforeLoadContributions(toDisconnect: DisposableCollection): Promise<void> {
320
259
  // make sure that the previous state, including plugin widgets, is restored
321
260
  // and core layout is initialized, i.e. explorer, scm, debug views are already added to the shell
322
261
  // but shell is not yet revealed
323
262
  await this.appState.reachedState('initialized_layout');
263
+ }
324
264
 
325
- if (toDisconnect.disposed) {
326
- // if disconnected then don't try to load plugin contributions
327
- return;
328
- }
329
- const contributionsByHost = this.loadContributions(toDisconnect);
330
-
265
+ protected override async afterLoadContributions(toDisconnect: DisposableCollection): Promise<void> {
331
266
  await this.viewRegistry.initWidgets();
332
267
  // remove restored plugin widgets which were not registered by contributions
333
268
  this.viewRegistry.removeStaleWidgets();
334
- await this.theiaReadyPromise;
335
-
336
- if (toDisconnect.disposed) {
337
- // if disconnected then don't try to init plugin code and dynamic contributions
338
- return;
339
- }
340
- await this.startPlugins(contributionsByHost, toDisconnect);
341
-
342
- this.deferredDidStart.resolve();
343
- }
344
-
345
- /**
346
- * Sync loaded and deployed plugins:
347
- * - undeployed plugins are unloaded
348
- * - newly deployed plugins are initialized
349
- */
350
- protected async syncPlugins(): Promise<void> {
351
- let initialized = 0;
352
- const waitPluginsMeasurement = this.measure('waitForDeployment');
353
- let syncPluginsMeasurement: Measurement | undefined;
354
-
355
- const toUnload = new Set(this.contributions.keys());
356
- let didChangeInstallationStatus = false;
357
- try {
358
- const newPluginIds: PluginIdentifiers.VersionedId[] = [];
359
- const [deployedPluginIds, uninstalledPluginIds] = await Promise.all([this.server.getDeployedPluginIds(), this.server.getUninstalledPluginIds()]);
360
- waitPluginsMeasurement.log('Waiting for backend deployment');
361
- syncPluginsMeasurement = this.measure('syncPlugins');
362
- for (const versionedId of deployedPluginIds) {
363
- const unversionedId = PluginIdentifiers.unversionedFromVersioned(versionedId);
364
- toUnload.delete(unversionedId);
365
- if (!this.contributions.has(unversionedId)) {
366
- newPluginIds.push(versionedId);
367
- }
368
- }
369
- for (const pluginId of toUnload) {
370
- this.contributions.get(pluginId)?.dispose();
371
- }
372
- for (const versionedId of uninstalledPluginIds) {
373
- const plugin = this.getPlugin(PluginIdentifiers.unversionedFromVersioned(versionedId));
374
- if (plugin && PluginIdentifiers.componentsToVersionedId(plugin.metadata.model) === versionedId && !plugin.metadata.outOfSync) {
375
- plugin.metadata.outOfSync = didChangeInstallationStatus = true;
376
- }
377
- }
378
- for (const contribution of this.contributions.values()) {
379
- if (contribution.plugin.metadata.outOfSync && !uninstalledPluginIds.includes(PluginIdentifiers.componentsToVersionedId(contribution.plugin.metadata.model))) {
380
- contribution.plugin.metadata.outOfSync = false;
381
- didChangeInstallationStatus = true;
382
- }
383
- }
384
- if (newPluginIds.length) {
385
- const plugins = await this.server.getDeployedPlugins({ pluginIds: newPluginIds });
386
- for (const plugin of plugins) {
387
- const pluginId = PluginIdentifiers.componentsToUnversionedId(plugin.metadata.model);
388
- const contributions = new PluginContributions(plugin);
389
- this.contributions.set(pluginId, contributions);
390
- contributions.push(Disposable.create(() => this.contributions.delete(pluginId)));
391
- initialized++;
392
- }
393
- }
394
- } finally {
395
- if (initialized || toUnload.size || didChangeInstallationStatus) {
396
- this.onDidChangePluginsEmitter.fire(undefined);
397
- }
398
-
399
- if (!syncPluginsMeasurement) {
400
- // await didn't complete normally
401
- waitPluginsMeasurement.error('Backend deployment failed.');
402
- }
403
- }
404
- if (initialized > 0) {
405
- // Only log sync measurement if there are were plugins to sync.
406
- syncPluginsMeasurement?.log(`Sync of ${this.getPluginCount(initialized)}`);
407
- } else {
408
- syncPluginsMeasurement.stop();
409
- }
410
269
  }
411
270
 
412
- /**
413
- * Always synchronous in order to simplify handling disconnections.
414
- * @throws never
415
- */
416
- protected loadContributions(toDisconnect: DisposableCollection): Map<PluginHost, PluginContributions[]> {
417
- let loaded = 0;
418
- const loadPluginsMeasurement = this.measure('loadPlugins');
419
-
420
- const hostContributions = new Map<PluginHost, PluginContributions[]>();
421
- console.log(`[${this.clientId}] Loading plugin contributions`);
422
- for (const contributions of this.contributions.values()) {
423
- const plugin = contributions.plugin.metadata;
424
- const pluginId = plugin.model.id;
425
-
426
- if (contributions.state === PluginContributions.State.INITIALIZING) {
427
- contributions.state = PluginContributions.State.LOADING;
428
- contributions.push(Disposable.create(() => console.log(`[${pluginId}]: Unloaded plugin.`)));
429
- contributions.push(this.contributionHandler.handleContributions(this.clientId, contributions.plugin));
430
- contributions.state = PluginContributions.State.LOADED;
431
- console.debug(`[${this.clientId}][${pluginId}]: Loaded contributions.`);
432
- loaded++;
433
- }
434
-
435
- if (contributions.state === PluginContributions.State.LOADED) {
436
- contributions.state = PluginContributions.State.STARTING;
437
- const host = plugin.model.entryPoint.frontend ? 'frontend' : plugin.host;
438
- const dynamicContributions = hostContributions.get(host) || [];
439
- dynamicContributions.push(contributions);
440
- hostContributions.set(host, dynamicContributions);
441
- toDisconnect.push(Disposable.create(() => {
442
- contributions!.state = PluginContributions.State.LOADED;
443
- console.debug(`[${this.clientId}][${pluginId}]: Disconnected.`);
444
- }));
445
- }
446
- }
447
- if (loaded > 0) {
448
- // Only log load measurement if there are were plugins to load.
449
- loadPluginsMeasurement?.log(`Load contributions of ${this.getPluginCount(loaded)}`);
450
- } else {
451
- loadPluginsMeasurement.stop();
452
- }
453
-
454
- return hostContributions;
271
+ protected handleContributions(plugin: DeployedPlugin): Disposable {
272
+ return this.contributionHandler.handleContributions(this.clientId, plugin);
455
273
  }
456
274
 
457
- protected async startPlugins(contributionsByHost: Map<PluginHost, PluginContributions[]>, toDisconnect: DisposableCollection): Promise<void> {
458
- let started = 0;
459
- const startPluginsMeasurement = this.measure('startPlugins');
460
-
461
- const [hostLogPath, hostStoragePath, hostGlobalStoragePath] = await Promise.all([
462
- this.pluginPathsService.getHostLogPath(),
463
- this.getStoragePath(),
464
- this.getHostGlobalStoragePath()
465
- ]);
466
-
467
- if (toDisconnect.disposed) {
468
- return;
469
- }
470
-
471
- const thenable: Promise<void>[] = [];
472
- const configStorage: ConfigStorage = {
473
- hostLogPath,
474
- hostStoragePath,
475
- hostGlobalStoragePath
476
- };
477
-
478
- for (const [host, hostContributions] of contributionsByHost) {
479
- // do not start plugins for electron browser
480
- if (host === 'frontend' && environment.electron.is()) {
481
- continue;
482
- }
483
-
484
- const manager = await this.obtainManager(host, hostContributions, toDisconnect);
485
- if (!manager) {
486
- continue;
487
- }
488
-
489
- const plugins = hostContributions.map(contributions => contributions.plugin.metadata);
490
- thenable.push((async () => {
491
- try {
492
- const activationEvents = [...this.activationEvents];
493
- await manager.$start({ plugins, configStorage, activationEvents });
494
- if (toDisconnect.disposed) {
495
- return;
496
- }
497
- console.log(`[${this.clientId}] Starting plugins.`);
498
- for (const contributions of hostContributions) {
499
- started++;
500
- const plugin = contributions.plugin;
501
- const id = plugin.metadata.model.id;
502
- contributions.state = PluginContributions.State.STARTED;
503
- console.debug(`[${this.clientId}][${id}]: Started plugin.`);
504
- toDisconnect.push(contributions.push(Disposable.create(() => {
505
- console.debug(`[${this.clientId}][${id}]: Stopped plugin.`);
506
- manager.$stop(id);
507
- })));
508
-
509
- this.activateByWorkspaceContains(manager, plugin);
510
- }
511
- } catch (e) {
512
- console.error(`Failed to start plugins for '${host}' host`, e);
513
- }
514
- })());
515
- }
516
-
517
- await Promise.all(thenable);
518
- await this.activateByEvent('onStartupFinished');
519
- if (toDisconnect.disposed) {
520
- return;
521
- }
522
-
523
- if (started > 0) {
524
- startPluginsMeasurement.log(`Start of ${this.getPluginCount(started)}`);
525
- } else {
526
- startPluginsMeasurement.stop();
527
- }
275
+ protected override handlePluginStarted(manager: PluginManagerExt, plugin: DeployedPlugin): void {
276
+ this.activateByWorkspaceContains(manager, plugin);
528
277
  }
529
278
 
530
279
  protected async obtainManager(host: string, hostContributions: PluginContributions[], toDisconnect: DisposableCollection): Promise<PluginManagerExt | undefined> {
@@ -557,7 +306,10 @@ export class HostedPluginSupport {
557
306
  const isElectron = environment.electron.is();
558
307
 
559
308
  const supportedActivationEvents = [...HostedPluginSupport.BUILTIN_ACTIVATION_EVENTS];
560
- const additionalActivationEvents = await this.envServer.getValue(HostedPluginSupport.ADDITIONAL_ACTIVATION_EVENTS_ENV);
309
+ const [additionalActivationEvents, appRoot] = await Promise.all([
310
+ this.envServer.getValue(HostedPluginSupport.ADDITIONAL_ACTIVATION_EVENTS_ENV),
311
+ this.applicationServer.getApplicationRoot()
312
+ ]);
561
313
  if (additionalActivationEvents && additionalActivationEvents.value) {
562
314
  additionalActivationEvents.value.split(',').forEach(event => supportedActivationEvents.push(event));
563
315
  }
@@ -572,7 +324,8 @@ export class HostedPluginSupport {
572
324
  shell: defaultShell,
573
325
  uiKind: isElectron ? UIKind.Desktop : UIKind.Web,
574
326
  appName: FrontendApplicationConfigProvider.get().applicationName,
575
- appHost: isElectron ? 'desktop' : 'web' // TODO: 'web' could be the embedder's name, e.g. 'github.dev'
327
+ appHost: isElectron ? 'desktop' : 'web', // TODO: 'web' could be the embedder's name, e.g. 'github.dev'
328
+ appRoot
576
329
  },
577
330
  extApi,
578
331
  webview: {
@@ -646,14 +399,6 @@ export class HostedPluginSupport {
646
399
  return globalStorageFolderFsPath;
647
400
  }
648
401
 
649
- async activateByEvent(activationEvent: string): Promise<void> {
650
- if (this.activationEvents.has(activationEvent)) {
651
- return;
652
- }
653
- this.activationEvents.add(activationEvent);
654
- await Promise.all(Array.from(this.managers.values(), manager => manager.$activateByEvent(activationEvent)));
655
- }
656
-
657
402
  async activateByViewContainer(viewContainerId: string): Promise<void> {
658
403
  await Promise.all(this.viewRegistry.getContainerViews(viewContainerId).map(viewId => this.activateByView(viewId)));
659
404
  }
@@ -808,22 +553,6 @@ export class HostedPluginSupport {
808
553
  }
809
554
  }
810
555
 
811
- async activatePlugin(id: string): Promise<void> {
812
- const activation = [];
813
- for (const manager of this.managers.values()) {
814
- activation.push(manager.$activatePlugin(id));
815
- }
816
- await Promise.all(activation);
817
- }
818
-
819
- protected measure(name: string): Measurement {
820
- return this.stopwatch.start(name, { context: this.clientId });
821
- }
822
-
823
- protected getPluginCount(plugins: number): string {
824
- return `${plugins} plugin${plugins === 1 ? '' : 's'}`;
825
- }
826
-
827
556
  protected readonly webviewsToRestore = new Map<string, WebviewWidget>();
828
557
  protected readonly webviewRevivers = new Map<string, (webview: WebviewWidget) => Promise<void>>();
829
558
 
@@ -889,22 +618,3 @@ export class HostedPluginSupport {
889
618
  }
890
619
 
891
620
  }
892
-
893
- export class PluginContributions extends DisposableCollection {
894
- constructor(
895
- readonly plugin: DeployedPlugin
896
- ) {
897
- super();
898
- }
899
- state: PluginContributions.State = PluginContributions.State.INITIALIZING;
900
- }
901
-
902
- export namespace PluginContributions {
903
- export enum State {
904
- INITIALIZING = 0,
905
- LOADING = 1,
906
- LOADED = 2,
907
- STARTING = 3,
908
- STARTED = 4
909
- }
910
- }
@@ -15,12 +15,13 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  // eslint-disable-next-line @theia/runtime-import-check
18
+ import { interfaces } from '@theia/core/shared/inversify';
18
19
  import { DebugExtImpl } from '../../../plugin/debug/debug-ext';
19
- import { RPCProtocol } from '../../../common/rpc-protocol';
20
20
 
21
21
  /* eslint-disable @typescript-eslint/no-explicit-any */
22
- export function createDebugExtStub(rpc: RPCProtocol): DebugExtImpl {
23
- return new Proxy(new DebugExtImpl(rpc), {
22
+ export function createDebugExtStub(container: interfaces.Container): DebugExtImpl {
23
+ const delegate = container.get(DebugExtImpl);
24
+ return new Proxy(delegate, {
24
25
  apply: function (target, that, args): void {
25
26
  console.error('Debug API works only in plugin container');
26
27
  }
@@ -14,23 +14,24 @@
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
18
  import { EnvExtImpl } from '../../../plugin/env';
18
- import { RPCProtocol } from '../../../common/rpc-protocol';
19
19
 
20
20
  /**
21
21
  * Worker specific implementation not returning any FileSystem details
22
22
  * Extending the common class
23
23
  */
24
+ @injectable()
24
25
  export class WorkerEnvExtImpl extends EnvExtImpl {
25
26
 
26
- constructor(rpc: RPCProtocol) {
27
- super(rpc);
27
+ constructor() {
28
+ super();
28
29
  }
29
30
 
30
31
  /**
31
32
  * Throw error for app-root as there is no filesystem in worker context
32
33
  */
33
- get appRoot(): string {
34
+ override get appRoot(): string {
34
35
  throw new Error('There is no app root in worker context');
35
36
  }
36
37