@theia/plugin-ext-vscode 1.23.0-next.37 → 1.23.0-next.42

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.
@@ -0,0 +1,18 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ declare const _scope: any;
17
+ declare const _getModule: () => any;
18
+ //# sourceMappingURL=plugin-vscode-init-fe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-vscode-init-fe.d.ts","sourceRoot":"","sources":["../../../src/node/context/plugin-vscode-init-fe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,QAAA,MAAM,MAAM,KAAgB,CAAC;AAG7B,QAAA,MAAM,UAAU,WAKf,CAAC"}
@@ -0,0 +1,38 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ const _scope = this;
18
+ _scope.exports = {};
19
+ const _getModule = () => {
20
+ if (!_scope[_scope.frontendModuleName]) {
21
+ _scope[_scope.frontendModuleName] = {};
22
+ }
23
+ return _scope[_scope.frontendModuleName];
24
+ };
25
+ Object.defineProperty(_scope.exports, 'activate', {
26
+ set: value => _getModule().activate = value
27
+ });
28
+ Object.defineProperty(_scope.exports, 'deactivate', {
29
+ set: value => _getModule().deactivate = value
30
+ });
31
+ _scope.require = (moduleName) => {
32
+ const vscodeModuleName = 'vscode';
33
+ if (moduleName === vscodeModuleName) {
34
+ // Return the defaultApi
35
+ return _scope.theia._empty;
36
+ }
37
+ };
38
+ //# sourceMappingURL=plugin-vscode-init-fe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-vscode-init-fe.js","sourceRoot":"","sources":["../../../src/node/context/plugin-vscode-init-fe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,8DAA8D;AAC9D,MAAM,MAAM,GAAI,IAAY,CAAC;AAC7B,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;AAEpB,MAAM,UAAU,GAAG,GAAG,EAAE;IACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;QACpC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC;KAC1C;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE;IAC9C,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,GAAG,KAAK;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE;IAChD,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,UAAU,GAAG,KAAK;CAChD,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,GAAG,CAAC,UAAkB,EAAE,EAAE;IACpC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAElC,IAAI,UAAU,KAAK,gBAAgB,EAAE;QACjC,wBAAwB;QACxB,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;KAC9B;AACL,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ /// <reference types="express" />
17
+ import { Application } from '@theia/core/shared/express';
18
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
19
+ export declare class HostedPluginReader implements BackendApplicationContribution {
20
+ configure(app: Application): void;
21
+ }
22
+ //# sourceMappingURL=plugin-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-reader.d.ts","sourceRoot":"","sources":["../../src/node/plugin-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;;AAIlF,OAAO,EAAE,WAAW,EAA2B,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAE1F,qBACa,kBAAmB,YAAW,8BAA8B;IAErE,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;CAGpC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.HostedPluginReader = void 0;
25
+ const path = require("path");
26
+ const inversify_1 = require("@theia/core/shared/inversify");
27
+ const express_1 = require("@theia/core/shared/express");
28
+ let HostedPluginReader = class HostedPluginReader {
29
+ configure(app) {
30
+ app.use('/context', (0, express_1.static)(path.join(__dirname, 'context')));
31
+ }
32
+ };
33
+ HostedPluginReader = __decorate([
34
+ (0, inversify_1.injectable)()
35
+ ], HostedPluginReader);
36
+ exports.HostedPluginReader = HostedPluginReader;
37
+ //# sourceMappingURL=plugin-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-reader.js","sourceRoot":"","sources":["../../src/node/plugin-reader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,6BAA6B;AAC7B,4DAA0D;AAC1D,wDAAkF;AAIlF,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAE3B,SAAS,CAAC,GAAgB;QACtB,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,IAAA,gBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AALY,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAK9B;AALY,gDAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-vscode-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-backend-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAa/D,wBAaG"}
1
+ {"version":3,"file":"plugin-vscode-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/plugin-vscode-backend-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAc/D,wBAgBG"}
@@ -25,6 +25,7 @@ const node_1 = require("@theia/core/lib/node");
25
25
  const common_1 = require("@theia/plugin-ext/lib/common");
