@theia/application-manager 1.53.0-next.5 → 1.53.0-next.55
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.
- package/README.md +25 -25
- package/lib/generator/backend-generator.js +157 -157
- package/lib/generator/frontend-generator.js +143 -143
- package/lib/generator/webpack-generator.js +432 -432
- package/package.json +6 -6
- package/src/application-package-manager.ts +263 -263
- package/src/application-process.ts +86 -86
- package/src/expose-loader.ts +80 -80
- package/src/generator/abstract-generator.ts +69 -69
- package/src/generator/backend-generator.ts +204 -204
- package/src/generator/frontend-generator.ts +222 -222
- package/src/generator/index.ts +19 -19
- package/src/generator/webpack-generator.ts +501 -501
- package/src/index.ts +19 -19
- package/src/package.spec.ts +28 -28
- package/src/rebuild.ts +350 -350
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - APPLICATION-MANAGER</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Additional Information
|
|
14
|
-
|
|
15
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
16
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
17
|
-
|
|
18
|
-
## License
|
|
19
|
-
|
|
20
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
21
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
22
|
-
|
|
23
|
-
## Trademark
|
|
24
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
25
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - APPLICATION-MANAGER</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Additional Information
|
|
14
|
+
|
|
15
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
16
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
21
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
22
|
+
|
|
23
|
+
## Trademark
|
|
24
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
25
|
+
https://www.eclipse.org/theia
|
|
@@ -33,169 +33,169 @@ class BackendGenerator extends abstract_generator_1.AbstractGenerator {
|
|
|
33
33
|
}
|
|
34
34
|
compileElectronMain(electronMainModules) {
|
|
35
35
|
var _a;
|
|
36
|
-
return `// @ts-check
|
|
37
|
-
|
|
38
|
-
require('reflect-metadata');
|
|
39
|
-
|
|
40
|
-
// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
|
|
41
|
-
// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
|
|
42
|
-
// https://github.com/electron/electron/issues/550#issuecomment-162037357
|
|
43
|
-
// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
|
|
44
|
-
require('fix-path')();
|
|
45
|
-
|
|
46
|
-
// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
|
|
47
|
-
// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
|
|
48
|
-
// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
|
|
49
|
-
// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories).
|
|
50
|
-
if (process.env.LC_ALL) {
|
|
51
|
-
process.env.LC_ALL = 'C';
|
|
52
|
-
}
|
|
53
|
-
process.env.LC_NUMERIC = 'C';
|
|
54
|
-
|
|
55
|
-
const { resolve } = require('path');
|
|
56
|
-
const theiaAppProjectPath = resolve(__dirname, '..', '..');
|
|
57
|
-
process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath;
|
|
58
|
-
const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
|
|
59
|
-
const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
|
|
60
|
-
const { Container } = require('inversify');
|
|
61
|
-
const { app } = require('electron');
|
|
62
|
-
|
|
63
|
-
const config = ${this.prettyStringify(this.pck.props.frontend.config)};
|
|
64
|
-
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
|
|
65
|
-
|
|
66
|
-
(async () => {
|
|
67
|
-
if (isSingleInstance && !app.requestSingleInstanceLock()) {
|
|
68
|
-
// There is another instance running, exit now. The other instance will request focus.
|
|
69
|
-
app.quit();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const container = new Container();
|
|
74
|
-
container.load(electronMainApplicationModule);
|
|
75
|
-
container.bind(ElectronMainApplicationGlobals).toConstantValue({
|
|
76
|
-
THEIA_APP_PROJECT_PATH: theiaAppProjectPath,
|
|
77
|
-
THEIA_BACKEND_MAIN_PATH: resolve(__dirname, 'main.js'),
|
|
78
|
-
THEIA_FRONTEND_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'index.html'),
|
|
79
|
-
THEIA_SECONDARY_WINDOW_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'secondary-window.html')
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
function load(raw) {
|
|
83
|
-
return Promise.resolve(raw.default).then(module =>
|
|
84
|
-
container.load(module)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async function start() {
|
|
89
|
-
const application = container.get(ElectronMainApplication);
|
|
90
|
-
await application.start(config);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
${Array.from((_a = electronMainModules === null || electronMainModules === void 0 ? void 0 : electronMainModules.values()) !== null && _a !== void 0 ? _a : [], jsModulePath => `\
|
|
95
|
-
await load(require('${jsModulePath}'));`).join(os_1.EOL)}
|
|
96
|
-
await start();
|
|
97
|
-
} catch (reason) {
|
|
98
|
-
if (typeof reason !== 'number') {
|
|
99
|
-
console.error('Failed to start the electron application.');
|
|
100
|
-
if (reason) {
|
|
101
|
-
console.error(reason);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
app.quit();
|
|
105
|
-
};
|
|
106
|
-
})();
|
|
36
|
+
return `// @ts-check
|
|
37
|
+
|
|
38
|
+
require('reflect-metadata');
|
|
39
|
+
|
|
40
|
+
// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
|
|
41
|
+
// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
|
|
42
|
+
// https://github.com/electron/electron/issues/550#issuecomment-162037357
|
|
43
|
+
// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
|
|
44
|
+
require('fix-path')();
|
|
45
|
+
|
|
46
|
+
// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
|
|
47
|
+
// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
|
|
48
|
+
// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
|
|
49
|
+
// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories).
|
|
50
|
+
if (process.env.LC_ALL) {
|
|
51
|
+
process.env.LC_ALL = 'C';
|
|
52
|
+
}
|
|
53
|
+
process.env.LC_NUMERIC = 'C';
|
|
54
|
+
|
|
55
|
+
const { resolve } = require('path');
|
|
56
|
+
const theiaAppProjectPath = resolve(__dirname, '..', '..');
|
|
57
|
+
process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath;
|
|
58
|
+
const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
|
|
59
|
+
const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
|
|
60
|
+
const { Container } = require('inversify');
|
|
61
|
+
const { app } = require('electron');
|
|
62
|
+
|
|
63
|
+
const config = ${this.prettyStringify(this.pck.props.frontend.config)};
|
|
64
|
+
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
|
|
65
|
+
|
|
66
|
+
(async () => {
|
|
67
|
+
if (isSingleInstance && !app.requestSingleInstanceLock()) {
|
|
68
|
+
// There is another instance running, exit now. The other instance will request focus.
|
|
69
|
+
app.quit();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const container = new Container();
|
|
74
|
+
container.load(electronMainApplicationModule);
|
|
75
|
+
container.bind(ElectronMainApplicationGlobals).toConstantValue({
|
|
76
|
+
THEIA_APP_PROJECT_PATH: theiaAppProjectPath,
|
|
77
|
+
THEIA_BACKEND_MAIN_PATH: resolve(__dirname, 'main.js'),
|
|
78
|
+
THEIA_FRONTEND_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'index.html'),
|
|
79
|
+
THEIA_SECONDARY_WINDOW_HTML_PATH: resolve(__dirname, '..', '..', 'lib', 'frontend', 'secondary-window.html')
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
function load(raw) {
|
|
83
|
+
return Promise.resolve(raw.default).then(module =>
|
|
84
|
+
container.load(module)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function start() {
|
|
89
|
+
const application = container.get(ElectronMainApplication);
|
|
90
|
+
await application.start(config);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
${Array.from((_a = electronMainModules === null || electronMainModules === void 0 ? void 0 : electronMainModules.values()) !== null && _a !== void 0 ? _a : [], jsModulePath => `\
|
|
95
|
+
await load(require('${jsModulePath}'));`).join(os_1.EOL)}
|
|
96
|
+
await start();
|
|
97
|
+
} catch (reason) {
|
|
98
|
+
if (typeof reason !== 'number') {
|
|
99
|
+
console.error('Failed to start the electron application.');
|
|
100
|
+
if (reason) {
|
|
101
|
+
console.error(reason);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
app.quit();
|
|
105
|
+
};
|
|
106
|
+
})();
|
|
107
107
|
`;
|
|
108
108
|
}
|
|
109
109
|
compileServer(backendModules) {
|
|
110
|
-
return `// @ts-check
|
|
111
|
-
require('reflect-metadata');${this.ifElectron(`
|
|
112
|
-
|
|
113
|
-
// Patch electron version if missing, see https://github.com/eclipse-theia/theia/pull/7361#pullrequestreview-377065146
|
|
114
|
-
if (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') {
|
|
115
|
-
process.versions.electron = process.env.THEIA_ELECTRON_VERSION;
|
|
116
|
-
}`)}
|
|
117
|
-
|
|
118
|
-
// Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up.
|
|
119
|
-
if ('ELECTRON_RUN_AS_NODE' in process.env) {
|
|
120
|
-
delete process.env.ELECTRON_RUN_AS_NODE;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const path = require('path');
|
|
124
|
-
process.env.THEIA_APP_PROJECT_PATH = path.resolve(__dirname, '..', '..')
|
|
125
|
-
const express = require('express');
|
|
126
|
-
const { Container } = require('inversify');
|
|
127
|
-
const { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node');
|
|
128
|
-
const { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module');
|
|
129
|
-
const { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module');
|
|
130
|
-
const { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module');
|
|
131
|
-
|
|
132
|
-
const container = new Container();
|
|
133
|
-
container.load(backendApplicationModule);
|
|
134
|
-
container.load(messagingBackendModule);
|
|
135
|
-
container.load(loggerBackendModule);
|
|
136
|
-
|
|
137
|
-
function defaultServeStatic(app) {
|
|
138
|
-
app.use(express.static(path.resolve(__dirname, '../../lib/frontend')))
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function load(raw) {
|
|
142
|
-
return Promise.resolve(raw).then(
|
|
143
|
-
module => container.load(module.default)
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function start(port, host, argv = process.argv) {
|
|
148
|
-
if (!container.isBound(BackendApplicationServer)) {
|
|
149
|
-
container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });
|
|
150
|
-
}
|
|
151
|
-
let result = undefined;
|
|
152
|
-
await container.get(CliManager).initializeCli(argv.slice(2),
|
|
153
|
-
() => container.get(BackendApplication).configured,
|
|
154
|
-
async () => {
|
|
155
|
-
result = container.get(BackendApplication).start(port, host);
|
|
156
|
-
});
|
|
157
|
-
if (result) {
|
|
158
|
-
return result;
|
|
159
|
-
} else {
|
|
160
|
-
return Promise.reject(0);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
module.exports = async (port, host, argv) => {
|
|
165
|
-
try {
|
|
166
|
-
${Array.from(backendModules.values(), jsModulePath => `\
|
|
167
|
-
await load(require('${jsModulePath}'));`).join(os_1.EOL)}
|
|
168
|
-
return await start(port, host, argv);
|
|
169
|
-
} catch (error) {
|
|
170
|
-
if (typeof error !== 'number') {
|
|
171
|
-
console.error('Failed to start the backend application:');
|
|
172
|
-
console.error(error);
|
|
173
|
-
process.exitCode = 1;
|
|
174
|
-
}
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
110
|
+
return `// @ts-check
|
|
111
|
+
require('reflect-metadata');${this.ifElectron(`
|
|
112
|
+
|
|
113
|
+
// Patch electron version if missing, see https://github.com/eclipse-theia/theia/pull/7361#pullrequestreview-377065146
|
|
114
|
+
if (typeof process.versions.electron === 'undefined' && typeof process.env.THEIA_ELECTRON_VERSION === 'string') {
|
|
115
|
+
process.versions.electron = process.env.THEIA_ELECTRON_VERSION;
|
|
116
|
+
}`)}
|
|
117
|
+
|
|
118
|
+
// Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up.
|
|
119
|
+
if ('ELECTRON_RUN_AS_NODE' in process.env) {
|
|
120
|
+
delete process.env.ELECTRON_RUN_AS_NODE;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const path = require('path');
|
|
124
|
+
process.env.THEIA_APP_PROJECT_PATH = path.resolve(__dirname, '..', '..')
|
|
125
|
+
const express = require('express');
|
|
126
|
+
const { Container } = require('inversify');
|
|
127
|
+
const { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node');
|
|
128
|
+
const { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module');
|
|
129
|
+
const { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module');
|
|
130
|
+
const { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module');
|
|
131
|
+
|
|
132
|
+
const container = new Container();
|
|
133
|
+
container.load(backendApplicationModule);
|
|
134
|
+
container.load(messagingBackendModule);
|
|
135
|
+
container.load(loggerBackendModule);
|
|
136
|
+
|
|
137
|
+
function defaultServeStatic(app) {
|
|
138
|
+
app.use(express.static(path.resolve(__dirname, '../../lib/frontend')))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function load(raw) {
|
|
142
|
+
return Promise.resolve(raw).then(
|
|
143
|
+
module => container.load(module.default)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function start(port, host, argv = process.argv) {
|
|
148
|
+
if (!container.isBound(BackendApplicationServer)) {
|
|
149
|
+
container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });
|
|
150
|
+
}
|
|
151
|
+
let result = undefined;
|
|
152
|
+
await container.get(CliManager).initializeCli(argv.slice(2),
|
|
153
|
+
() => container.get(BackendApplication).configured,
|
|
154
|
+
async () => {
|
|
155
|
+
result = container.get(BackendApplication).start(port, host);
|
|
156
|
+
});
|
|
157
|
+
if (result) {
|
|
158
|
+
return result;
|
|
159
|
+
} else {
|
|
160
|
+
return Promise.reject(0);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
module.exports = async (port, host, argv) => {
|
|
165
|
+
try {
|
|
166
|
+
${Array.from(backendModules.values(), jsModulePath => `\
|
|
167
|
+
await load(require('${jsModulePath}'));`).join(os_1.EOL)}
|
|
168
|
+
return await start(port, host, argv);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (typeof error !== 'number') {
|
|
171
|
+
console.error('Failed to start the backend application:');
|
|
172
|
+
console.error(error);
|
|
173
|
+
process.exitCode = 1;
|
|
174
|
+
}
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
178
|
`;
|
|
179
179
|
}
|
|
180
180
|
compileMain(backendModules) {
|
|
181
|
-
return `// @ts-check
|
|
182
|
-
const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');
|
|
183
|
-
const main = require('@theia/core/lib/node/main');
|
|
184
|
-
|
|
185
|
-
BackendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.backend.config)});
|
|
186
|
-
|
|
187
|
-
globalThis.extensionInfo = ${this.prettyStringify(this.pck.extensionPackages.map(({ name, version }) => ({ name, version })))};
|
|
188
|
-
|
|
189
|
-
const serverModule = require('./server');
|
|
190
|
-
const serverAddress = main.start(serverModule());
|
|
191
|
-
|
|
192
|
-
serverAddress.then((addressInfo) => {
|
|
193
|
-
if (process && process.send && addressInfo) {
|
|
194
|
-
process.send(addressInfo);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
globalThis.serverAddress = serverAddress;
|
|
181
|
+
return `// @ts-check
|
|
182
|
+
const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');
|
|
183
|
+
const main = require('@theia/core/lib/node/main');
|
|
184
|
+
|
|
185
|
+
BackendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.backend.config)});
|
|
186
|
+
|
|
187
|
+
globalThis.extensionInfo = ${this.prettyStringify(this.pck.extensionPackages.map(({ name, version }) => ({ name, version })))};
|
|
188
|
+
|
|
189
|
+
const serverModule = require('./server');
|
|
190
|
+
const serverAddress = main.start(serverModule());
|
|
191
|
+
|
|
192
|
+
serverAddress.then((addressInfo) => {
|
|
193
|
+
if (process && process.send && addressInfo) {
|
|
194
|
+
process.send(addressInfo);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
globalThis.serverAddress = serverAddress;
|
|
199
199
|
`;
|
|
200
200
|
}
|
|
201
201
|
}
|