Extension host (#20)

* Implement net.Server

* Move Socket class into Client

This way we don't need to expose anything.

* Remove some unused imports

* Pass environment variables to bootstrap fork

* Add debug log for when socket disconnects from server

* Use VSCODE_ALLOW_IO for shared process only

* Extension host can send messages now

* Support callback for logging

This lets us do potentially expensive operations which will only be
performed if the log level is sufficiently low.

* Stop extension host from committing suicide

* Blank line

* Add static serve (#21)

* Add extension URLs

* how did i remove this

* Fix writing an empty string

* Implement dialogs on window service
This commit is contained in:
Asher
2019-01-25 18:18:21 -06:00
committed by Kyle Carberry
parent e43e7b36e7
commit c6d35d098a
27 changed files with 431 additions and 793 deletions

View File

@ -1,10 +1,11 @@
import { field, logger } from "@coder/logger";
import { logger } from "@coder/logger";
import { ReadWriteConnection } from "@coder/protocol";
import { Server, ServerOptions } from "@coder/protocol/src/node/server";
import { NewSessionMessage } from '@coder/protocol/src/proto';
import { ChildProcess } from "child_process";
import * as express from "express";
import * as http from "http";
import * as path from "path";
import * as ws from "ws";
import { forkModule } from "./vscode/bootstrapFork";
@ -46,7 +47,11 @@ export const createApp = (registerMiddleware?: (app: express.Application) => voi
forkProvider: (message: NewSessionMessage): ChildProcess => {
let proc: ChildProcess;
if (message.getIsBootstrapFork()) {
proc = forkModule(message.getCommand());
const env: NodeJS.ProcessEnv = {};
message.getEnvMap().forEach((value, key) => {
env[key] = value;
});
proc = forkModule(message.getCommand(), env);
} else {
throw new Error("No support for non bootstrap-forking yet");
}
@ -56,14 +61,7 @@ export const createApp = (registerMiddleware?: (app: express.Application) => voi
} : undefined);
});
/**
* We should static-serve the `web` package at this point.
*/
app.get("/", (req, res, next) => {
res.write("Example! :)");
res.status(200);
res.end();
});
app.use(express.static(path.join(__dirname, "../build/web")));
return {
express: app,