Expose proxy server to plugins

This commit is contained in:
Asher 2021-01-19 16:43:36 -06:00
parent a8e928798b
commit f6b04c7c29
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
2 changed files with 5 additions and 1 deletions

View File

@ -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])

View File

@ -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.
*