From f6b04c7c29b77d8051158ca98122a7d531f230a5 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 19 Jan 2021 16:43:36 -0600 Subject: [PATCH] Expose proxy server to plugins --- src/node/plugin.ts | 4 +++- typings/pluginapi.d.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index cdc5919f..c2e43173 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -1,10 +1,11 @@ -import { Logger, field } from "@coder/logger" +import { field, Logger } from "@coder/logger" import * as express from "express" import * as fs from "fs" import * as path from "path" import * as semver from "semver" import * as pluginapi from "../../typings/pluginapi" import { version } from "./constants" +import { proxy } from "./proxy" import * as util from "./util" const fsp = fs.promises @@ -19,6 +20,7 @@ require("module")._load = function (request: string, parent: object, isMain: boo return { express, field, + proxy, } } return originalLoad.apply(this, [request, parent, isMain]) diff --git a/typings/pluginapi.d.ts b/typings/pluginapi.d.ts index 5dd2a066..14d6cb48 100644 --- a/typings/pluginapi.d.ts +++ b/typings/pluginapi.d.ts @@ -94,6 +94,8 @@ export { express } */ export { field } +export const proxy: ProxyServer + /** * Your plugin module must have a top level export "plugin" that implements this interface. *