Expose proxy server to plugins
This commit is contained in:
parent
a8e928798b
commit
f6b04c7c29
@ -1,10 +1,11 @@
|
|||||||
import { Logger, field } from "@coder/logger"
|
import { field, Logger } from "@coder/logger"
|
||||||
import * as express from "express"
|
import * as express from "express"
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
import * as path from "path"
|
import * as path from "path"
|
||||||
import * as semver from "semver"
|
import * as semver from "semver"
|
||||||
import * as pluginapi from "../../typings/pluginapi"
|
import * as pluginapi from "../../typings/pluginapi"
|
||||||
import { version } from "./constants"
|
import { version } from "./constants"
|
||||||
|
import { proxy } from "./proxy"
|
||||||
import * as util from "./util"
|
import * as util from "./util"
|
||||||
const fsp = fs.promises
|
const fsp = fs.promises
|
||||||
|
|
||||||
@ -19,6 +20,7 @@ require("module")._load = function (request: string, parent: object, isMain: boo
|
|||||||
return {
|
return {
|
||||||
express,
|
express,
|
||||||
field,
|
field,
|
||||||
|
proxy,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return originalLoad.apply(this, [request, parent, isMain])
|
return originalLoad.apply(this, [request, parent, isMain])
|
||||||
|
2
typings/pluginapi.d.ts
vendored
2
typings/pluginapi.d.ts
vendored
@ -94,6 +94,8 @@ export { express }
|
|||||||
*/
|
*/
|
||||||
export { field }
|
export { field }
|
||||||
|
|
||||||
|
export const proxy: ProxyServer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Your plugin module must have a top level export "plugin" that implements this interface.
|
* Your plugin module must have a top level export "plugin" that implements this interface.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user