@theia/application-manager 1.34.1 → 1.34.3
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/LICENSE +641 -641
- package/README.md +25 -25
- package/lib/application-package-manager.d.ts +39 -39
- package/lib/application-package-manager.js +188 -188
- package/lib/application-process.d.ts +19 -19
- package/lib/application-process.js +72 -72
- package/lib/expose-loader.d.ts +8 -8
- package/lib/expose-loader.js +69 -69
- package/lib/generator/abstract-generator.d.ts +19 -19
- package/lib/generator/abstract-generator.js +68 -68
- package/lib/generator/backend-generator.d.ts +6 -6
- package/lib/generator/backend-generator.js +101 -101
- package/lib/generator/frontend-generator.d.ts +13 -13
- package/lib/generator/frontend-generator.js +261 -261
- package/lib/generator/index.d.ts +3 -3
- package/lib/generator/index.js +30 -30
- package/lib/generator/webpack-generator.d.ts +10 -10
- package/lib/generator/webpack-generator.js +298 -298
- package/lib/index.d.ts +3 -3
- package/lib/index.js +30 -30
- package/lib/package.spec.js +25 -25
- package/lib/rebuild.d.ts +24 -24
- package/lib/rebuild.js +306 -306
- package/package.json +5 -5
- package/src/application-package-manager.ts +228 -228
- package/src/application-process.ts +80 -80
- package/src/expose-loader.ts +80 -80
- package/src/generator/abstract-generator.ts +82 -82
- package/src/generator/backend-generator.ts +103 -103
- package/src/generator/frontend-generator.ts +271 -271
- package/src/generator/index.ts +19 -19
- package/src/generator/webpack-generator.ts +304 -304
- package/src/index.ts +19 -19
- package/src/package.spec.ts +28 -28
- package/src/rebuild.ts +342 -342
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 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 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BackendGenerator = void 0;
|
|
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
|
-
`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.BackendGenerator = BackendGenerator;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 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 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.BackendGenerator = void 0;
|
|
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
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.BackendGenerator = BackendGenerator;
|
|
102
102
|
//# sourceMappingURL=backend-generator.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AbstractGenerator, GeneratorOptions } from './abstract-generator';
|
|
2
|
-
export declare class FrontendGenerator extends AbstractGenerator {
|
|
3
|
-
generate(options?: GeneratorOptions): Promise<void>;
|
|
4
|
-
protected compileIndexPreload(frontendModules: Map<string, string>): string;
|
|
5
|
-
protected compileIndexHtml(frontendModules: Map<string, string>): string;
|
|
6
|
-
protected compileIndexHead(frontendModules: Map<string, string>): string;
|
|
7
|
-
protected compileIndexJs(frontendModules: Map<string, string>): string;
|
|
8
|
-
protected compileElectronMain(electronMainModules?: Map<string, string>): string;
|
|
9
|
-
/** HTML for secondary windows that contain an extracted widget. */
|
|
10
|
-
protected compileSecondaryWindowHtml(): string;
|
|
11
|
-
protected compileSecondaryModuleImports(secondaryWindowModules: Map<string, string>): string;
|
|
12
|
-
protected compileSecondaryIndexJs(secondaryWindowModules: Map<string, string>): string;
|
|
13
|
-
}
|
|
1
|
+
import { AbstractGenerator, GeneratorOptions } from './abstract-generator';
|
|
2
|
+
export declare class FrontendGenerator extends AbstractGenerator {
|
|
3
|
+
generate(options?: GeneratorOptions): Promise<void>;
|
|
4
|
+
protected compileIndexPreload(frontendModules: Map<string, string>): string;
|
|
5
|
+
protected compileIndexHtml(frontendModules: Map<string, string>): string;
|
|
6
|
+
protected compileIndexHead(frontendModules: Map<string, string>): string;
|
|
7
|
+
protected compileIndexJs(frontendModules: Map<string, string>): string;
|
|
8
|
+
protected compileElectronMain(electronMainModules?: Map<string, string>): string;
|
|
9
|
+
/** HTML for secondary windows that contain an extracted widget. */
|
|
10
|
+
protected compileSecondaryWindowHtml(): string;
|
|
11
|
+
protected compileSecondaryModuleImports(secondaryWindowModules: Map<string, string>): string;
|
|
12
|
+
protected compileSecondaryIndexJs(secondaryWindowModules: Map<string, string>): string;
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=frontend-generator.d.ts.map
|