@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
@@ -277,7 +277,7 @@ export class PluginContributionHandler {
277
277
  embeddedLanguages: this.convertEmbeddedLanguages(grammar.embeddedLanguages, logWarning),
278
278
  tokenTypes: this.convertTokenTypes(grammar.tokenTypes),
279
279
  balancedBracketSelectors: grammar.balancedBracketScopes ?? ['*'],
280
- unbalancedBracketSelectors: grammar.balancedBracketScopes,
280
+ unbalancedBracketSelectors: grammar.unbalancedBracketScopes ?? [],
281
281
  }));
282
282
  }
283
283
  // activate grammars only once everything else is loaded.
@@ -21,6 +21,7 @@ import { URI } from '@theia/core/shared/vscode-uri';
21
21
  import { MonacoIconRegistry } from '@theia/monaco/lib/browser/monaco-icon-registry';
22
22
  import * as path from 'path';
23
23
  import { IconContribution, DeployedPlugin, IconDefinition } from '../../common/plugin-protocol';
24
+ import { PLUGINS_BASE_PATH } from '@theia/plugin-utils/lib/common/constants';
24
25
 
25
26
  @injectable()
26
27
  export class PluginIconService implements Disposable {
@@ -68,7 +69,7 @@ export class PluginIconService implements Disposable {
68
69
 
69
70
  protected toPluginUrl(id: string, relativePath: string): URI {
70
71
  return URI.from(new Endpoint({
71
- path: `hostedPlugin/${this.formatExtensionId(id)}/${encodeURIComponent(relativePath)}`
72
+ path: `${PLUGINS_BASE_PATH}/${this.formatExtensionId(id)}/${encodeURIComponent(relativePath)}`
72
73
  }).getRestUrl().toComponents());
73
74
  }
74
75
 
@@ -25,6 +25,7 @@ import * as jsoncparser from 'jsonc-parser';
25
25
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
26
26
  import { IconThemeService, IconTheme, IconThemeDefinition } from '@theia/core/lib/browser/icon-theme-service';
27
27
  import { IconThemeContribution, DeployedPlugin, UiTheme, getPluginId } from '../../common/plugin-protocol';
28
+ import { PLUGINS_BASE_PATH } from '@theia/plugin-utils/lib/common/constants';
28
29
  import URI from '@theia/core/lib/common/uri';
29
30
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
30
31
  import { Emitter } from '@theia/core/lib/common/event';
@@ -363,7 +364,7 @@ export class PluginIconTheme extends PluginIconThemeDefinition implements IconTh
363
364
  const iconUri = this.locationUri.resolve(iconPath);
364
365
  const relativePath = this.packageRootUri.path.relative(iconUri.path.normalize());
365
366
  return relativePath && `url('${new Endpoint({
366
- path: `hostedPlugin/${this.pluginId}/${encodeURIComponent(relativePath.normalize().toString())}`
367
+ path: `${PLUGINS_BASE_PATH}/${this.pluginId}/${encodeURIComponent(relativePath.normalize().toString())}`
367
368
  }).getRestUrl().toString()}')`;
368
369
  }
369
370
 
@@ -21,6 +21,7 @@ import { Theme } from '@theia/core/lib/common/theme';
21
21
  import { IconUrl } from '../../common/plugin-protocol';
22
22
  import { Reference, SyncReferenceCollection } from '@theia/core/lib/common/reference';
23
23
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
24
+ import { PLUGINS_BASE_PATH } from '@theia/plugin-utils/lib/common/constants';
24
25
 
25
26
  export interface PluginIconKey {
26
27
  url: IconUrl;
@@ -145,7 +146,7 @@ export class PluginSharedStyle {
145
146
  }
146
147
 
147
148
  static toExternalIconUrl(iconUrl: string): string {
148
- if (iconUrl.startsWith('hostedPlugin/')) {
149
+ if (iconUrl.startsWith(`${PLUGINS_BASE_PATH}/`)) {
149
150
  return new Endpoint({ path: iconUrl }).getRestUrl().toString();
150
151
  }
151
152
  return iconUrl;
@@ -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,CAA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AI,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
- });