Initialize remote IDE scaffold
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
// @ts-check
|
||||
const { performance } = require('perf_hooks');
|
||||
const startupLog = (milestone) => console.debug(`Backend main: ${milestone} [${(performance.now() / 1000).toFixed(3)} s since backend process start]`);
|
||||
startupLog('entry point loaded');
|
||||
const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');
|
||||
const main = require('@theia/core/lib/node/main');
|
||||
|
||||
BackendApplicationConfigProvider.set({
|
||||
"singleInstance": true,
|
||||
"frontendConnectionTimeout": 0,
|
||||
"configurationFolder": ".theia"
|
||||
});
|
||||
|
||||
globalThis.extensionInfo = [
|
||||
{
|
||||
"name": "@theia/core",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@git.zone/ide-extension-opencode",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
{
|
||||
"name": "@git.zone/ide-extension-product",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
{
|
||||
"name": "@git.zone/ide-extension-remote",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/variable-resolver",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/editor",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/filesystem",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/workspace",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/markers",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/messages",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/outline-view",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/monaco",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/navigator",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/output",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/ai-core",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/ai-mcp",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/bulk-edit",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/callhierarchy",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/console",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/process",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/file-search",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/terminal",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/userstorage",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/preferences",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/terminal-manager",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/task",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/test",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/debug",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/editor-preview",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/notebook",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/scm",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/search-in-workspace",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/timeline",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/typehierarchy",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/plugin-ext",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/plugin-ext-vscode",
|
||||
"version": "1.71.0"
|
||||
},
|
||||
{
|
||||
"name": "@theia/vsx-registry",
|
||||
"version": "1.71.0"
|
||||
}
|
||||
];
|
||||
|
||||
const serverModule = require('./server');
|
||||
const serverAddress = main.start(serverModule());
|
||||
|
||||
serverAddress.then((addressInfo) => {
|
||||
if (process && process.send && addressInfo) {
|
||||
process.send(addressInfo);
|
||||
}
|
||||
});
|
||||
|
||||
globalThis.serverAddress = serverAddress;
|
||||
@@ -0,0 +1,102 @@
|
||||
// @ts-check
|
||||
require('reflect-metadata');
|
||||
const { performance } = require('perf_hooks');
|
||||
const startupLog = (milestone) => console.debug(`Backend server: ${milestone} [${(performance.now() / 1000).toFixed(3)} s since backend process start]`);
|
||||
startupLog('loading modules...');
|
||||
|
||||
// Erase the ELECTRON_RUN_AS_NODE variable from the environment, else Electron apps started using Theia will pick it up.
|
||||
if ('ELECTRON_RUN_AS_NODE' in process.env) {
|
||||
delete process.env.ELECTRON_RUN_AS_NODE;
|
||||
}
|
||||
|
||||
const path = require('path');
|
||||
process.env.THEIA_APP_PROJECT_PATH = path.resolve(__dirname, '..', '..')
|
||||
const express = require('@theia/core/shared/express');
|
||||
const { Container } = require('@theia/core/shared/inversify');
|
||||
const { BackendApplication, BackendApplicationServer, CliManager } = require('@theia/core/lib/node');
|
||||
const { backendApplicationModule } = require('@theia/core/lib/node/backend-application-module');
|
||||
const { messagingBackendModule } = require('@theia/core/lib/node/messaging/messaging-backend-module');
|
||||
const { loggerBackendModule } = require('@theia/core/lib/node/logger-backend-module');
|
||||
|
||||
const container = new Container();
|
||||
container.load(backendApplicationModule);
|
||||
container.load(messagingBackendModule);
|
||||
container.load(loggerBackendModule);
|
||||
startupLog('container created');
|
||||
|
||||
function defaultServeStatic(app) {
|
||||
app.use(express.static(path.resolve(__dirname, '../../lib/frontend')))
|
||||
}
|
||||
|
||||
function load(raw) {
|
||||
return Promise.resolve(raw).then(
|
||||
module => container.load(module.default)
|
||||
);
|
||||
}
|
||||
|
||||
async function start(port, host, argv = process.argv) {
|
||||
if (!container.isBound(BackendApplicationServer)) {
|
||||
container.bind(BackendApplicationServer).toConstantValue({ configure: defaultServeStatic });
|
||||
}
|
||||
let result = undefined;
|
||||
await container.get(CliManager).initializeCli(argv.slice(2),
|
||||
() => {
|
||||
startupLog('resolving application');
|
||||
const application = container.get(BackendApplication);
|
||||
startupLog('application resolved');
|
||||
return application.configured;
|
||||
},
|
||||
async () => {
|
||||
result = container.get(BackendApplication).start(port, host);
|
||||
});
|
||||
if (result) {
|
||||
return result;
|
||||
} else {
|
||||
return Promise.reject(0);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = async (port, host, argv) => {
|
||||
try {
|
||||
await load(require('@theia/core/lib/node/i18n/i18n-backend-module'));
|
||||
await load(require('@theia/core/lib/node/hosting/backend-hosting-module'));
|
||||
await load(require('@theia/core/lib/node/request/backend-request-module'));
|
||||
await load(require('@git.zone/ide-extension-opencode/lib/node/gitzone-opencode-backend-module'));
|
||||
await load(require('@git.zone/ide-extension-remote/lib/node/gitzone-remote-backend-module'));
|
||||
await load(require('@theia/editor/lib/node/editor-backend-module'));
|
||||
await load(require('@theia/filesystem/lib/node/filesystem-backend-module'));
|
||||
await load(require('@theia/filesystem/lib/node/download/file-download-backend-module'));
|
||||
await load(require('@theia/workspace/lib/node/workspace-backend-module'));
|
||||
await load(require('@theia/markers/lib/node/problem-backend-module'));
|
||||
await load(require('@theia/messages/lib/node/messages-backend-module'));
|
||||
await load(require('@theia/navigator/lib/node/navigator-backend-module'));
|
||||
await load(require('@theia/output/lib/node/output-backend-module'));
|
||||
await load(require('@theia/ai-core/lib/node/ai-core-backend-module'));
|
||||
await load(require('@theia/ai-mcp/lib/node/mcp-backend-module'));
|
||||
await load(require('@theia/process/lib/common/process-common-module'));
|
||||
await load(require('@theia/process/lib/node/process-backend-module'));
|
||||
await load(require('@theia/file-search/lib/node/file-search-backend-module'));
|
||||
await load(require('@theia/terminal/lib/node/terminal-backend-module'));
|
||||
await load(require('@theia/preferences/lib/node/preference-backend-module'));
|
||||
await load(require('@theia/task/lib/node/task-backend-module'));
|
||||
await load(require('@theia/test/lib/node/test-backend-module'));
|
||||
await load(require('@theia/debug/lib/node/debug-backend-module'));
|
||||
await load(require('@theia/editor-preview/lib/node/editor-preview-backend-module'));
|
||||
await load(require('@theia/notebook/lib/node/notebook-backend-module'));
|
||||
await load(require('@theia/scm/lib/node/scm-backend-module'));
|
||||
await load(require('@theia/search-in-workspace/lib/node/search-in-workspace-backend-module'));
|
||||
await load(require('@theia/plugin-ext/lib/plugin-ext-backend-module'));
|
||||
await load(require('@theia/plugin-ext-vscode/lib/node/plugin-vscode-backend-module'));
|
||||
await load(require('@theia/vsx-registry/lib/common/vsx-registry-common-module'));
|
||||
await load(require('@theia/vsx-registry/lib/node/vsx-registry-backend-module'));
|
||||
startupLog('modules loaded');
|
||||
return await start(port, host, argv);
|
||||
} catch (error) {
|
||||
if (typeof error !== 'number') {
|
||||
console.error('Failed to start the backend application:');
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>Git.Zone IDE</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="theia-preload"></div>
|
||||
<script type="text/javascript" src="./bundle.js" charset="utf-8"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,145 @@
|
||||
// @ts-check
|
||||
require('reflect-metadata');
|
||||
const startupLog = (milestone) => console.debug(`Frontend: ${milestone} [${(performance.now() / 1000).toFixed(3)} s since frontend page start]`);
|
||||
startupLog('loading modules...');
|
||||
const { Container } = require('@theia/core/shared/inversify');
|
||||
const { FrontendApplicationConfigProvider } = require('@theia/core/lib/browser/frontend-application-config-provider');
|
||||
|
||||
FrontendApplicationConfigProvider.set({
|
||||
"applicationName": "Git.Zone IDE",
|
||||
"defaultTheme": {
|
||||
"light": "light",
|
||||
"dark": "dark"
|
||||
},
|
||||
"defaultIconTheme": "theia-file-icons",
|
||||
"electron": {
|
||||
"windowOptions": {},
|
||||
"showWindowEarly": true,
|
||||
"splashScreenOptions": {},
|
||||
"uriScheme": "theia"
|
||||
},
|
||||
"defaultLocale": "",
|
||||
"validatePreferencesSchema": true,
|
||||
"reloadOnReconnect": false,
|
||||
"uriScheme": "theia",
|
||||
"preferencesDirName": ".git-zone-ide"
|
||||
});
|
||||
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
return './editor.worker.js';
|
||||
}
|
||||
}
|
||||
|
||||
function load(container, jsModule) {
|
||||
return Promise.resolve(jsModule)
|
||||
.then(containerModule => container.load(containerModule.default));
|
||||
}
|
||||
|
||||
async function preload(container) {
|
||||
try {
|
||||
await load(container, import('@theia/core/lib/browser/preload/preload-module'));
|
||||
const { Preloader } = require('@theia/core/lib/browser/preload/preloader');
|
||||
const preloader = container.get(Preloader);
|
||||
await preloader.initialize();
|
||||
} catch (reason) {
|
||||
console.error('Failed to run preload scripts.');
|
||||
if (reason) {
|
||||
console.error(reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (async () => {
|
||||
const { messagingFrontendModule } = require('@theia/core/lib/browser/messaging/messaging-frontend-module');
|
||||
const container = new Container();
|
||||
container.load(messagingFrontendModule);
|
||||
|
||||
|
||||
startupLog('container created');
|
||||
|
||||
await preload(container);
|
||||
startupLog('preloaded');
|
||||
|
||||
|
||||
const { MonacoInit } = require('@theia/monaco/lib/browser/monaco-init');
|
||||
;
|
||||
|
||||
const { FrontendApplication } = require('@theia/core/lib/browser');
|
||||
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
|
||||
const { loggerFrontendModule } = require('@theia/core/lib/browser/logger-frontend-module');
|
||||
|
||||
container.load(frontendApplicationModule);
|
||||
undefined
|
||||
|
||||
container.load(loggerFrontendModule);
|
||||
|
||||
|
||||
startupLog('core modules loaded');
|
||||
|
||||
try {
|
||||
await load(container, import('@theia/core/lib/browser/i18n/i18n-frontend-module'));
|
||||
await load(container, import('@theia/core/lib/browser/menu/browser-menu-module'));
|
||||
await load(container, import('@theia/core/lib/browser/window/browser-window-module'));
|
||||
await load(container, import('@theia/core/lib/browser/keyboard/browser-keyboard-module'));
|
||||
await load(container, import('@theia/core/lib/browser/request/browser-request-module'));
|
||||
await load(container, import('@git.zone/ide-extension-opencode/lib/browser/gitzone-opencode-frontend-module'));
|
||||
await load(container, import('@git.zone/ide-extension-product/lib/browser/gitzone-product-frontend-module'));
|
||||
await load(container, import('@git.zone/ide-extension-remote/lib/browser/gitzone-remote-frontend-module'));
|
||||
await load(container, import('@theia/variable-resolver/lib/browser/variable-resolver-frontend-module'));
|
||||
await load(container, import('@theia/editor/lib/browser/editor-frontend-module'));
|
||||
await load(container, import('@theia/filesystem/lib/browser/filesystem-frontend-module'));
|
||||
await load(container, import('@theia/filesystem/lib/browser/download/file-download-frontend-module'));
|
||||
await load(container, import('@theia/filesystem/lib/browser/file-dialog/file-dialog-module'));
|
||||
await load(container, import('@theia/workspace/lib/browser/workspace-frontend-module'));
|
||||
await load(container, import('@theia/markers/lib/browser/problem/problem-frontend-module'));
|
||||
await load(container, import('@theia/messages/lib/browser/messages-frontend-module'));
|
||||
await load(container, import('@theia/outline-view/lib/browser/outline-view-frontend-module'));
|
||||
await load(container, import('@theia/monaco/lib/browser/monaco-frontend-module'));
|
||||
await load(container, import('@theia/navigator/lib/browser/navigator-frontend-module'));
|
||||
await load(container, import('@theia/output/lib/browser/output-frontend-module'));
|
||||
await load(container, import('@theia/ai-core/lib/browser/ai-core-frontend-module'));
|
||||
await load(container, import('@theia/ai-mcp/lib/browser/mcp-frontend-module'));
|
||||
await load(container, import('@theia/bulk-edit/lib/browser/bulk-edit-frontend-module'));
|
||||
await load(container, import('@theia/callhierarchy/lib/browser/callhierarchy-frontend-module'));
|
||||
await load(container, import('@theia/console/lib/browser/console-frontend-module'));
|
||||
await load(container, import('@theia/process/lib/common/process-common-module'));
|
||||
await load(container, import('@theia/file-search/lib/browser/file-search-frontend-module'));
|
||||
await load(container, import('@theia/terminal/lib/browser/terminal-frontend-module'));
|
||||
await load(container, import('@theia/userstorage/lib/browser/user-storage-frontend-module'));
|
||||
await load(container, import('@theia/preferences/lib/browser/preference-frontend-module'));
|
||||
await load(container, import('@theia/terminal-manager/lib/browser/terminal-manager-frontend-module'));
|
||||
await load(container, import('@theia/task/lib/browser/task-frontend-module'));
|
||||
await load(container, import('@theia/test/lib/browser/view/test-view-frontend-module'));
|
||||
await load(container, import('@theia/debug/lib/browser/debug-frontend-module'));
|
||||
await load(container, import('@theia/editor-preview/lib/browser/editor-preview-frontend-module'));
|
||||
await load(container, import('@theia/notebook/lib/browser/notebook-frontend-module'));
|
||||
await load(container, import('@theia/scm/lib/browser/scm-frontend-module'));
|
||||
await load(container, import('@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-module'));
|
||||
await load(container, import('@theia/timeline/lib/browser/timeline-frontend-module'));
|
||||
await load(container, import('@theia/typehierarchy/lib/browser/typehierarchy-frontend-module'));
|
||||
await load(container, import('@theia/plugin-ext/lib/plugin-ext-frontend-module'));
|
||||
await load(container, import('@theia/plugin-ext-vscode/lib/browser/plugin-vscode-frontend-module'));
|
||||
await load(container, import('@theia/vsx-registry/lib/common/vsx-registry-common-module'));
|
||||
await load(container, import('@theia/vsx-registry/lib/browser/vsx-registry-frontend-module'));
|
||||
|
||||
MonacoInit.init(container);
|
||||
;
|
||||
startupLog('modules loaded');
|
||||
await start();
|
||||
} catch (reason) {
|
||||
console.error('Failed to start the frontend application.');
|
||||
if (reason) {
|
||||
console.error(reason);
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
(window['theia'] = window['theia'] || {}).container = container;
|
||||
startupLog('resolving application');
|
||||
const application = container.get(FrontendApplication);
|
||||
startupLog('application resolved');
|
||||
return application.start();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
// @ts-check
|
||||
require('reflect-metadata');
|
||||
const { Container } = require('@theia/core/shared/inversify');
|
||||
|
||||
module.exports = Promise.resolve().then(() => {
|
||||
const { frontendApplicationModule } = require('@theia/core/lib/browser/frontend-application-module');
|
||||
const container = new Container();
|
||||
container.load(frontendApplicationModule);
|
||||
container.load(require('@theia/editor/lib/browser/editor-frontend-module').default);
|
||||
container.load(require('@theia/filesystem/lib/browser/filesystem-frontend-module').default);
|
||||
container.load(require('@theia/monaco/lib/browser/monaco-frontend-module').default);
|
||||
container.load(require('@theia/terminal/lib/browser/terminal-frontend-module').default);
|
||||
container.load(require('@theia/debug/lib/browser/debug-frontend-module').default);
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Theia — Secondary Window</title>
|
||||
<style>
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
head,
|
||||
body,
|
||||
.secondary-widget-root,
|
||||
#widget-host {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="./secondary-window.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="widget-host"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user