@theia/application-manager 1.67.0-next.13 → 1.67.0-next.56
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/package.json +5 -5
- package/lib/application-package-manager.d.ts +0 -46
- package/lib/application-package-manager.d.ts.map +0 -1
- package/lib/application-package-manager.js +0 -226
- package/lib/application-package-manager.js.map +0 -1
- package/lib/application-process.d.ts +0 -21
- package/lib/application-process.d.ts.map +0 -1
- package/lib/application-process.js +0 -93
- package/lib/application-process.js.map +0 -1
- package/lib/expose-loader.d.ts +0 -9
- package/lib/expose-loader.d.ts.map +0 -1
- package/lib/expose-loader.js +0 -70
- package/lib/expose-loader.js.map +0 -1
- package/lib/generator/abstract-generator.d.ts +0 -18
- package/lib/generator/abstract-generator.d.ts.map +0 -1
- package/lib/generator/abstract-generator.js +0 -58
- package/lib/generator/abstract-generator.js.map +0 -1
- package/lib/generator/backend-generator.d.ts +0 -8
- package/lib/generator/backend-generator.d.ts.map +0 -1
- package/lib/generator/backend-generator.js +0 -203
- package/lib/generator/backend-generator.js.map +0 -1
- package/lib/generator/frontend-generator.d.ts +0 -14
- package/lib/generator/frontend-generator.d.ts.map +0 -1
- package/lib/generator/frontend-generator.js +0 -211
- package/lib/generator/frontend-generator.js.map +0 -1
- package/lib/generator/index.d.ts +0 -4
- package/lib/generator/index.d.ts.map +0 -1
- package/lib/generator/index.js +0 -22
- package/lib/generator/index.js.map +0 -1
- package/lib/generator/webpack-generator.d.ts +0 -12
- package/lib/generator/webpack-generator.d.ts.map +0 -1
- package/lib/generator/webpack-generator.js +0 -523
- package/lib/generator/webpack-generator.js.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -22
- package/lib/index.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
- package/lib/rebuild.d.ts +0 -25
- package/lib/rebuild.d.ts.map +0 -1
- package/lib/rebuild.js +0 -314
- package/lib/rebuild.js.map +0 -1
|
@@ -1,203 +0,0 @@
|
|
|
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-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BackendGenerator = void 0;
|
|
19
|
-
const os_1 = require("os");
|
|
20
|
-
const abstract_generator_1 = require("./abstract-generator");
|
|
21
|
-
class BackendGenerator extends abstract_generator_1.AbstractGenerator {
|
|
22
|
-
async generate() {
|
|
23
|
-
if (this.pck.isBrowserOnly()) {
|
|
24
|
-
// no backend generation in case of browser-only target
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const backendModules = this.pck.targetBackendModules;
|
|
28
|
-
await this.write(this.pck.backend('server.js'), this.compileServer(backendModules));
|
|
29
|
-
await this.write(this.pck.backend('main.js'), this.compileMain(backendModules));
|
|
30
|
-
if (this.pck.isElectron()) {
|
|
31
|
-
await this.write(this.pck.backend('electron-main.js'), this.compileElectronMain(this.pck.targetElectronMainModules));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
compileElectronMain(electronMainModules) {
|
|
35
|
-
var _a;
|
|
36
|
-
return `// @ts-check
|
|
37
|
-
|
|
38
|
-
require('@theia/core/shared/reflect-metadata');
|
|
39
|
-
|
|
40
|
-
// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
|
|
41
|
-
// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
|
|
42
|
-
// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
|
|
43
|
-
// C locale, http://en.cppreference.com/w/cpp/locale/LC_categories).
|
|
44
|
-
if (process.env.LC_ALL) {
|
|
45
|
-
process.env.LC_ALL = 'C';
|
|
46
|
-
}
|
|
47
|
-
process.env.LC_NUMERIC = 'C';
|
|
48
|
-
|
|
49
|
-
(async () => {
|
|
50
|
-
// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
|
|
51
|
-
// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
|
|
52
|
-
// https://github.com/electron/electron/issues/550#issuecomment-162037357
|
|
53
|
-
// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
|
|
54
|
-
(await require('@theia/core/electron-shared/fix-path')).default();
|
|
55
|
-
|
|
56
|
-
const { resolve } = require('path');
|
|
57
|
-
const theiaAppProjectPath = resolve(__dirname, '..', '..');
|
|
58
|
-
process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath;
|
|
59
|
-
const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
|
|
60
|
-
const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
|
|
61
|
-
const { Container } = require('@theia/core/shared/inversify');
|
|
62
|
-
const { app } = require('electron');
|
|
63
|
-
|
|
64
|
-
const config = ${this.prettyStringify(this.pck.props.frontend.config)};
|
|
65
|
-
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
|
|
66
|
-
|
|
67
|
-
if (isSingleInstance && !app.requestSingleInstanceLock(process.argv)) {
|
|
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
|
-
`;
|
|
108
|
-
}
|
|
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('@theia/core/shared/express');
|
|
126
|
-
const { Container } = require('@theia/core/shared/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
|
-
`;
|
|
179
|
-
}
|
|
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;
|
|
199
|
-
`;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
exports.BackendGenerator = BackendGenerator;
|
|
203
|
-
//# sourceMappingURL=backend-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backend-generator.js","sourceRoot":"","sources":["../../src/generator/backend-generator.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,2BAAyB;AACzB,6DAAyD;AAEzD,MAAa,gBAAiB,SAAQ,sCAAiB;IAEnD,KAAK,CAAC,QAAQ;QACV,IAAI,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC;YAC3B,uDAAuD;YACvD,OAAO;QACX,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACrD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;QACpF,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;QAChF,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC;QACzH,CAAC;IACL,CAAC;I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,CAAC;IACE,CAAC;CAEJ;AAxLD,4CAwLC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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>, frontendPreloadModules: Map<string, string>): string;
|
|
8
|
-
protected importOrRequire(): string;
|
|
9
|
-
/** HTML for secondary windows that contain an extracted widget. */
|
|
10
|
-
protected compileSecondaryWindowHtml(): string;
|
|
11
|
-
protected compileSecondaryIndexJs(secondaryWindowModules: Map<string, string>): string;
|
|
12
|
-
compilePreloadJs(): string;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=frontend-generator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-generator.d.ts","sourceRoot":"","sources":["../../src/generator/frontend-generator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG3E,qBAAa,iBAAkB,SAAQ,iBAAiB;IAE9C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUzD,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;IAQxE,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAqFnH,SAAS,CAAC,eAAe,IAAI,MAAM;IAInC,mEAAmE;IACnE,SAAS,CAAC,0BAA0B,IAAI,MAAM;IAoC9C,SAAS,CAAC,uBAAuB,CAAC,sBAAsB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM;IAgBtF,gBAAgB,IAAI,MAAM;CAM7B"}
|
|
@@ -1,211 +0,0 @@
|
|
|
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-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.FrontendGenerator = void 0;
|
|
19
|
-
/* eslint-disable @typescript-eslint/indent */
|
|
20
|
-
const os_1 = require("os");
|
|
21
|
-
const abstract_generator_1 = require("./abstract-generator");
|
|
22
|
-
const fs_1 = require("fs");
|
|
23
|
-
class FrontendGenerator extends abstract_generator_1.AbstractGenerator {
|
|
24
|
-
async generate(options) {
|
|
25
|
-
await this.write(this.pck.frontend('index.html'), this.compileIndexHtml(this.pck.targetFrontendModules));
|
|
26
|
-
await this.write(this.pck.frontend('index.js'), this.compileIndexJs(this.pck.targetFrontendModules, this.pck.targetFrontendPreloadModules));
|
|
27
|
-
await this.write(this.pck.frontend('secondary-window.html'), this.compileSecondaryWindowHtml());
|
|
28
|
-
await this.write(this.pck.frontend('secondary-index.js'), this.compileSecondaryIndexJs(this.pck.secondaryWindowModules));
|
|
29
|
-
if (this.pck.isElectron()) {
|
|
30
|
-
await this.write(this.pck.frontend('preload.js'), this.compilePreloadJs());
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
compileIndexPreload(frontendModules) {
|
|
34
|
-
const template = this.pck.props.generator.config.preloadTemplate;
|
|
35
|
-
if (!template) {
|
|
36
|
-
return '';
|
|
37
|
-
}
|
|
38
|
-
// Support path to html file
|
|
39
|
-
if ((0, fs_1.existsSync)(template)) {
|
|
40
|
-
return (0, fs_1.readFileSync)(template).toString();
|
|
41
|
-
}
|
|
42
|
-
return template;
|
|
43
|
-
}
|
|
44
|
-
compileIndexHtml(frontendModules) {
|
|
45
|
-
return `<!DOCTYPE html>
|
|
46
|
-
<html lang="en">
|
|
47
|
-
|
|
48
|
-
<head>${this.compileIndexHead(frontendModules)}
|
|
49
|
-
</head>
|
|
50
|
-
|
|
51
|
-
<body>
|
|
52
|
-
<div class="theia-preload">${this.compileIndexPreload(frontendModules)}</div>
|
|
53
|
-
<script type="text/javascript" src="./bundle.js" charset="utf-8"></script>
|
|
54
|
-
</body>
|
|
55
|
-
|
|
56
|
-
</html>`;
|
|
57
|
-
}
|
|
58
|
-
compileIndexHead(frontendModules) {
|
|
59
|
-
return `
|
|
60
|
-
<meta charset="UTF-8">
|
|
61
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
62
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
63
|
-
<title>${this.pck.props.frontend.config.applicationName}</title>`;
|
|
64
|
-
}
|
|
65
|
-
compileIndexJs(frontendModules, frontendPreloadModules) {
|
|
66
|
-
return `\
|
|
67
|
-
// @ts-check
|
|
68
|
-
require('reflect-metadata');
|
|
69
|
-
const { Container } = require('@theia/core/shared/inversify');
|
|
70
|
-
const { FrontendApplicationConfigProvider } = require('@theia/core/lib/browser/frontend-application-config-provider');
|
|
71
|
-
|
|
72
|
-
FrontendApplicationConfigProvider.set(${this.prettyStringify(this.pck.props.frontend.config)});
|
|
73
|
-
|
|
74
|
-
${this.ifMonaco(() => `
|
|
75
|
-
self.MonacoEnvironment = {
|
|
76
|
-
getWorkerUrl: function (moduleId, label) {
|
|
77
|
-
return './editor.worker.js';
|
|
78
|
-
}
|
|
79
|
-
}`)}
|
|
80
|
-
|
|
81
|
-
function load(container, jsModule) {
|
|
82
|
-
return Promise.resolve(jsModule)
|
|
83
|
-
.then(containerModule => container.load(containerModule.default));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function preload(container) {
|
|
87
|
-
try {
|
|
88
|
-
${Array.from(frontendPreloadModules.values(), jsModulePath => `\
|
|
89
|
-
await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(os_1.EOL)}
|
|
90
|
-
const { Preloader } = require('@theia/core/lib/browser/preload/preloader');
|
|
91
|
-
const preloader = container.get(Preloader);
|
|
92
|
-
await preloader.initialize();
|
|
93
|
-
} catch (reason) {
|
|
94
|
-
console.error('Failed to run preload scripts.');
|
|
95
|
-
if (reason) {
|
|
96
|
-
console.error(reason);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
module.exports = (async () => {
|
|
102
|
-
const { messagingFrontendModule } = require('@theia/core/lib/${this.pck.isBrowser() || this.pck.isBrowserOnly()
|
|
103
|
-
? 'browser/messaging/messaging-frontend-module'
|
|
104
|
-
: 'electron-browser/messaging/electron-messaging-frontend-module'}');
|
|
105
|
-
const container = new Container();
|
|
106
|
-
container.load(messagingFrontendModule);
|
|
107
|
-
${this.ifBrowserOnly(`const { messagingFrontendOnlyModule } = require('@theia/core/lib/browser-only/messaging/messaging-frontend-only-module');
|
|
108
|
-
container.load(messagingFrontendOnlyModule);`)}
|
|
109
|
-
|
|
110
|
-
await preload(container);
|
|
111
|
-
|
|
112
|
-
${this.ifMonaco(() => `
|
|
113
|
-
const { MonacoInit } = require('@theia/monaco/lib/browser/monaco-init');
|
|
114
|
-
`)};
|
|
115
|
-
|
|
116
|
-
const { FrontendApplication } = require('@theia/core/lib/browser');
|
|
117
|
-
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
|
|
118
|
-
const { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module');
|
|
119
|
-
|
|
120
|
-
container.load(frontendApplicationModule);
|
|
121
|
-
${this.pck.ifBrowserOnly(`const { frontendOnlyApplicationModule } = require('@theia/core/lib/browser-only/frontend-only-application-module');
|
|
122
|
-
container.load(frontendOnlyApplicationModule);`)}
|
|
123
|
-
|
|
124
|
-
container.load(loggerFrontendModule);
|
|
125
|
-
${this.ifBrowserOnly(`const { loggerFrontendOnlyModule } = require('@theia/core/lib/browser-only/logger-frontend-only-module');
|
|
126
|
-
container.load(loggerFrontendOnlyModule);`)}
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
${Array.from(frontendModules.values(), jsModulePath => `\
|
|
130
|
-
await load(container, ${this.importOrRequire()}('${jsModulePath}'));`).join(os_1.EOL)}
|
|
131
|
-
${this.ifMonaco(() => `
|
|
132
|
-
MonacoInit.init(container);
|
|
133
|
-
`)};
|
|
134
|
-
await start();
|
|
135
|
-
} catch (reason) {
|
|
136
|
-
console.error('Failed to start the frontend application.');
|
|
137
|
-
if (reason) {
|
|
138
|
-
console.error(reason);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function start() {
|
|
143
|
-
(window['theia'] = window['theia'] || {}).container = container;
|
|
144
|
-
return container.get(FrontendApplication).start();
|
|
145
|
-
}
|
|
146
|
-
})();
|
|
147
|
-
`;
|
|
148
|
-
}
|
|
149
|
-
importOrRequire() {
|
|
150
|
-
return this.options.mode !== 'production' ? 'import' : 'require';
|
|
151
|
-
}
|
|
152
|
-
/** HTML for secondary windows that contain an extracted widget. */
|
|
153
|
-
compileSecondaryWindowHtml() {
|
|
154
|
-
return `<!DOCTYPE html>
|
|
155
|
-
<html lang="en">
|
|
156
|
-
|
|
157
|
-
<head>
|
|
158
|
-
<meta charset="UTF-8">
|
|
159
|
-
<title>Theia — Secondary Window</title>
|
|
160
|
-
<style>
|
|
161
|
-
html, body {
|
|
162
|
-
overflow: hidden;
|
|
163
|
-
-ms-overflow-style: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
body {
|
|
167
|
-
margin: 0;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
html,
|
|
171
|
-
head,
|
|
172
|
-
body,
|
|
173
|
-
.secondary-widget-root,
|
|
174
|
-
#widget-host {
|
|
175
|
-
width: 100% !important;
|
|
176
|
-
height: 100% !important;
|
|
177
|
-
}
|
|
178
|
-
</style>
|
|
179
|
-
<link rel="stylesheet" href="./secondary-window.css">
|
|
180
|
-
</head>
|
|
181
|
-
|
|
182
|
-
<body>
|
|
183
|
-
<div id="widget-host"></div>
|
|
184
|
-
</body>
|
|
185
|
-
|
|
186
|
-
</html>`;
|
|
187
|
-
}
|
|
188
|
-
compileSecondaryIndexJs(secondaryWindowModules) {
|
|
189
|
-
return `\
|
|
190
|
-
// @ts-check
|
|
191
|
-
require('reflect-metadata');
|
|
192
|
-
const { Container } = require('@theia/core/shared/inversify');
|
|
193
|
-
|
|
194
|
-
module.exports = Promise.resolve().then(() => {
|
|
195
|
-
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
|
|
196
|
-
const container = new Container();
|
|
197
|
-
container.load(frontendApplicationModule);
|
|
198
|
-
${Array.from(secondaryWindowModules.values(), jsModulePath => `\
|
|
199
|
-
container.load(require('${jsModulePath}').default);`).join(os_1.EOL)}
|
|
200
|
-
});
|
|
201
|
-
`;
|
|
202
|
-
}
|
|
203
|
-
compilePreloadJs() {
|
|
204
|
-
return `\
|
|
205
|
-
// @ts-check
|
|
206
|
-
${Array.from(this.pck.preloadModules.values(), path => `require('${path}').preload();`).join(os_1.EOL)}
|
|
207
|
-
`;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.FrontendGenerator = FrontendGenerator;
|
|
211
|
-
//# sourceMappingURL=frontend-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-generator.js","sourceRoot":"","sources":["../../src/generator/frontend-generator.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,8CAA8C;AAE9C,2BAAyB;AACzB,6DAA2E;AAC3E,2BAA8C;AAE9C,MAAa,iBAAkB,SAAQ,sCAAiB;IAEpD,KAAK,CAAC,QAAQ,CAAC,OAA0B;QACrC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACzG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;QAC5I,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC;QAChG,MAAM,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YAAY,CAAC,EAAE,CAAC;8BAChC,YAAY,cAAc,CAAC,CAAC,IAAI,CAAC,QAAG,CAAC;;CAElE,CAAC;IACE,CAAC;IAED,gBAAgB;QACZ,OAAO;;EAEb,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,YAAY,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,QAAG,CAAC;CAChG,CAAC;IACE,CAAC;CACJ;AArMD,8CAqMC"}
|
package/lib/generator/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAgBA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
package/lib/generator/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./webpack-generator"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./frontend-generator"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./backend-generator"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,8DAAoC;AACpC,+DAAqC;AACrC,8DAAoC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AbstractGenerator } from './abstract-generator';
|
|
2
|
-
export declare class WebpackGenerator extends AbstractGenerator {
|
|
3
|
-
generate(): Promise<void>;
|
|
4
|
-
protected shouldGenerateUserWebpackConfig(): Promise<boolean>;
|
|
5
|
-
get configPath(): string;
|
|
6
|
-
get genConfigPath(): string;
|
|
7
|
-
get genNodeConfigPath(): string;
|
|
8
|
-
protected compileWebpackConfig(): string;
|
|
9
|
-
protected compileUserWebpackConfig(): string;
|
|
10
|
-
protected compileNodeWebpackConfig(): string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=webpack-generator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-generator.d.ts","sourceRoot":"","sources":["../../src/generator/webpack-generator.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBAAa,gBAAiB,SAAQ,iBAAiB;IAE7C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAUf,+BAA+B,IAAI,OAAO,CAAC,OAAO,CAAC;IAQnE,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,SAAS,CAAC,oBAAoB,IAAI,MAAM;IA0QxC,SAAS,CAAC,wBAAwB,IAAI,MAAM;IAyB5C,SAAS,CAAC,wBAAwB,IAAI,MAAM;CAyL/C"}
|