-
Notifications
You must be signed in to change notification settings - Fork 6k
Plugin additions #2622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin additions #2622
Conversation
c456a86
to
ddddcff
Compare
Dropping my plugin thoughts here. OverallWe want to make the code-server plugin ecosystem as intuitive and easy as possible for plugin authors. Sub-modules are a headache so we shouldn't go that route. I think this new architecture (repo is private) looks like the right direction for us to go in. EducationWe probably want to work with @bpmct to create some education around code-server plugins. We'll want it to live in both the
Further ReadingAs we continue to iterate on top of the plugin ecosystem, we should take inspiration from other projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks great 🎉 I left a bunch of questions, comments but all are non-blocking.
@jsjoeio thanks for the heads up. We'll sync on this on Wednesday :) |
The other plugins in my path were causing the tests to fail.
1a1d131
to
0241c7d
Compare
In case they need to map it to something else.
This is used by some of our services.
Same reasoning used when exposing Express.
So plugins can pass the logger around.
This way tests that import the http utilities but not the routes won't error due to missing types.
This is mainly so they can get relative paths in their HTML, in particular code-server's static base so they can use the favicon and service worker.
This will let them throw and show nice errors more easily.
Otherwise it consumes the body and plugins won't be able to do things like proxy POST requests.
0241c7d
to
9647d65
Compare
I rebased on master and resolved comments as well as fixed a problem with proxying inside a plugin (see the last five commits). However, for some reason in Jest the |
This can affect the test behavior and results.
9f0e913
to
e4e0ac4
Compare
test/plugin.test.ts
Outdated
import * as apps from "../src/node/routes/apps" | ||
import * as httpserver from "./httpserver" | ||
const fsp = fs.promises | ||
|
||
// Jest overrides `require` so our usual override doesn't work. | ||
jest.mock("code-server", () => codeServer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the magic line!
Somehow I managed not to commit this earlier.
This fixes the lint script but unfortunately breaks my editor.
@@ -9,7 +9,7 @@ import * as httpserver from "./httpserver" | |||
const fsp = fs.promises | |||
|
|||
// Jest overrides `require` so our usual override doesn't work. | |||
jest.mock("code-server", () => codeServer) | |||
jest.mock("code-server", () => codeServer, { virtual: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual mocks – mocks of modules that don't exist anywhere in the system
🤯 TIL what a virtual
mock is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha yeah idk why it was passing locally without this for me though. 🤷
The main thing here was adding support for websocket routes and for disposing. The rest was mostly exposing some things so plugins don't have to recreate or reimport them.