26
26
  const plugin_vscode_environment_1 = require("../common/plugin-vscode-environment");
27
27
  const plugin_vscode_deployer_participant_1 = require("./plugin-vscode-deployer-participant");
28
+ const plugin_reader_1 = require("./plugin-reader");
28
29
  exports.default = new inversify_1.ContainerModule(bind => {
29
30
  bind(plugin_vscode_environment_1.PluginVSCodeEnvironment).toSelf().inSingletonScope();
30
31
  bind(plugin_vscode_deployer_participant_1.PluginVSCodeDeployerParticipant).toSelf().inSingletonScope();
@@ -35,5 +36,7 @@ exports.default = new inversify_1.ContainerModule(bind => {
35
36
  bind(plugin_vscode_cli_contribution_1.PluginVsCodeCliContribution).toSelf().inSingletonScope();
36
37
  bind(node_1.CliContribution).toService(plugin_vscode_cli_contribution_1.PluginVsCodeCliContribution);
37
38
  bind(common_1.PluginHostEnvironmentVariable).toService(plugin_vscode_cli_contribution_1.PluginVsCodeCliContribution);
39
+ bind(plugin_reader_1.HostedPluginReader).toSelf().inSingletonScope();
40
+ bind(node_1.BackendApplicationContribution).toService(plugin_reader_1.HostedPluginReader);
38
41
  });
39
42
  //# sourceMappingURL=plugin-vscode-backend-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-vscode-backend-module.js","sourceRoot":"","sources":["../../src/node/plugin-vscode-backend-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,4DAA+D;AAC/D,kDAE2B;AAC3B,6EAAuE;AACvE,uFAAiF;AACjF,qDAAuD;AACvD,qFAA+E;AAC/E,+CAAuD;AACvD,yDAA6E;AAC7E,mFAA8E;AAC9E,6FAAuF;AAEvF,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,mDAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE1D,IAAI,CAAC,oEAA+B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAClE,IAAI,CAAC,sCAAyB,CAAC,CAAC,SAAS,CAAC,oEAA+B,CAAC,CAAC;IAE3E,IAAI,CAAC,sCAAyB,CAAC,CAAC,EAAE,CAAC,oDAAuB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/E,IAAI,CAAC,2CAA8B,CAAC,CAAC,EAAE,CAAC,8DAA4B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACzF,IAAI,CAAC,0BAAa,CAAC,CAAC,EAAE,CAAC,oCAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAE/D,IAAI,CAAC,4DAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,sBAA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B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAI,CAAC,qCAA8B,CAAC,CAAC,SAAS,CAAC,kCAAkB,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scanner-vscode.d.ts","sourceRoot":"","sources":["../../src/node/scanner-vscode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAIlF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAE9F,qBACa,mBAAoB,SAAQ,kBAAmB,YAAW,aAAa;IAEhF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+B;IAE7D,IAAa,OAAO,IAAI,YAAY,CAEnC;IAEQ,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW;IA2BrD;;OAEG;IACM,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IAiBvE,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe;CAShE"}
1
+ {"version":3,"file":"scanner-vscode.d.ts","sourceRoot":"","sources":["../../src/node/scanner-vscode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAIlF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAqD,MAAM,mBAAmB,CAAC;AAChK,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAK9F,qBACa,mBAAoB,SAAQ,kBAAmB,YAAW,aAAa;IAEhF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+B;IAE7D,IAAa,OAAO,IAAI,YAAY,CAEnC;IAEQ,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW;IA0CrD;;OAEG;IACM,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IAiBvE,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe;CAWhE"}
@@ -26,6 +26,8 @@ const path = require("path");
26
26
  const inversify_1 = require("@theia/core/shared/inversify");
27
27
  const plugin_ext_1 = require("@theia/plugin-ext");
28
28
  const scanner_theia_1 = require("@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia");
29
+ const environment_1 = require("@theia/core/shared/@theia/application-package/lib/environment");
30
+ const uiKind = environment_1.environment.electron.is() ? plugin_ext_1.UIKind.Desktop : plugin_ext_1.UIKind.Web;
29
31
  let VsCodePluginScanner = class VsCodePluginScanner extends scanner_theia_1.TheiaPluginScanner {
30
32
  constructor() {
31
33
  super(...arguments);
@@ -36,8 +38,23 @@ let VsCodePluginScanner = class VsCodePluginScanner extends scanner_theia_1.Thei
36
38
  return this.VSCODE_TYPE;
37
39
  }
38
40
  getModel(plugin) {
41
+ var _a;
39
42
  // publisher can be empty on vscode extension development
40
43
  const publisher = plugin.publisher || '';
44
+ // Only one entrypoint is valid in vscode extensions
45
+ // Mimic choosing frontend (web extension) and backend (local/remote extension) as described here:
46
+ // https://code.visualstudio.com/api/advanced-topics/extension-host#preferred-extension-location
47
+ const entryPoint = {};
48
+ // Act like codespaces when run in the browser (UIKind === 'web' and extensionKind is ['ui'])
49
+ const preferFrontend = uiKind === plugin_ext_1.UIKind.Web && (((_a = plugin.extensionKind) === null || _a === void 0 ? void 0 : _a.length) === 1 && plugin.extensionKind[0] === 'ui');
50
+ if (plugin.browser && (!plugin.main || preferFrontend)) {
51
+ // Use frontend if available and there is no backend or frontend is preferred
52
+ entryPoint.frontend = plugin.browser;
53
+ }
54
+ else {
55
+ // Default to using backend
56
+ entryPoint.backend = plugin.main;
57
+ }
41
58
  const result = {
42
59
  packagePath: plugin.packagePath,
43
60
  packageUri: this.pluginUriFactory.createUri(plugin).toString(),
@@ -52,9 +69,7 @@ let VsCodePluginScanner = class VsCodePluginScanner extends scanner_theia_1.Thei
52
69
  type: this.VSCODE_TYPE,
53
70
  version: plugin.engines[this.VSCODE_TYPE]
54
71
  },
55
- entryPoint: {
56
- backend: plugin.main
57
- },
72
+ entryPoint,
58
73
  iconUrl: plugin.icon && plugin_ext_1.PluginPackage.toPluginUrl(plugin, plugin.icon),
59
74
  readmeUrl: plugin_ext_1.PluginPackage.toPluginUrl(plugin, './README.md'),
60
75
  licenseUrl: plugin_ext_1.PluginPackage.toPluginUrl(plugin, './LICENSE')
@@ -84,6 +99,8 @@ let VsCodePluginScanner = class VsCodePluginScanner extends scanner_theia_1.Thei
84
99
  return {
85
100
  startMethod: 'activate',
86
101
  stopMethod: 'deactivate',
102
+ frontendModuleName: (0, plugin_ext_1.buildFrontendModuleName)(plugin),
103
+ frontendInitPath: 'plugin-vscode-init-fe.js',
87
104
  backendInitPath: path.join(__dirname, 'plugin-vscode-init'),
88
105
  };
89
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scanner-vscode.js","sourceRoot":"","sources":["../../src/node/scanner-vscode.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,6BAA6B;AAC7B,4DAA0D;AAC1D,kDAA6G;AAC7G,4FAA8F;AAG9F,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,kCAAkB;IAA3D;;QAEqB,gBAAW,GAAiB,QAAQ,CAAC;QACrC,kBAAa,GAAW,mBAAmB,CAAC;IA8DjE,CAAC;IA5DG,IAAa,OAAO;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEQ,QAAQ,CAAC,MAAqB;QACnC,yDAAyD;QACzD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC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next.37+924eda35a04",
3
+ "version": "1.23.0-next.42+e8131aa835c",
4
4
  "description": "Theia - Plugin Extension for VsCode",
5
5
  "dependencies": {
6
- "@theia/callhierarchy": "1.23.0-next.37+924eda35a04",
7
- "@theia/core": "1.23.0-next.37+924eda35a04",
8
- "@theia/editor": "1.23.0-next.37+924eda35a04",
9
- "@theia/filesystem": "1.23.0-next.37+924eda35a04",
10
- "@theia/monaco": "1.23.0-next.37+924eda35a04",
11
- "@theia/navigator": "1.23.0-next.37+924eda35a04",
12
- "@theia/plugin": "1.23.0-next.37+924eda35a04",
13
- "@theia/plugin-ext": "1.23.0-next.37+924eda35a04",
14
- "@theia/terminal": "1.23.0-next.37+924eda35a04",
15
- "@theia/userstorage": "1.23.0-next.37+924eda35a04",
16
- "@theia/workspace": "1.23.0-next.37+924eda35a04",
6
+ "@theia/callhierarchy": "1.23.0-next.42+e8131aa835c",
7
+ "@theia/core": "1.23.0-next.42+e8131aa835c",
8
+ "@theia/editor": "1.23.0-next.42+e8131aa835c",
9
+ "@theia/filesystem": "1.23.0-next.42+e8131aa835c",
10
+ "@theia/monaco": "1.23.0-next.42+e8131aa835c",
11
+ "@theia/navigator": "1.23.0-next.42+e8131aa835c",
12
+ "@theia/plugin": "1.23.0-next.42+e8131aa835c",
13
+ "@theia/plugin-ext": "1.23.0-next.42+e8131aa835c",
14
+ "@theia/terminal": "1.23.0-next.42+e8131aa835c",
15
+ "@theia/userstorage": "1.23.0-next.42+e8131aa835c",
16
+ "@theia/workspace": "1.23.0-next.42+e8131aa835c",
17
17
  "@types/request": "^2.0.3",
18
18
  "filenamify": "^4.1.0",
19
19
  "request": "^2.82.0"
@@ -57,5 +57,5 @@
57
57
  "nyc": {
58
58
  "extends": "../../configs/nyc.json"
59
59
  },
60
- "gitHead": "924eda35a04954244677dc950b469e862ed35fe6"
60
+ "gitHead": "e8131aa835ca5a8d6ad3cfdb9f12b1a05357e2bd"
61
61
  }
@@ -0,0 +1,43 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ const _scope = (this as any);
19
+ _scope.exports = {};
20
+
21
+ const _getModule = () => {
22
+ if (!_scope[_scope.frontendModuleName]) {
23
+ _scope[_scope.frontendModuleName] = {};
24
+ }
25
+ return _scope[_scope.frontendModuleName];
26
+ };
27
+
28
+ Object.defineProperty(_scope.exports, 'activate', {
29
+ set: value => _getModule().activate = value
30
+ });
31
+
32
+ Object.defineProperty(_scope.exports, 'deactivate', {
33
+ set: value => _getModule().deactivate = value
34
+ });
35
+
36
+ _scope.require = (moduleName: string) => {
37
+ const vscodeModuleName = 'vscode';
38
+
39
+ if (moduleName === vscodeModuleName) {
40
+ // Return the defaultApi
41
+ return _scope.theia._empty;
42
+ }
43
+ };
@@ -0,0 +1,28 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2022 Arm 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import * as path from 'path';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { Application, static as ExpressStatic } from '@theia/core/shared/express';
20
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
21
+
22
+ @injectable()
23
+ export class HostedPluginReader implements BackendApplicationContribution {
24
+
25
+ configure(app: Application): void {
26
+ app.use('/context', ExpressStatic(path.join(__dirname, 'context')));
27
+ }
28
+ }
@@ -22,10 +22,11 @@ import { PluginVsCodeFileHandler } from './plugin-vscode-file-handler';
22
22
  import { PluginVsCodeDirectoryHandler } from './plugin-vscode-directory-handler';
23
23
  import { VsCodePluginScanner } from './scanner-vscode';
24
24
  import { PluginVsCodeCliContribution } from './plugin-vscode-cli-contribution';
25
- import { CliContribution } from '@theia/core/lib/node';
25
+ import { BackendApplicationContribution, CliContribution } from '@theia/core/lib/node';
26
26
  import { PluginHostEnvironmentVariable } from '@theia/plugin-ext/lib/common';
27
27
  import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
28
28
  import { PluginVSCodeDeployerParticipant } from './plugin-vscode-deployer-participant';
29
+ import { HostedPluginReader } from './plugin-reader';
29
30
 
30
31
  export default new ContainerModule(bind => {
31
32
  bind(PluginVSCodeEnvironment).toSelf().inSingletonScope();
@@ -40,4 +41,7 @@ export default new ContainerModule(bind => {
40
41
  bind(PluginVsCodeCliContribution).toSelf().inSingletonScope();
41
42
  bind(CliContribution).toService(PluginVsCodeCliContribution);
42
43
  bind(PluginHostEnvironmentVariable).toService(PluginVsCodeCliContribution);
44
+
45
+ bind(HostedPluginReader).toSelf().inSingletonScope();
46
+ bind(BackendApplicationContribution).toService(HostedPluginReader);
43
47
  });
@@ -16,8 +16,11 @@
16
16
 
17
17
  import * as path from 'path';
18
18
  import { injectable } from '@theia/core/shared/inversify';
19
- import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle } from '@theia/plugin-ext';
19
+ import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle, PluginEntryPoint, buildFrontendModuleName, UIKind } from '@theia/plugin-ext';
20
20
  import { TheiaPluginScanner } from '@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia';
21
+ import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
22
+
23
+ const uiKind = environment.electron.is() ? UIKind.Desktop : UIKind.Web;
21
24
 
22
25
  @injectable()
23
26
  export class VsCodePluginScanner extends TheiaPluginScanner implements PluginScanner {
@@ -32,6 +35,23 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
32
35
  override getModel(plugin: PluginPackage): PluginModel {
33
36
  // publisher can be empty on vscode extension development
34
37
  const publisher = plugin.publisher || '';
38
+
39
+ // Only one entrypoint is valid in vscode extensions
40
+ // Mimic choosing frontend (web extension) and backend (local/remote extension) as described here:
41
+ // https://code.visualstudio.com/api/advanced-topics/extension-host#preferred-extension-location
42
+ const entryPoint: PluginEntryPoint = {};
43
+
44
+ // Act like codespaces when run in the browser (UIKind === 'web' and extensionKind is ['ui'])
45
+ const preferFrontend = uiKind === UIKind.Web && (plugin.extensionKind?.length === 1 && plugin.extensionKind[0] === 'ui');
46
+
47
+ if (plugin.browser && (!plugin.main || preferFrontend)) {
48
+ // Use frontend if available and there is no backend or frontend is preferred
49
+ entryPoint.frontend = plugin.browser;
50
+ } else {
51
+ // Default to using backend
52
+ entryPoint.backend = plugin.main;
53
+ }
54
+
35
55
  const result: PluginModel = {
36
56
  packagePath: plugin.packagePath,
37
57
  packageUri: this.pluginUriFactory.createUri(plugin).toString(),
@@ -46,9 +66,7 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
46
66
  type: this.VSCODE_TYPE,
47
67
  version: plugin.engines[this.VSCODE_TYPE]
48
68
  },
49
- entryPoint: {
50
- backend: plugin.main
51
- },
69
+ entryPoint,
52
70
  iconUrl: plugin.icon && PluginPackage.toPluginUrl(plugin, plugin.icon),
53
71
  readmeUrl: PluginPackage.toPluginUrl(plugin, './README.md'),
54
72
  licenseUrl: PluginPackage.toPluginUrl(plugin, './LICENSE')
@@ -80,7 +98,9 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
80
98
  return {
81
99
  startMethod: 'activate',
82
100
  stopMethod: 'deactivate',
101
+ frontendModuleName: buildFrontendModuleName(plugin),
83
102
 
103
+ frontendInitPath: 'plugin-vscode-init-fe.js',
84
104
  backendInitPath: path.join(__dirname, 'plugin-vscode-init'),
85
105
  };
86
106
  }