@theia/application-manager 1.17.0-next.ff9e0507 → 1.18.0-next.05f289b3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"expose-loader.js","sourceRoot":"","sources":["../src/expose-loader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;AAElF,6BAA+B;AAC/B,2BAA6B;AAG7B,0FAAwF;AAExF,IAAM,cAAc,GAAqC,EAAE,CAAC;;IAC5D,KAA+B,IAAA,KAAA,SAAA,IAAI,wCAAkB,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAA,gBAAA,4BAAE;QAApG,IAAM,gBAAgB,WAAA;QACvB,cAAc,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAU,CAAC,WAAW,CAAC;SACjE,CAAC,CAAC;KACN;;;;;;;;;AAED,SAAS,YAAY,CAAC,aAA6C,EAAE,YAAoB,EAAE,MAAc;IACrG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE;QACrB,OAAO,MAAM,CAAC;KACjB;IACK,IAAA,KAAgB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAtC,GAAG,SAAA,EAAE,IAAI,UAA6B,CAAC;IAC/C,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,IAAI,IAAI,KAAK,OAAO,EAAE;QAClB,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;KAC5C;IACD,IAAI,IAAI,CAAC,GAAG,KAAK,GAA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C,CAAC,KAAK,eAAe,EAAE;YAClD,IAAI;gBACA,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;gBACjE,aAAa,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;gBAC9B,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACnC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;gBAC5F,OAAO;aACV;YAAC,WAAM;gBACJ,YAAY;aACf;SACJ;KACJ;IACD,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC,CAAC"}
@@ -14,108 +14,56 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
17
  Object.defineProperty(exports, "__esModule", { value: true });
54
18
  exports.AbstractGenerator = void 0;
