@theia/plugin-ext 1.75.0-next.21 → 1.75.0-next.28

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 (73) 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-protocol.d.ts +45 -648
  6. package/lib/common/plugin-protocol.d.ts.map +1 -1
  7. package/lib/common/plugin-protocol.js +11 -34
  8. package/lib/common/plugin-protocol.js.map +1 -1
  9. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  10. package/lib/hosted/browser/worker/plugin-manifest-loader.js +5 -36
  11. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  12. package/lib/hosted/browser/worker/worker-main.js +2 -1
  13. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  14. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  15. package/lib/hosted/node/hosted-plugin-localization-service.js +4 -68
  16. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  17. package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
  18. package/lib/hosted/node/plugin-host-rpc.js +2 -2
  19. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  20. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  21. package/lib/hosted/node/plugin-reader.js +4 -3
  22. package/lib/hosted/node/plugin-reader.js.map +1 -1
  23. package/lib/hosted/node/scanners/grammars-reader.d.ts +3 -2
  24. package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
  25. package/lib/hosted/node/scanners/grammars-reader.js +5 -23
  26. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  27. package/lib/hosted/node/scanners/scanner-theia.d.ts +38 -71
  28. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  29. package/lib/hosted/node/scanners/scanner-theia.js +117 -768
  30. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  31. package/lib/hosted/node/scanners/scanner-theia.spec.js +191 -0
  32. package/lib/hosted/node/scanners/scanner-theia.spec.js.map +1 -1
  33. package/lib/main/browser/plugin-contribution-handler.js +1 -1
  34. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  35. package/lib/main/browser/plugin-icon-service.d.ts.map +1 -1
  36. package/lib/main/browser/plugin-icon-service.js +2 -1
  37. package/lib/main/browser/plugin-icon-service.js.map +1 -1
  38. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  39. package/lib/main/browser/plugin-icon-theme-service.js +2 -1
  40. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  41. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  42. package/lib/main/browser/plugin-shared-style.js +2 -1
  43. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  44. package/package.json +31 -30
  45. package/src/common/errors.ts +1 -25
  46. package/src/common/plugin-protocol.ts +195 -662
  47. package/src/hosted/browser/worker/plugin-manifest-loader.ts +8 -41
  48. package/src/hosted/browser/worker/worker-main.ts +2 -1
  49. package/src/hosted/node/hosted-plugin-localization-service.ts +3 -82
  50. package/src/hosted/node/plugin-host-rpc.ts +3 -3
  51. package/src/hosted/node/plugin-reader.ts +4 -3
  52. package/src/hosted/node/scanners/grammars-reader.ts +14 -23
  53. package/src/hosted/node/scanners/scanner-theia.spec.ts +225 -1
  54. package/src/hosted/node/scanners/scanner-theia.ts +204 -881
  55. package/src/main/browser/plugin-contribution-handler.ts +1 -1
  56. package/src/main/browser/plugin-icon-service.ts +2 -1
  57. package/src/main/browser/plugin-icon-theme-service.ts +2 -1
  58. package/src/main/browser/plugin-shared-style.ts +2 -1
  59. package/lib/hosted/node/plugin-activation-events.d.ts +0 -7
  60. package/lib/hosted/node/plugin-activation-events.d.ts.map +0 -1
  61. package/lib/hosted/node/plugin-activation-events.js +0 -95
  62. package/lib/hosted/node/plugin-activation-events.js.map +0 -1
  63. package/lib/hosted/node/plugin-manifest-loader.d.ts +0 -3
  64. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +0 -1
  65. package/lib/hosted/node/plugin-manifest-loader.js +0 -34
  66. package/lib/hosted/node/plugin-manifest-loader.js.map +0 -1
  67. package/lib/main/node/errors.spec.d.ts +0 -2
  68. package/lib/main/node/errors.spec.d.ts.map +0 -1
  69. package/lib/main/node/errors.spec.js +0 -36
  70. package/lib/main/node/errors.spec.js.map +0 -1
  71. package/src/hosted/node/plugin-activation-events.ts +0 -112
  72. package/src/hosted/node/plugin-manifest-loader.ts +0 -32
  73. package/src/main/node/errors.spec.ts +0 -37
