Skip to content

Commit a8e9287

Browse files
committed
Re-export express for plugins
1 parent 5f1fab7 commit a8e9287

File tree

5 files changed

+13
-372
lines changed

5 files changed

+13
-372
lines changed

‎src/node/plugin.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const originalLoad = require("module")._load
1717
require("module")._load = function (request: string, parent: object, isMain: boolean): any {
1818
if (request === "code-server") {
1919
return {
20+
express,
2021
field,
2122
}
2223
}

‎test/test-plugin/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@
1212
},
1313
"scripts": {
1414
"build": "tsc"
15-
},
16-
"dependencies": {
17-
"express": "^4.17.1"
1815
}
1916
}

‎test/test-plugin/src/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as cs from "code-server"
2-
import * as express from "express"
32
import * as fspath from "path"
43

54
export const plugin: cs.Plugin = {
@@ -13,11 +12,11 @@ export const plugin: cs.Plugin = {
1312
},
1413

1514
router() {
16-
const r = express.Router()
17-
r.get("/test-app", (req, res) => {
15+
const r = cs.express.Router()
16+
r.get("/test-app", (_, res) => {
1817
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
1918
})
20-
r.get("/goland/icon.svg", (req, res) => {
19+
r.get("/goland/icon.svg", (_, res) => {
2120
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
2221
})
2322
return r

0 commit comments

Comments
 (0)