55
- var os = require("os");
56
- var fs = require("fs-extra");
57
- var AbstractGenerator = /** @class */ (function () {
58
- function AbstractGenerator(pck, options) {
59
- if (options === void 0) { options = {}; }
19
+ const os = require("os");
20
+ const fs = require("fs-extra");
21
+ class AbstractGenerator {
22
+ constructor(pck, options = {}) {
60
23
  this.pck = pck;
61
24
  this.options = options;
62
25
  }
63
- AbstractGenerator.prototype.compileFrontendModuleImports = function (modules) {
26
+ compileFrontendModuleImports(modules) {
64
27
  var _a;
65
- var splitFrontend = (_a = this.options.splitFrontend) !== null && _a !== void 0 ? _a : this.options.mode !== 'production';
28
+ const splitFrontend = (_a = this.options.splitFrontend) !== null && _a !== void 0 ? _a : this.options.mode !== 'production';
66
29
  return this.compileModuleImports(modules, splitFrontend ? 'import' : 'require');
67
- };
68
- AbstractGenerator.prototype.compileBackendModuleImports = function (modules) {
30
+ }
31
+ compileBackendModuleImports(modules) {
69
32
  return this.compileModuleImports(modules, 'require');
70
- };
71
- AbstractGenerator.prototype.compileElectronMainModuleImports = function (modules) {
33
+ }
34
+ compileElectronMainModuleImports(modules) {
72
35
  return modules && this.compileModuleImports(modules, 'require') || '';
73
- };
74
- AbstractGenerator.prototype.compileModuleImports = function (modules, fn) {
36
+ }
37
+ compileModuleImports(modules, fn) {
75
38
  if (modules.size === 0) {
76
39
  return '';
77
40
  }
78
- var lines = Array.from(modules.keys()).map(function (moduleName) {
79
- var invocation = fn + "('" + modules.get(moduleName) + "')";
41
+ const lines = Array.from(modules.keys()).map(moduleName => {
42
+ const invocation = `${fn}('${modules.get(moduleName)}')`;
80
43
  if (fn === 'require') {
81
- return "Promise.resolve(" + invocation + ")";
44
+ return `Promise.resolve(${invocation})`;
82
45
  }
83
46
  return invocation;
84
- }).map(function (statement) { return " .then(function () { return " + statement + ".then(load) })"; });
47
+ }).map(statement => ` .then(function () { return ${statement}.then(load) })`);
85
48
  return os.EOL + lines.join(os.EOL);
86
- };
87
- AbstractGenerator.prototype.ifBrowser = function (value, defaultValue) {
88
- if (defaultValue === void 0) { defaultValue = ''; }
49
+ }
50
+ ifBrowser(value, defaultValue = '') {
89
51
  return this.pck.ifBrowser(value, defaultValue);
90
- };
91
- AbstractGenerator.prototype.ifElectron = function (value, defaultValue) {
92
- if (defaultValue === void 0) { defaultValue = ''; }
52
+ }
53
+ ifElectron(value, defaultValue = '') {
93
54
  return this.pck.ifElectron(value, defaultValue);
94
- };
95
- AbstractGenerator.prototype.write = function (path, content) {
96
- return __awaiter(this, void 0, void 0, function () {
97
- return __generator(this, function (_a) {
98
- switch (_a.label) {
99
- case 0: return [4 /*yield*/, fs.ensureFile(path)];
100
- case 1:
101
- _a.sent();
102
- return [4 /*yield*/, fs.writeFile(path, content)];
103
- case 2:
104
- _a.sent();
105
- return [2 /*return*/];
106
- }
107
- });
108
- });
109
- };
110
- AbstractGenerator.prototype.ifMonaco = function (value, defaultValue) {
111
- if (defaultValue === void 0) { defaultValue = function () { return ''; }; }
112
- return (this.pck.extensionPackages.some(function (e) { return e.name === '@theia/monaco'; }) ? value : defaultValue)();
113
- };
114
- AbstractGenerator.prototype.prettyStringify = function (object) {
55
+ }
56
+ async write(path, content) {
57
+ await fs.ensureFile(path);
58
+ await fs.writeFile(path, content);
59
+ }
60
+ ifMonaco(value, defaultValue = () => '') {
61
+ return (this.pck.extensionPackages.some(e => e.name === '@theia/monaco') ? value : defaultValue)();
62
+ }
63
+ prettyStringify(object) {
115
64
  // eslint-disable-next-line no-null/no-null
116
65
  return JSON.stringify(object, null, 4);
117
- };
118
- return AbstractGenerator;
119
- }());
66
+ }
67
+ }
120
68
  exports.AbstractGenerator = AbstractGenerator;
121
69
  //# sourceMappingURL=abstract-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-generator.js","sourceRoot":"","sources":["../../src/generator/abstract-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElF,uBAAyB;AACzB,6BAA+B;AAQ/B;IAEI,2BACuB,GAAuB,EAChC,OAA8B;QAA9B,wBAAA,EAAA,YAA8B;QADrB,QAAG,GAAH,GAAG,CAAoB;QAChC,YAAO,GAAP,OAAO,CAAuB;IACxC,CAAC;IAEK,wDAA4B,GAAtC,UAAuC,OAA4B;;QAC/D,IAAM,aAAa,SAAG,IAAI,CAAC,OAAO,CAAC,aAAa,mCAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC;QACvF,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;IAES,u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AM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAES,QAAQ,CAAC,KAAmB,EAAE,eAA6B,GAAG,EAAE,CAAC,EAAE;QACzE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;IACvG,CAAC;IAES,eAAe,CAAC,MAAc;QACpC,2CAA2C;QAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;CAEJ;AAxDD,8CAwDC"}
@@ -14,88 +14,89 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
- var __extends = (this && this.__extends) || (function () {
18
- var extendStatics = function (d, b) {
19
- extendStatics = Object.setPrototypeOf ||
20
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22
- return extendStatics(d, b);
23
- };
24
- return function (d, b) {
25
- extendStatics(d, b);
26
- function __() { this.constructor = d; }
27
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
- };
29
- })();
30
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
- return new (P || (P = Promise))(function (resolve, reject) {
33
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- };
39
- var __generator = (this && this.__generator) || function (thisArg, body) {
40
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
41
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
42
- function verb(n) { return function (v) { return step([n, v]); }; }
43
- function step(op) {
44
- if (f) throw new TypeError("Generator is already executing.");
45
- while (_) try {
46
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
47
- if (y = 0, t) op = [op[0] & 2, t.value];
48
- switch (op[0]) {
49
- case 0: case 1: t = op; break;
50
- case 4: _.label++; return { value: op[1], done: false };
51
- case 5: _.label++; y = op[1]; op = [0]; continue;
52
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
53
- default:
54
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
55
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
56
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
57
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58
- if (t[2]) _.ops.pop();
59
- _.trys.pop(); continue;
60
- }
61
- op = body.call(thisArg, _);
62
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
63
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
64
- }
65
- };
66
17
  Object.defineProperty(exports, "__esModule", { value: true });
67
18
  exports.BackendGenerator = void 0;
68
- var abstract_generator_1 = require("./abstract-generator");
69
- var BackendGenerator = /** @class */ (function (_super) {
70
- __extends(BackendGenerator, _super);
71
- function BackendGenerator() {
72
- return _super !== null && _super.apply(this, arguments) || this;
19
+ const abstract_generator_1 = require("./abstract-generator");
20
+ class BackendGenerator extends abstract_generator_1.AbstractGenerator {
21
+ async generate() {
22
+ const backendModules = this.pck.targetBackendModules;
23
+ await this.write(this.pck.backend('server.js'), this.compileServer(backendModules));
24
+ await this.write(this.pck.backend('main.js'), this.compileMain(backendModules));
25
+ }
26
+ compileServer(backendModules) {
27
+ return `// @ts-check
28
+ require('reflect-metadata');${this.ifElectron(`
29
+
30
+ // Patch electron version if missing, see https://github.com/eclipse-theia/theia/pull/7361#pullrequestreview-377065146
31
+ if (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') {
32
+ process.versions.electron = process.env.THEIA_ELECTRON_VERSION;
33
+ }`)}
34
+
35
+ // Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up.
36
+ if ('ELECTRON_RUN_AS_NODE' in process.env) {
37
+ delete process.env.ELECTRON_RUN_AS_NODE;
38
+ }
39
+
40
+ const path = require('path');
41
+ const express = require('express');
42
+ const { Container } = require('inversify');
43
+ const { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node');
44
+ const { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module');
45
+ const { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module');
46
+ const { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module');
47
+
48
+ const container = new Container();
49
+ container.load(backendApplicationModule);
50
+ container.load(messagingBackendModule);
51
+ container.load(loggerBackendModule);
52
+
53
+ function defaultServeStatic(app) {
54
+ app.use(express.static(path.resolve(__dirname, '../../lib')))
55
+ }
56
+
57
+ function load(raw) {
58
+ return Promise.resolve(raw.default).then(
59
+ module => container.load(module)
60
+ );
61
+ }
62
+
63
+ function start(port, host, argv = process.argv) {
64
+ if (!container.isBound(BackendApplicationServer)) {
65
+ container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });
66
+ }
67
+ return container.get(CliManager).initializeCli(argv).then(() => {
68
+ return container.get(BackendApplication).start(port, host);
69
+ });
70
+ }
71
+
72
+ module.exports = (port, host, argv) => Promise.resolve()${this.compileBackendModuleImports(backendModules)}
73
+ .then(() => start(port, host, argv)).catch(error => {
74
+ console.error('Failed to start the backend application:');
75
+ console.error(error);
76
+ process.exitCode = 1;
77
+ throw error;
78
+ });
79
+ `;
80
+ }
81
+ compileMain(backendModules) {
82
+ return `// @ts-check
83
+ const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');
84
+ const main = require('@theia/core/lib/node/main');
85
+
86
+ BackendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.backend.config)});
87
+
88
+ const serverModule = require('./server');
89
+ const serverAddress = main.start(serverModule());
90
+
91
+ serverAddress.then(({ port, address }) => {
92
+ if (process && process.send) {
93
+ process.send({ port, address });
94
+ }
95
+ });
96
+
97
+ module.exports = serverAddress;
98
+ `;
73
99
  }
74
- BackendGenerator.prototype.generate = function () {
75
- return __awaiter(this, void 0, void 0, function () {
76
- var backendModules;
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
79
- case 0:
80
- backendModules = this.pck.targetBackendModules;
81
- return [4 /*yield*/, this.write(this.pck.backend('server.js'), this.compileServer(backendModules))];
82
- case 1:
83
- _a.sent();
84
- return [4 /*yield*/, this.write(this.pck.backend('main.js'), this.compileMain(backendModules))];
85
- case 2:
86
- _a.sent();
87
- return [2 /*return*/];
88
- }
89
- });
90
- });
91
- };
92
- BackendGenerator.prototype.compileServer = function (backendModules) {
93
- return "// @ts-check\nrequire('reflect-metadata');" + this.ifElectron("\n\n// Patch electron version if missing, see https://github.com/eclipse-theia/theia/pull/7361#pullrequestreview-377065146\nif (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') {\n process.versions.electron = process.env.THEIA_ELECTRON_VERSION;\n}") + "\n\n// Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up.\nif ('ELECTRON_RUN_AS_NODE' in process.env) {\n delete process.env.ELECTRON_RUN_AS_NODE;\n}\n\nconst path = require('path');\nconst express = require('express');\nconst { Container } = require('inversify');\nconst { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node');\nconst { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module');\nconst { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module');\nconst { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module');\n\nconst container = new Container();\ncontainer.load(backendApplicationModule);\ncontainer.load(messagingBackendModule);\ncontainer.load(loggerBackendModule);\n\nfunction defaultServeStatic(app) {\n app.use(express.static(path.resolve(__dirname, '../../lib')))\n}\n\nfunction load(raw) {\n return Promise.resolve(raw.default).then(\n module => container.load(module)\n );\n}\n\nfunction start(port, host, argv = process.argv) {\n if (!container.isBound(BackendApplicationServer)) {\n container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });\n }\n return container.get(CliManager).initializeCli(argv).then(() => {\n return container.get(BackendApplication).start(port, host);\n });\n}\n\nmodule.exports = (port, host, argv) => Promise.resolve()" + this.compileBackendModuleImports(backendModules) + "\n .then(() => start(port, host, argv)).catch(error => {\n console.error('Failed to start the backend application:');\n console.error(error);\n process.exitCode = 1;\n throw error;\n });\n";
94
- };
95
- BackendGenerator.prototype.compileMain = function (backendModules) {
96
- return "// @ts-check\nconst { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');\nconst main = require('@theia/core/lib/node/main');\n\nBackendApplicationConfigProvider.set(" + this.prettyStringify(this.pck.props.backend.config) + ");\n\nconst serverModule = require('./server');\nconst serverAddress = main.start(serverModule());\n\nserverAddress.then(({ port, address }) => {\n if (process && process.send) {\n process.send({ port, address });\n }\n});\n\nmodule.exports = serverAddress;\n";
97
- };
98
- return BackendGenerator;
99
- }(abstract_generator_1.AbstractGenerator));
100
+ }
100
101
  exports.BackendGenerator = BackendGenerator;
101
102
  //# sourceMappingURL=backend-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend-generator.js","sourceRoot":"","sources":["../../src/generator/backend-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElF,2DAAyD;AAEzD;IAAsC,oCAAiB;IAAvD;;IAoFA,CAAC;IAlFS,mCAAQ,GAAd;;;;;;wBACU,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC;wBACrD,qBAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,EAAA;;wBAAnF,SAAmF,CAAC;wBACpF,qBAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,EAAA;;wBAA/E,SAA+E,CAAC;;;;;KACnF;IAES,wCAAa,GAAvB,UAAwB,cAAmC;QACvD,OAAO,+CACe,IAAI,CAAC,UAAU,CAAC,uTAK5C,CAAC,shDAuCuD,IAAI,CAAC,2BAA2B,CAAC,cAAc,CAAC,mOAOzG,CAAC;IACE,CAAC;IAES,sCAAW,GAArB,UAAsB,cAAmC;QACrD,OAAO,iOAIwB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,qRAYzF,CAAC;IACE,CAAC;IAEL,uBAAC;AAAD,CAAC,AApFD,CAAsC,sCAAiB,GAoFtD;AApFY,4CAAgB"}
1
+ {"version":3,"file":"backend-generator.js","sourceRoot":"","sources":["../../src/generator/backend-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,6DAAyD;AAEzD,MAAa,gBAAiB,SAAQ,sCAAiB;IAEnD,KAAK,C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AAM,CAAC,GAAG,MAAM;IAexE,SAAS,CAAC,gBAAgB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAOxE,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IA8CtE,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAmEnF"}
1
+ {"version":3,"file":"frontend-generator.d.ts","sourceRoot":"","sources":["../../src/generator/frontend-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAIlF,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG3E,qBAAa,iBAAkB,SAAQ,iBAAiB;IAE9C,QAAQ,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7D,SAAS,CAAC,mBAAmB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAc3E,SAAS,CAAC,gBAAgB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAexE,SAAS,CAAC,gBAAgB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAOxE,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAsDtE,SAAS,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;CAmEnF"}
@@ -14,92 +14,23 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
- var __extends = (this && this.__extends) || (function () {
18
- var extendStatics = function (d, b) {
19
- extendStatics = Object.setPrototypeOf ||
20
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
21
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
22
- return extendStatics(d, b);
23
- };
24
- return function (d, b) {
25
- extendStatics(d, b);
26
- function __() { this.constructor = d; }
27
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
- };
29
- })();
30
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
31
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
- return new (P || (P = Promise))(function (resolve, reject) {
33
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- };
39
- var __generator = (this && this.__generator) || function (thisArg, body) {
40
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
41
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
42
- function verb(n) { return function (v) { return step([n, v]); }; }
43
- function step(op) {
44
- if (f) throw new TypeError("Generator is already executing.");
45
- while (_) try {
46
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
47
- if (y = 0, t) op = [op[0] & 2, t.value];
48
- switch (op[0]) {
49
- case 0: case 1: t = op; break;
50
- case 4: _.label++; return { value: op[1], done: false };
51
- case 5: _.label++; y = op[1]; op = [0]; continue;
52
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
53
- default:
54
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
55
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
56
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
57
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
58
- if (t[2]) _.ops.pop();
59
- _.trys.pop(); continue;
60
- }
61
- op = body.call(thisArg, _);
62
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
63
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
64
- }
65
- };
66
17
  Object.defineProperty(exports, "__esModule", { value: true });
67
18
  exports.FrontendGenerator = void 0;
68
19
  /* eslint-disable @typescript-eslint/indent */
69
- var abstract_generator_1 = require("./abstract-generator");
70
- var fs_1 = require("fs");
71
- var FrontendGenerator = /** @class */ (function (_super) {
72
- __extends(FrontendGenerator, _super);
73
- function FrontendGenerator() {
74
- return _super !== null && _super.apply(this, arguments) || this;
20
+ const abstract_generator_1 = require("./abstract-generator");
21
+ const fs_1 = require("fs");
22
+ class FrontendGenerator extends abstract_generator_1.AbstractGenerator {
23
+ async generate(options = {}) {
24
+ const frontendModules = this.pck.targetFrontendModules;
25
+ await this.write(this.pck.frontend('index.html'), this.compileIndexHtml(frontendModules));
26
+ await this.write(this.pck.frontend('index.js'), this.compileIndexJs(frontendModules));
27
+ if (this.pck.isElectron()) {
28
+ const electronMainModules = this.pck.targetElectronMainModules;
29
+ await this.write(this.pck.frontend('electron-main.js'), this.compileElectronMain(electronMainModules));
30
+ }
75
31
  }
76
- FrontendGenerator.prototype.generate = function (options) {
77
- if (options === void 0) { options = {}; }
78
- return __awaiter(this, void 0, void 0, function () {
79
- var frontendModules, electronMainModules;
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
82
- case 0:
83
- frontendModules = this.pck.targetFrontendModules;
84
- return [4 /*yield*/, this.write(this.pck.frontend('index.html'), this.compileIndexHtml(frontendModules))];
85
- case 1:
86
- _a.sent();
87
- return [4 /*yield*/, this.write(this.pck.frontend('index.js'), this.compileIndexJs(frontendModules))];
88
- case 2:
89
- _a.sent();
90
- if (!this.pck.isElectron()) return [3 /*break*/, 4];
91
- electronMainModules = this.pck.targetElectronMainModules;
92
- return [4 /*yield*/, this.write(this.pck.frontend('electron-main.js'), this.compileElectronMain(electronMainModules))];
93
- case 3:
94
- _a.sent();
95
- _a.label = 4;
96
- case 4: return [2 /*return*/];
97
- }
98
- });
99
- });
100
- };
101
- FrontendGenerator.prototype.compileIndexPreload = function (frontendModules) {
102
- var template = this.pck.props.generator.config.preloadTemplate;
32
+ compileIndexPreload(frontendModules) {
33
+ const template = this.pck.props.generator.config.preloadTemplate;
103
34
  if (!template) {
104
35
  return '';
105
36
  }
@@ -108,22 +39,146 @@ var FrontendGenerator = /** @class */ (function (_super) {
108
39
  return fs_1.readFileSync(template).toString();
109
40
  }
110
41
  return template;
111
- };
112
- FrontendGenerator.prototype.compileIndexHtml = function (frontendModules) {
113
- return "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>" + this.compileIndexHead(frontendModules) + "\n <script type=\"text/javascript\" src=\"./bundle.js\" charset=\"utf-8\"></script>\n</head>\n\n<body>\n <div class=\"theia-preload\">" + this.compileIndexPreload(frontendModules) + "</div>\n</body>\n\n</html>";
114
- };
115
- FrontendGenerator.prototype.compileIndexHead = function (frontendModules) {
116
- return "\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\">";
117
- };
118
- FrontendGenerator.prototype.compileIndexJs = function (frontendModules) {
119
- return "// @ts-check\n" + this.ifBrowser("require('es6-promise/auto');") + "\nrequire('reflect-metadata');\nrequire('setimmediate');\nconst { Container } = require('inversify');\nconst { FrontendApplicationConfigProvider } = require('@theia/core/lib/browser/frontend-application-config-provider');\nFrontendApplicationConfigProvider.set(" + this.prettyStringify(this.pck.props.frontend.config) + ");\nconst { FrontendApplication } = require('@theia/core/lib/browser');\nconst { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');\nconst { messagingFrontendModule } = require('@theia/core/lib/" + (this.pck.isBrowser()
42
+ }
43
+ compileIndexHtml(frontendModules) {
44
+ return `<!DOCTYPE html>
45
+ <html lang="en">
46
+
47
+ <head>${this.compileIndexHead(frontendModules)}
48
+ <script type="text/javascript" src="./bundle.js" charset="utf-8"></script>
49
+ </head>
50
+
51
+ <body>
52
+ <div class="theia-preload">${this.compileIndexPreload(frontendModules)}</div>
53
+ </body>
54
+
55
+ </html>`;
56
+ }
57
+ compileIndexHead(frontendModules) {
58
+ return `
59
+ <meta charset="UTF-8">
60
+ <meta name="viewport" content="width=device-width, initial-scale=1">
61
+ <meta name="apple-mobile-web-app-capable" content="yes">`;
62
+ }
63
+ compileIndexJs(frontendModules) {
64
+ const compiledModuleImports = this.compileFrontendModuleImports(frontendModules)
65
+ // fix the generated indentation
66
+ .replace(/^ /g, ' ');
67
+ return `\
68
+ // @ts-check
69
+ ${this.ifBrowser("require('es6-promise/auto');")}
70
+ require('reflect-metadata');
71
+ require('setimmediate');
72
+ const { Container } = require('inversify');
73
+ const { FrontendApplicationConfigProvider } = require('@theia/core/lib/browser/frontend-application-config-provider');
74
+
75
+ FrontendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.frontend.config)});
76
+
77
+ const { ThemeService } = require('@theia/core/lib/browser/theming');
78
+ ThemeService.get().loadUserTheme();
79
+
80
+ const nls = require('@theia/core/lib/browser/nls');
81
+
82
+ // nls translations MUST be loaded before requiring any code that uses them
83
+ module.exports = nls.loadTranslations().then(() => {
84
+ const { FrontendApplication } = require('@theia/core/lib/browser');
85
+ const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
86
+ const { messagingFrontendModule } = require('@theia/core/lib/${this.pck.isBrowser()
120
87
  ? 'browser/messaging/messaging-frontend-module'
121
- : 'electron-browser/messaging/electron-messaging-frontend-module') + "');\nconst { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module');\nconst { ThemeService } = require('@theia/core/lib/browser/theming');\n\nconst container = new Container();\ncontainer.load(frontendApplicationModule);\ncontainer.load(messagingFrontendModule);\ncontainer.load(loggerFrontendModule);\n\nfunction load(raw) {\n return Promise.resolve(raw.default).then(module =>\n container.load(module)\n )\n}\n\nfunction start() {\n (window['theia'] = window['theia'] ||\u00A0{}).container = container;\n\n const themeService = ThemeService.get();\n themeService.loadUserTheme();\n\n const application = container.get(FrontendApplication);\n return application.start();\n}\n\nmodule.exports = Promise.resolve()" + this.compileFrontendModuleImports(frontendModules) + "\n .then(start).catch(reason => {\n console.error('Failed to start the frontend application.');\n if (reason) {\n console.error(reason);\n }\n });";
122
- };
123
- FrontendGenerator.prototype.compileElectronMain = function (electronMainModules) {
124
- return "// @ts-check\n\nrequire('reflect-metadata');\n\n// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the `$PATH` define\n// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).\n// https://github.com/electron/electron/issues/550#issuecomment-162037357\n// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082\nrequire('fix-path')();\n\n// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where\n// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the\n// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the\n// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories).\nif (process.env.LC_ALL) {\n process.env.LC_ALL = 'C';\n}\nprocess.env.LC_NUMERIC = 'C';\n\nconst { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');\nconst { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');\nconst { Container } = require('inversify');\nconst { resolve } = require('path');\nconst { app } = require('electron');\n\n// Fix the window reloading issue, see: https://github.com/electron/electron/issues/22119\napp.allowRendererProcessReuse = false;\n\nconst config = " + this.prettyStringify(this.pck.props.frontend.config) + ";\nconst isSingleInstance = " + (this.pck.props.backend.config.singleInstance === true ? 'true' : 'false') + ";\n\nif (isSingleInstance && !app.requestSingleInstanceLock()) {\n // There is another instance running, exit now. The other instance will request focus.\n app.quit();\n return;\n}\n\nconst container = new Container();\ncontainer.load(electronMainApplicationModule);\ncontainer.bind(ElectronMainApplicationGlobals).toConstantValue({\n THEIA_APP_PROJECT_PATH: resolve(__dirname, '..', '..'),\n THEIA_BACKEND_MAIN_PATH: resolve(__dirname, '..', 'backend', 'main.js'),\n THEIA_FRONTEND_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'index.html'),\n});\n\nfunction load(raw) {\n return Promise.resolve(raw.default).then(module =>\n container.load(module)\n );\n}\n\nasync function start() {\n const application = container.get(ElectronMainApplication);\n await application.start(config);\n}\n\nmodule.exports = Promise.resolve()" + this.compileElectronMainModuleImports(electronMainModules) + "\n .then(start).catch(reason => {\n console.error('Failed to start the electron application.');\n if (reason) {\n console.error(reason);\n }\n });\n";
125
- };
126
- return FrontendGenerator;
127
- }(abstract_generator_1.AbstractGenerator));
88
+ : 'electron-browser/messaging/electron-messaging-frontend-module'}');
89
+ const { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module');
90
+
91
+ const container = new Container();
92
+ container.load(frontendApplicationModule);
93
+ container.load(messagingFrontendModule);
94
+ container.load(loggerFrontendModule);
95
+
96
+ return Promise.resolve()${compiledModuleImports}
97
+ .then(start).catch(reason => {
98
+ console.error('Failed to start the frontend application.');
99
+ if (reason) {
100
+ console.error(reason);
101
+ }
102
+ });
103
+
104
+ function load(jsModule) {
105
+ return Promise.resolve(jsModule.default)
106
+ .then(containerModule => container.load(containerModule));
107
+ }
108
+
109
+ function start() {
110
+ (window['theia'] = window['theia'] || {}).container = container;
111
+ return container.get(FrontendApplication).start();
112
+ }
113
+ });
114
+ `;
115
+ }
116
+ compileElectronMain(electronMainModules) {
117
+ return `// @ts-check
118
+
119
+ require('reflect-metadata');
120
+
121
+ // Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
122
+ // in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
123
+ // https://github.com/electron/electron/issues/550#issuecomment-162037357
124
+ // https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
125
+ require('fix-path')();
126
+
127
+ // Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
128
+ // in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
129
+ // LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
130
+ // C locale, http://en.cppreference.com/w/cpp/locale/LC_categories).
131
+ if (process.env.LC_ALL) {
132
+ process.env.LC_ALL = 'C';
133
+ }
134
+ process.env.LC_NUMERIC = 'C';
135
+
136
+ const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
137
+ const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
138
+ const { Container } = require('inversify');
139
+ const { resolve } = require('path');
140
+ const { app } = require('electron');
141
+
142
+ // Fix the window reloading issue, see: https://github.com/electron/electron/issues/22119
143
+ app.allowRendererProcessReuse = false;
144
+
145
+ const config = ${this.prettyStringify(this.pck.props.frontend.config)};
146
+ const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
147
+
148
+ if (isSingleInstance && !app.requestSingleInstanceLock()) {
149
+ // There is another instance running, exit now. The other instance will request focus.
150
+ app.quit();
151
+ return;
152
+ }
153
+
154
+ const container = new Container();
155
+ container.load(electronMainApplicationModule);
156
+ container.bind(ElectronMainApplicationGlobals).toConstantValue({
157
+ THEIA_APP_PROJECT_PATH: resolve(__dirname, '..', '..'),
158
+ THEIA_BACKEND_MAIN_PATH: resolve(__dirname, '..', 'backend', 'main.js'),
159
+ THEIA_FRONTEND_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'index.html'),
160
+ });
161
+
162
+ function load(raw) {
163
+ return Promise.resolve(raw.default).then(module =>
164
+ container.load(module)
165
+ );
166
+ }
167
+
168
+ async function start() {
169
+ const application = container.get(ElectronMainApplication);
170
+ await application.start(config);
171
+ }
172
+
173
+ module.exports = Promise.resolve()${this.compileElectronMainModuleImports(electronMainModules)}
174
+ .then(start).catch(reason => {
175
+ console.error('Failed to start the electron application.');
176
+ if (reason) {
177
+ console.error(reason);
178
+ }
179
+ });
180
+ `;
181
+ }
182
+ }
128
183
  exports.FrontendGenerator = FrontendGenerator;
129
184
  //# sourceMappingURL=frontend-generator.js.map