@@ -17,17 +17,113 @@ import { RpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
17
17
  import { RPCProtocol } from './rpc-protocol';
18
18
  import { Disposable } from '@theia/core/lib/common/disposable';
19
19
  import { LogPart, KeysToAnyValues, KeysToKeysToAnyValue } from './types';
20
- import { CharacterPair, CommentRule, PluginAPIFactory, Plugin, ThemeIcon } from './plugin-api-rpc';
20
+ import { PluginAPIFactory, Plugin } from './plugin-api-rpc';
21
21
  import { ExtPluginApi } from './plugin-ext-api-contribution';
22
- import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
23
22
  import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common';
24
23
  import { ColorDefinition } from '@theia/core/lib/common/color';
25
24
  import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
26
- import { PluginIdentifiers } from './plugin-identifiers';
27
- import { JSONObject } from '@theia/core/shared/@lumino/coreutils';
28
25
  import { PreferenceSchema } from '@theia/core';
26
+ import { PluginIdentifiers } from './plugin-identifiers';
27
+ import {
28
+ getPluginId,
29
+ toPluginUrl as toPluginUrlFromUtils
30
+ } from '@theia/plugin-utils/lib/common/plugin-model';
31
+ import {
32
+ PLUGIN_HOST_BACKEND,
33
+ PluginEntryPoint,
34
+ PluginLifecycle,
35
+ PluginManifest,
36
+ PluginMetadata,
37
+ PluginModel,
38
+ PluginPackageCapabilities,
39
+ PluginType,
40
+ DeployedPlugin as DeployedPluginBase,
41
+ } from '@theia/plugin-utils/lib/common/manifest-types';
42
+ import {
43
+ AutoClosingPair,
44
+ AutoClosingPairConditional,
45
+ CustomEditorPriority,
46
+ CustomEditorSelector,
47
+ EnterAction,
48
+ FoldingMarkers,
49
+ FoldingRules,
50
+ IndentationRules,
51
+ OnEnterRule,
52
+ PluginColorContribution,
53
+ PluginIconContribution,
54
+ PluginIconThemeContribution,
55
+ PluginJsonValidationContribution,
56
+ PluginManifestContribution,
57
+ PluginNotebookRendererContribution,
58
+ PluginPackageAuthenticationProvider,
59
+ PluginPackageCommand,
60
+ PluginPackageCustomEditor,
61
+ PluginPackageDebuggersContribution,
62
+ PluginPackageGrammarsContribution,
63
+ PluginPackageKeybinding,
64
+ PluginPackageLanguageContribution,
65
+ PluginPackageLanguageContributionConfiguration,
66
+ PluginPackageLanguageModelToolContribution,
67
+ PluginPackageLocalization,
68
+ PluginPackageMcpServerDefinitionProviderContribution,
69
+ PluginPackageMenu,
70
+ PluginPackageNotebook,
71
+ PluginPackageNotebookPreload,
72
+ PluginPackageSnippetsContribution,
73
+ PluginPackageSubmenu,
74
+ PluginPackageTerminal,
75
+ PluginPackageTerminalProfile,
76
+ PluginPackageTranslation,
77
+ PluginPackageView,
78
+ PluginPackageViewContainer,
79
+ PluginPackageViewWelcome,
80
+ PluginPackageWalkthrough,
81
+ PluginPackageWalkthroughStep,
82
+ PluginPackageWalkthroughStepMedia,
83
+ PluginTaskDefinitionContribution,
84
+ PluginThemeContribution,
85
+ PluginUiTheme,
86
+ PluginViewType,
87
+ PlatformSpecificAdapterContribution,
88
+ RegExpOptions,
89
+ ScopeMap,
90
+ type GrammarsContribution,
91
+ type IconUrl,
92
+ type JSONObject,
93
+ type NormalizedCommand,
94
+ type NormalizedCustomEditor,
95
+ type NormalizedIcon,
96
+ type NormalizedIconTheme,
97
+ type NormalizedKeybinding,
98
+ type NormalizedLanguage,
99
+ type NormalizedLanguageConfiguration,
100
+ type NormalizedLocalization,
101
+ type NormalizedPluginContribution,
102
+ type NormalizedSnippet,
103
+ type NormalizedSubmenu,
104
+ type NormalizedTerminalProfile,
105
+ type NormalizedTheme,
106
+ type NormalizedTranslation,
107
+ type NormalizedViewContainer,
108
+ type NormalizedViewWelcome,
109
+ type WalkthroughContribution,
110
+ type WalkthroughStepContribution,
111
+ type WalkthroughStepMedia,
112
+ } from '@theia/plugin-utils/lib/common/contribution-types';
29
113
 
30
114
  export { PluginIdentifiers };
115
+ export { getPluginId };
116
+ export { toPluginUrlFromUtils as toPluginUrl };
117
+ export {
118
+ PLUGIN_HOST_BACKEND,
119
+ PluginEntryPoint,
120
+ PluginLifecycle,
121
+ PluginManifest,
122
+ PluginModel,
123
+ PluginPackageCapabilities,
124
+ PluginMetadata,
125
+ PluginType
126
+ };
31
127
  export const hostedServicePath = '/services/hostedPlugin';
32
128
 
33
129
  /**
@@ -36,331 +132,85 @@ export const hostedServicePath = '/services/hostedPlugin';
36
132
  export type PluginEngine = string;
37
133
 
38
134
  /**
39
- * This interface describes a package.json object.
135
+ * Loaded plugin package with stricter fields used by `@theia/plugin-ext`.
40
136
  */
41
- export interface PluginPackage {
42
- name: string;
137
+ export interface PluginPackage extends PluginManifest {
43
138
  // The publisher is not guaranteed to be defined for unpublished plugins. https://github.com/microsoft/vscode-vsce/commit/a38657ece04c20e4fbde15d5ac1ed39ca51cb856
44
139
  publisher: string | undefined;
45
- version: string;
46
140
  engines: {
47
141
  [type in PluginEngine]: string;
48
142
  };
49
- theiaPlugin?: {
50
- frontend?: string;
51
- backend?: string;
52
- /* Requires the `@theia/plugin-ext-headless` extension. */
53
- headless?: string;
54
- };
55
- main?: string;
56
- browser?: string;
57
143
  displayName: string;
58
144
  description: string;
59
145
  contributes?: PluginPackageContribution;
60
- packagePath: string;
61
- activationEvents?: string[];
62
- extensionDependencies?: string[];
63
- extensionPack?: string[];
64
- l10n?: string;
65
- icon?: string;
66
- type?: 'module' | 'commonjs';
67
- extensionKind?: Array<'ui' | 'workspace'>;
68
- capabilities?: {
69
- untrustedWorkspaces?: {
70
- supported: boolean | 'limited';
71
- description?: string;
72
- restrictedConfigurations?: string[];
73
- };
74
- };
75
146
  }
76
147
  export namespace PluginPackage {
77
- export function toPluginUrl(pck: PluginPackage | PluginModel, relativePath: string): string {
78
- return `hostedPlugin/${getPluginId(pck)}/${encodeURIComponent(relativePath)}`;
79
- }
80
- }
148
+ export const toPluginUrl = toPluginUrlFromUtils;
149
+ }
150
+
151
+ export {
152
+ AutoClosingPair,
153
+ AutoClosingPairConditional,
154
+ CustomEditorPriority,
155
+ CustomEditorSelector,
156
+ EnterAction,
157
+ FoldingMarkers,
158
+ FoldingRules,
159
+ type GrammarsContribution,
160
+ IndentationRules,
161
+ OnEnterRule,
162
+ PluginColorContribution,
163
+ PluginIconContribution,
164
+ PluginIconThemeContribution,
165
+ PluginJsonValidationContribution,
166
+ PluginManifestContribution,
167
+ PluginNotebookRendererContribution,
168
+ PluginPackageAuthenticationProvider,
169
+ PluginPackageCommand,
170
+ PluginPackageCustomEditor,
171
+ PluginPackageDebuggersContribution,
172
+ PluginPackageGrammarsContribution,
173
+ PluginPackageKeybinding,
174
+ PluginPackageLanguageContribution,
175
+ PluginPackageLanguageContributionConfiguration,
176
+ PluginPackageLanguageModelToolContribution,
177
+ PluginPackageLocalization,
178
+ PluginPackageMcpServerDefinitionProviderContribution,
179
+ PluginPackageMenu,
180
+ PluginPackageNotebook,
181
+ PluginPackageNotebookPreload,
182
+ PluginPackageSnippetsContribution,
183
+ PluginPackageSubmenu,
184
+ PluginPackageTerminal,
185
+ PluginPackageTerminalProfile,
186
+ PluginPackageTranslation,
187
+ PluginPackageView,
188
+ PluginPackageViewContainer,
189
+ PluginPackageViewWelcome,
190
+ PluginPackageWalkthrough,
191
+ PluginPackageWalkthroughStep,
192
+ PluginPackageWalkthroughStepMedia,
193
+ PluginTaskDefinitionContribution,
194
+ PluginThemeContribution,
195
+ PluginUiTheme,
196
+ PluginViewType,
197
+ PlatformSpecificAdapterContribution,
198
+ RegExpOptions,
199
+ ScopeMap,
200
+ type IconUrl,
201
+ type JSONObject,
202
+ type WalkthroughContribution,
203
+ type WalkthroughStepContribution,
204
+ type WalkthroughStepMedia,
205
+ };
81
206
 
82
207
  /**
83
- * This interface describes a package.json contribution section object.
208
+ * Strict `contributes` typing for scanned plugin packages.
84
209
  */
85
- export interface PluginPackageContribution {
86
- authentication?: PluginPackageAuthenticationProvider[];
87
- configuration?: JSONObject | JSONObject[];
88
- configurationDefaults?: JSONObject;
89
- languages?: PluginPackageLanguageContribution[];
90
- grammars?: PluginPackageGrammarsContribution[];
91
- customEditors?: PluginPackageCustomEditor[];
92
- viewsContainers?: { [location: string]: PluginPackageViewContainer[] };
93
- views?: { [location: string]: PluginPackageView[] };
94
- viewsWelcome?: PluginPackageViewWelcome[];
95
- commands?: PluginPackageCommand | PluginPackageCommand[];
96
- menus?: { [location: string]: PluginPackageMenu[] };
97
- submenus?: PluginPackageSubmenu[];
98
- keybindings?: PluginPackageKeybinding | PluginPackageKeybinding[];
99
- debuggers?: PluginPackageDebuggersContribution[];
100
- snippets?: PluginPackageSnippetsContribution[];
101
- themes?: PluginThemeContribution[];
102
- iconThemes?: PluginIconThemeContribution[];
103
- icons?: PluginIconContribution[];
104
- colors?: PluginColorContribution[];
105
- taskDefinitions?: PluginTaskDefinitionContribution[];
210
+ export interface PluginPackageContribution extends PluginManifestContribution {
106
211
  problemMatchers?: PluginProblemMatcherContribution[];
107
212
  problemPatterns?: PluginProblemPatternContribution[];
108
- jsonValidation?: PluginJsonValidationContribution[];
109
213
  resourceLabelFormatters?: ResourceLabelFormatter[];
110
- localizations?: PluginPackageLocalization[];
111
- terminal?: PluginPackageTerminal;
112
- notebooks?: PluginPackageNotebook[];
113
- notebookRenderer?: PluginNotebookRendererContribution[];
114
- notebookPreload?: PluginPackageNotebookPreload[];
115
- mcpServerDefinitionProviders?: PluginPackageMcpServerDefinitionProviderContribution[];
116
- languageModelTools?: PluginPackageLanguageModelToolContribution[];
117
- }
118
-
119
- export interface PluginPackageNotebook {
120
- type: string;
121
- displayName: string;
122
- selector?: readonly { filenamePattern?: string; excludeFileNamePattern?: string }[];
123
- priority?: string;
124
- }
125
-
126
- export interface PluginNotebookRendererContribution {
127
- readonly id: string;
128
- readonly displayName: string;
129
- readonly mimeTypes: string[];
130
- readonly entrypoint: string | { readonly extends: string; readonly path: string };
131
- readonly requiresMessaging?: 'always' | 'optional' | 'never'
132
- }
133
-
134
- export interface PluginPackageNotebookPreload {
135
- type: string;
136
- entrypoint: string;
137
- }
138
-
139
- export interface PluginPackageMcpServerDefinitionProviderContribution {
140
- id: string;
141
- label: string;
142
- description?: string;
143
- }
144
-
145
- export interface PluginPackageLanguageModelToolContribution {
146
- name: string;
147
- modelDescription?: string;
148
- userDescription?: string;
149
- inputSchema?: object;
150
- tags?: string[];
151
- }
152
-
153
- export interface PluginPackageAuthenticationProvider {
154
- id: string;
155
- label: string;
156
- }
157
-
158
- export interface PluginPackageTerminalProfile {
159
- title: string;
160
- id: string;
161
- icon?: string;
162
- }
163
-
164
- export interface PluginPackageTerminal {
165
- profiles: PluginPackageTerminalProfile[];
166
- }
167
-
168
- export interface PluginPackageLocalization {
169
- languageId: string;
170
- languageName?: string;
171
- localizedLanguageName?: string;
172
- translations: PluginPackageTranslation[];
173
- minimalTranslations?: { [key: string]: string };
174
- }
175
-
176
- export interface PluginPackageTranslation {
177
- id: string;
178
- path: string;
179
- }
180
-
181
- export interface PluginPackageCustomEditor {
182
- viewType: string;
183
- displayName: string;
184
- selector?: CustomEditorSelector[];
185
- priority?: CustomEditorPriority;
186
- }
187
-
188
- export interface CustomEditorSelector {
189
- readonly filenamePattern?: string;
190
- }
191
-
192
- export enum CustomEditorPriority {
193
- default = 'default',
194
- builtin = 'builtin',
195
- option = 'option',
196
- }
197
-
198
- export interface PluginPackageViewContainer {
199
- id: string;
200
- title: string;
201
- icon: string;
202
- when?: string;
203
- }
204
-
205
- export enum PluginViewType {
206
- Tree = 'tree',
207
- Webview = 'webview'
208
- }
209
-
210
- export interface PluginPackageView {
211
- id: string;
212
- name: string;
213
- when?: string;
214
- type?: string;
215
- }
216
-
217
- export interface PluginPackageViewWelcome {
218
- view: string;
219
- contents: string;
220
- when?: string;
221
- enablement?: string;
222
- }
223
-
224
- export interface PluginPackageCommand {
225
- command: string;
226
- title: string;
227
- shortTitle?: string;
228
- original?: string;
229
- category?: string;
230
- icon?: string | { light: string; dark: string; };
231
- enablement?: string;
232
- }
233
-
234
- export interface PluginPackageMenu {
235
- command?: string;
236
- submenu?: string;
237
- alt?: string;
238
- group?: string;
239
- when?: string;
240
- }
241
-
242
- export interface PluginPackageSubmenu {
243
- id: string;
244
- label: string;
245
- icon: IconUrl;
246
- }
247
-
248
- export interface PluginPackageKeybinding {
249
- key?: string;
250
- command: string;
251
- when?: string;
252
- mac?: string;
253
- linux?: string;
254
- win?: string;
255
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
256
- args?: any;
257
- }
258
-
259
- export interface PluginPackageGrammarsContribution {
260
- language?: string;
261
- scopeName: string;
262
- path: string;
263
- embeddedLanguages?: ScopeMap;
264
- tokenTypes?: ScopeMap;
265
- injectTo?: string[];
266
- }
267
-
268
- export interface ScopeMap {
269
- [scopeName: string]: string;
270
- }
271
-
272
- export interface PluginPackageSnippetsContribution {
273
- language?: string;
274
- path?: string;
275
- }
276
-
277
- export interface PluginColorContribution {
278
- id?: string;
279
- description?: string;
280
- defaults?: { light?: string, dark?: string, highContrast?: string };
281
- }
282
-
283
- export type PluginUiTheme = 'vs' | 'vs-dark' | 'hc-black';
284
-
285
- export interface PluginThemeContribution {
286
- id?: string;
287
- label?: string;
288
- description?: string;
289
- path?: string;
290
- uiTheme?: PluginUiTheme;
291
- }
292
-
293
- export interface PluginIconThemeContribution {
294
- id?: string;
295
- label?: string;
296
- description?: string;
297
- path?: string;
298
- uiTheme?: PluginUiTheme;
299
- }
300
-
301
- export interface PluginIconContribution {
302
- [id: string]: {
303
- description: string;
304
- default: { fontPath: string; fontCharacter: string } | string;
305
- };
306
- }
307
-
308
- export interface PlatformSpecificAdapterContribution {
309
- program?: string;
310
- args?: string[];
311
- runtime?: string;
312
- runtimeArgs?: string[];
313
- }
314
-
315
- /**
316
- * This interface describes a package.json debuggers contribution section object.
317
- */
318
- export interface PluginPackageDebuggersContribution extends PlatformSpecificAdapterContribution {
319
- type: string;
320
- label?: string;
321
- languages?: string[];
322
- enableBreakpointsFor?: { languageIds: string[] };
323
- configurationAttributes: { [request: string]: IJSONSchema };
324
- configurationSnippets: IJSONSchemaSnippet[];
325
- variables?: ScopeMap;
326
- adapterExecutableCommand?: string;
327
- win?: PlatformSpecificAdapterContribution;
328
- winx86?: PlatformSpecificAdapterContribution;
329
- windows?: PlatformSpecificAdapterContribution;
330
- osx?: PlatformSpecificAdapterContribution;
331
- linux?: PlatformSpecificAdapterContribution;
332
- }
333
-
334
- /**
335
- * This interface describes a package.json languages contribution section object.
336
- */
337
- export interface PluginPackageLanguageContribution {
338
- id: string;
339
- extensions?: string[];
340
- filenames?: string[];
341
- filenamePatterns?: string[];
342
- firstLine?: string;
343
- aliases?: string[];
344
- mimetypes?: string[];
345
- configuration?: string;
346
- icon?: IconUrl;
347
- }
348
-
349
- export interface PluginPackageLanguageContributionConfiguration {
350
- comments?: CommentRule;
351
- brackets?: CharacterPair[];
352
- autoClosingPairs?: (CharacterPair | AutoClosingPairConditional)[];
353
- surroundingPairs?: (CharacterPair | AutoClosingPair)[];
354
- wordPattern?: string;
355
- indentationRules?: IndentationRules;
356
- folding?: FoldingRules;
357
- onEnterRules?: OnEnterRule[];
358
- }
359
-
360
- export interface PluginTaskDefinitionContribution {
361
- type: string;
362
- required: string[];
363
- properties?: IJSONSchema['properties'];
364
214
  }
365
215
 
366
216
  export interface PluginProblemMatcherContribution extends ProblemMatcherContribution {
@@ -371,11 +221,6 @@ export interface PluginProblemPatternContribution extends ProblemPatternContribu
371
221
  name: string;
372
222
  }
373
223
 
374
- export interface PluginJsonValidationContribution {
375
- fileMatch: string | string[];
376
- url: string;
377
- }
378
-
379
224
  export const PluginScanner = Symbol('PluginScanner');
380
225
  /**
381
226
  * This scanner process package.json object and returns plugin metadata objects.
@@ -485,14 +330,6 @@ export enum PluginDeployerEntryType {
485
330
  HEADLESS // Deployed in the Theia Node server outside the context of a frontend/backend connection
486
331
  }
487
332
 
488
- /**
489
- * Whether a plugin installed by a user or system.
490
- */
491
- export enum PluginType {
492
- System,
493
- User
494
- };
495
-
496
333
  export interface UnresolvedPluginEntry {
497
334
  id: string;
498
335
  type?: PluginType;
@@ -579,155 +416,47 @@ export interface PluginDeployerDirectoryHandlerContext {
579
416
  }
580
417
 
581
418
  /**
582
- * This interface describes a plugin model object, which is populated from package.json.
419
+ * Static plugin contributions after normalization.
420
+ * Narrows shim/`unknown` fields from {@link NormalizedPluginContribution} to core/task types.
583
421
  */
584
- export interface PluginModel {
585
- id: string;
586
- name: string;
587
- publisher: string;
588
- version: string;
589
- displayName: string;
590
- description: string;
591
- engine: {
592
- type: PluginEngine;
593
- version: string;
594
- };
595
- entryPoint: PluginEntryPoint;
596
- packageUri: string;
597
- /**
598
- * @deprecated since 1.1.0 - because it lead to problems with getting a relative path
599
- * needed by Icon Themes to correctly load Fonts, use packageUri instead.
600
- */
601
- packagePath: string;
602
- iconUrl?: string;
603
- l10n?: string;
604
- readmeUrl?: string;
605
- licenseUrl?: string;
606
- untrustedWorkspacesSupport?: boolean | 'limited';
607
- }
608
-
609
- export interface PluginEntryPoint {
610
- frontend?: string;
611
- backend?: string;
612
- headless?: string;
613
- }
614
-
615
- /**
616
- * This interface describes some static plugin contributions.
617
- */
618
- export interface PluginContribution {
619
- activationEvents?: string[];
620
- authentication?: AuthenticationProviderInformation[];
422
+ export type PluginContribution = Omit<NormalizedPluginContribution,
423
+ 'configuration' | 'colors' | 'taskDefinitions' | 'problemMatchers' | 'problemPatterns' | 'resourceLabelFormatters'
424
+ > & {
621
425
  configuration?: PreferenceSchema[];
622
- configurationDefaults?: JSONObject;
623
- languages?: LanguageContribution[];
624
- grammars?: GrammarsContribution[];
625
- customEditors?: CustomEditor[];
626
- viewsContainers?: { [location: string]: ViewContainer[] };
627
- views?: { [location: string]: View[] };
628
- viewsWelcome?: ViewWelcome[];
629
- commands?: PluginCommand[];
630
- menus?: { [location: string]: Menu[] };
631
- submenus?: Submenu[];
632
- keybindings?: Keybinding[];
633
- debuggers?: DebuggerContribution[];
634
- snippets?: SnippetContribution[];
635
- themes?: ThemeContribution[];
636
- iconThemes?: IconThemeContribution[];
637
- icons?: IconContribution[];
638
426
  colors?: ColorDefinition[];
639
427
  taskDefinitions?: TaskDefinition[];
640
428
  problemMatchers?: ProblemMatcherContribution[];
641
429
  problemPatterns?: ProblemPatternContribution[];
642
430
  resourceLabelFormatters?: ResourceLabelFormatter[];
643
- localizations?: Localization[];
644
- terminalProfiles?: TerminalProfile[];
645
- notebooks?: NotebookContribution[];
646
- notebookRenderer?: NotebookRendererContribution[];
647
- notebookPreload?: notebookPreloadContribution[];
648
- }
649
- export interface NotebookContribution {
650
- type: string;
651
- displayName: string;
652
- selector?: readonly { filenamePattern?: string; excludeFileNamePattern?: string }[];
653
- priority?: string;
654
- }
431
+ };
655
432
 
656
- export interface NotebookRendererContribution {
657
- readonly id: string;
658
- readonly displayName: string;
659
- readonly mimeTypes: string[];
660
- readonly entrypoint: string | { readonly extends: string; readonly path: string };
661
- readonly requiresMessaging?: 'always' | 'optional' | 'never'
662
- }
433
+ export type NotebookContribution = PluginPackageNotebook;
663
434
 
664
- export interface notebookPreloadContribution {
665
- type: string;
666
- entrypoint: string;
667
- }
435
+ export type NotebookRendererContribution = PluginNotebookRendererContribution;
668
436
 
669
- export interface AuthenticationProviderInformation {
670
- id: string;
671
- label: string;
672
- }
437
+ export type notebookPreloadContribution = PluginPackageNotebookPreload;
673
438
 
674
- export interface TerminalProfile {
675
- title: string,
676
- id: string,
677
- icon?: string
678
- }
439
+ export type AuthenticationProviderInformation = PluginPackageAuthenticationProvider;
679
440
 
680
- export interface Localization {
681
- languageId: string;
682
- languageName?: string;
683
- localizedLanguageName?: string;
684
- translations: Translation[];
685
- minimalTranslations?: { [key: string]: string };
686
- }
441
+ export type TerminalProfile = NormalizedTerminalProfile;
687
442
 
688
- export interface Translation {
689
- id: string;
690
- path: string;
691
- cachedContents?: { [scope: string]: { [key: string]: string } };
692
- }
443
+ export type Localization = NormalizedLocalization;
693
444
 
694
- export interface SnippetContribution {
695
- uri: string
696
- source: string
697
- language?: string
698
- }
445
+ export type Translation = NormalizedTranslation;
699
446
 
700
- export type UiTheme = 'vs' | 'vs-dark' | 'hc-black';
447
+ export type SnippetContribution = NormalizedSnippet;
701
448
 
702
- export interface ThemeContribution {
703
- id?: string;
704
- label?: string;
705
- description?: string;
706
- uri: string;
707
- uiTheme?: UiTheme;
708
- }
449
+ export type UiTheme = PluginUiTheme;
709
450
 
710
- export interface IconThemeContribution {
711
- id: string;
712
- label?: string;
713
- description?: string;
714
- uri: string;
715
- uiTheme?: UiTheme;
716
- }
451
+ export type ThemeContribution = NormalizedTheme;
717
452
 
718
- export interface IconDefinition {
719
- fontCharacter: string;
720
- location: string;
721
- }
453
+ export type IconThemeContribution = NormalizedIconTheme;
722
454
 
723
- export type IconDefaults = ThemeIcon | IconDefinition;
455
+ export type IconDefinition = Extract<NormalizedIcon['defaults'], { fontCharacter: string }>;
724
456
 
725
- export interface IconContribution {
726
- id: string;
727
- extensionId: string;
728
- description: string | undefined;
729
- defaults: IconDefaults;
730
- }
457
+ export type IconDefaults = NormalizedIcon['defaults'];
458
+
459
+ export type IconContribution = NormalizedIcon;
731
460
 
732
461
  export namespace IconContribution {
733
462
  export function isIconDefinition(defaults: IconDefaults): defaults is IconDefinition {
@@ -735,219 +464,48 @@ export namespace IconContribution {
735
464
  }
736
465
  }
737
466
 
738
- export interface GrammarsContribution {
739
- format: 'json' | 'plist';
740
- language?: string;
741
- scope: string;
742
- grammar?: string | object;
743
- grammarLocation?: string;
744
- embeddedLanguages?: ScopeMap;
745
- tokenTypes?: ScopeMap;
746
- injectTo?: string[];
747
- balancedBracketScopes?: string[];
748
- unbalancedBracketScopes?: string[];
749
- }
750
-
751
467
  /**
752
468
  * The language contribution
753
469
  */
754
- export interface LanguageContribution {
755
- id: string;
756
- extensions?: string[];
757
- filenames?: string[];
758
- filenamePatterns?: string[];
759
- firstLine?: string;
760
- aliases?: string[];
761
- mimetypes?: string[];
762
- configuration?: LanguageConfiguration;
763
- /**
764
- * @internal
765
- */
766
- icon?: IconUrl;
767
- }
768
-
769
- export interface RegExpOptions {
770
- pattern: string;
771
- flags?: string;
772
- }
773
-
774
- export interface LanguageConfiguration {
775
- brackets?: CharacterPair[];
776
- indentationRules?: IndentationRules;
777
- surroundingPairs?: AutoClosingPair[];
778
- autoClosingPairs?: AutoClosingPairConditional[];
779
- comments?: CommentRule;
780
- folding?: FoldingRules;
781
- wordPattern?: string | RegExpOptions;
782
- onEnterRules?: OnEnterRule[];
783
- }
784
-
785
- /**
786
- * This interface describes a package.json debuggers contribution section object.
787
- */
788
- export interface DebuggerContribution extends PlatformSpecificAdapterContribution {
789
- type: string,
790
- label?: string,
791
- languages?: string[],
792
- enableBreakpointsFor?: {
793
- languageIds: string[]
794
- },
795
- configurationAttributes?: {
796
- [request: string]: IJSONSchema
797
- },
798
- configurationSnippets?: IJSONSchemaSnippet[],
799
- variables?: ScopeMap,
800
- adapterExecutableCommand?: string
801
- win?: PlatformSpecificAdapterContribution;
802
- winx86?: PlatformSpecificAdapterContribution;
803
- windows?: PlatformSpecificAdapterContribution;
804
- osx?: PlatformSpecificAdapterContribution;
805
- linux?: PlatformSpecificAdapterContribution;
806
- }
470
+ export type LanguageContribution = NormalizedLanguage;
807
471
 
808
- export interface IndentationRules {
809
- increaseIndentPattern: string | RegExpOptions;
810
- decreaseIndentPattern: string | RegExpOptions;
811
- unIndentedLinePattern?: string | RegExpOptions;
812
- indentNextLinePattern?: string | RegExpOptions;
813
- }
814
- export interface AutoClosingPair {
815
- close: string;
816
- open: string;
817
- }
472
+ export type LanguageConfiguration = NormalizedLanguageConfiguration;
818
473
 
819
- export interface AutoClosingPairConditional extends AutoClosingPair {
820
- notIn?: string[];
821
- }
822
-
823
- export interface FoldingMarkers {
824
- start: string | RegExpOptions;
825
- end: string | RegExpOptions;
826
- }
827
-
828
- export interface FoldingRules {
829
- offSide?: boolean;
830
- markers?: FoldingMarkers;
831
- }
832
-
833
- export interface OnEnterRule {
834
- beforeText: string | RegExpOptions;
835
- afterText?: string | RegExpOptions;
836
- previousLineText?: string | RegExpOptions;
837
- action: EnterAction;
838
- }
839
-
840
- export interface EnterAction {
841
- indent: 'none' | 'indent' | 'outdent' | 'indentOutdent';
842
- appendText?: string;
843
- removeText?: number;
844
- }
474
+ export type DebuggerContribution = PluginPackageDebuggersContribution;
845
475
 
846
476
  /**
847
477
  * Custom Editors contribution
848
478
  */
849
- export interface CustomEditor {
850
- viewType: string;
851
- displayName: string;
852
- selector: CustomEditorSelector[];
853
- priority: CustomEditorPriority;
854
- }
479
+ export type CustomEditor = NormalizedCustomEditor;
855
480
 
856
481
  /**
857
482
  * Views Containers contribution
858
483
  */
859
- export interface ViewContainer {
860
- id: string;
861
- title: string;
862
- iconUrl: string;
863
- themeIcon?: string;
864
- when?: string;
865
- }
484
+ export type ViewContainer = NormalizedViewContainer;
866
485
 
867
486
  /**
868
487
  * View contribution
869
488
  */
870
- export interface View {
871
- id: string;
872
- name: string;
873
- when?: string;
874
- type?: string;
875
- }
489
+ export type View = PluginPackageView;
876
490
 
877
491
  /**
878
492
  * View Welcome contribution
879
493
  */
880
- export interface ViewWelcome {
881
- view: string;
882
- content: string;
883
- when?: string;
884
- enablement?: string;
885
- order: number;
886
- }
887
-
888
- export interface PluginCommand {
889
- command: string;
890
- title: string;
891
- shortTitle?: string;
892
- originalTitle?: string;
893
- category?: string;
894
- iconUrl?: IconUrl;
895
- themeIcon?: string;
896
- enablement?: string;
897
- }
494
+ export type ViewWelcome = NormalizedViewWelcome;
898
495
 
899
- export type IconUrl = string | { light: string; dark: string; };
496
+ export type PluginCommand = NormalizedCommand;
900
497
 
901
498
  /**
902
499
  * Menu contribution
903
500
  */
904
- export interface Menu {
905
- command?: string;
906
- submenu?: string
907
- alt?: string;
908
- group?: string;
909
- when?: string;
910
- }
501
+ export type Menu = PluginPackageMenu;
911
502
 
912
- export interface Submenu {
913
- id: string;
914
- label: string;
915
- icon?: IconUrl;
916
- }
503
+ export type Submenu = NormalizedSubmenu;
917
504
 
918
505
  /**
919
506
  * Keybinding contribution
920
507
  */
921
- export interface Keybinding {
922
- keybinding?: string;
923
- command: string;
924
- when?: string;
925
- mac?: string;
926
- linux?: string;
927
- win?: string;
928
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
929
- args?: any;
930
- }
931
-
932
- /**
933
- * This interface describes a plugin lifecycle object.
934
- */
935
- export interface PluginLifecycle {
936
- startMethod: string;
937
- stopMethod: string;
938
- /**
939
- * Frontend module name, frontend plugin should expose this name.
940
- */
941
- frontendModuleName?: string;
942
- /**
943
- * Path to the script which should do some initialization before frontend plugin is loaded.
944
- */
945
- frontendInitPath?: string;
946
- /**
947
- * Path to the script which should do some initialization before backend plugin is loaded.
948
- */
949
- backendInitPath?: string;
950
- }
508
+ export type Keybinding = NormalizedKeybinding;
951
509
 
952
510
  /**
953
511
  * The export function of initialization module of backend plugin.
@@ -968,27 +526,11 @@ export interface ExtensionContext {
968
526
  subscriptions: Disposable[];
969
527
  }
970
528
 
971
- export interface PluginMetadata {
972
- host: string;
973
- model: PluginModel;
974
- lifecycle: PluginLifecycle;
975
- isUnderDevelopment?: boolean;
976
- outOfSync: boolean;
977
- }
978
-
979
529
  export const MetadataProcessor = Symbol('MetadataProcessor');
980
530
  export interface MetadataProcessor {
981
531
  process(pluginMetadata: PluginMetadata): void;
982
532
  }
983
533
 
984
- export function getPluginId(plugin: PluginPackage | PluginModel): string {
985
- return `${plugin.publisher}_${plugin.name}`.replace(/\W/g, '_');
986
- }
987
-
988
- export function buildFrontendModuleName(plugin: PluginPackage | PluginModel): string {
989
- return `${plugin.publisher}_${plugin.name}`.replace(/\W/g, '_');
990
- }
991
-
992
534
  export const HostedPluginClient = Symbol('HostedPluginClient');
993
535
  export interface HostedPluginClient {
994
536
  postMessage(pluginHost: string, buffer: Uint8Array): Promise<void>;
@@ -1049,14 +591,7 @@ export interface PluginDeployerHandler {
1049
591
 
1050
592
  }
1051
593
 
1052
- export interface DeployedPlugin {
1053
- /**
1054
- * defaults to system
1055
- */
1056
- type?: PluginType;
1057
- metadata: PluginMetadata;
1058
- contributes?: PluginContribution;
1059
- }
594
+ export type DeployedPlugin = DeployedPluginBase<PluginContribution>;
1060
595
 
1061
596
  export const HostedPluginServer = Symbol('HostedPluginServer');
1062
597
  export interface HostedPluginServer extends RpcServer<HostedPluginClient> {
@@ -1077,8 +612,6 @@ export interface HostedPluginServer extends RpcServer<HostedPluginClient> {
1077
612
 
1078
613
  }
1079
614
 
1080
- export const PLUGIN_HOST_BACKEND = 'main';
1081
-
1082
615
  export interface WorkspaceStorageKind {
1083
616
  workspace?: string | undefined;
1084
617
  roots: string[];