Compare commits

...

3 Commits

Author SHA1 Message Date
Olivier Benz acf98f4c28
Merge 4744383b8a into 6b4b3e0c89 2024-10-16 19:16:06 +00:00
Asher 4744383b8a
Fix import of server-main.js 2024-10-16 11:15:57 -08:00
Asher 6b4b3e0c89
v4.93.1 2024-10-04 15:31:14 -08:00
7 changed files with 109 additions and 17 deletions

View File

@ -22,6 +22,18 @@ Code v99.99.999
## Unreleased ## Unreleased
## [4.93.1](https://github.com/coder/code-server/releases/tag/v4.93.1) - 2024-09-23
Code v1.93.1
### Changed
- Updated to Code 1.93.1.
### Added
- Added `--abs-proxy-base-path` flag for when code-server is not at the root.
## [4.92.2](https://github.com/coder/code-server/releases/tag/v4.92.2) - 2024-08-19 ## [4.92.2](https://github.com/coder/code-server/releases/tag/v4.92.2) - 2024-08-19
Code v1.92.2 Code v1.92.2

View File

@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 3.23.0 version: 3.24.0
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 4.92.2 appVersion: 4.93.1

View File

@ -6,7 +6,7 @@ replicaCount: 1
image: image:
repository: codercom/code-server repository: codercom/code-server
tag: '4.92.2' tag: '4.93.1'
pullPolicy: Always pullPolicy: Always
# Specifies one or more secrets to be used when pulling images from a # Specifies one or more secrets to be used when pulling images from a

View File

@ -272,18 +272,98 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
embedderIdentifier: 'server-distro', embedderIdentifier: 'server-distro',
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? { extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
...this._productService.extensionsGallery, ...this._productService.extensionsGallery,
Index: code-server/lib/vscode/src/server-main.js Index: code-server/lib/vscode/src/code-server.js
=================================================================== ===================================================================
--- code-server.orig/lib/vscode/src/server-main.js --- /dev/null
+++ code-server/lib/vscode/src/server-main.js +++ code-server/lib/vscode/src/code-server.js
@@ -339,4 +339,9 @@ function prompt(question) { @@ -0,0 +1,66 @@
}); +// This is a copy of server-main.js (the parts we use), before it was converted
} +// to ESM. Directly importing it in code-server has proven difficult. We will
+// need to to consider some new options going forward.
-start(); +//
+// 1. Convert code-server to ESM (best option?).
+// 2. Do not import, fork a process, and communicate via IPC.
+
+// @ts-check
+'use strict';
+
+/**
+ * @import { INLSConfiguration } from './vs/nls'
+ */
+
+// Keep bootstrap-amd.js from redefining 'fs'.
+delete process.env['ELECTRON_RUN_AS_NODE'];
+
+const path = require('path');
+const performance = require('perf_hooks').performance;
+const bootstrapNode = require('./bootstrap-node');
+const bootstrapAmd = require('./bootstrap-amd');
+const { resolveNLSConfiguration } = require('./vs/base/node/nls');
+const product = require('./bootstrap-meta').product;
+const perf = require(`./vs/base/common/performance`);
+
+perf.mark('code/server/start');
+// @ts-ignore
+global.vscodeServerStartTime = performance.now();
+
+/**
+ * @param {INLSConfiguration} nlsConfiguration
+ * @returns { Promise<typeof import('./vs/server/node/server.main')> }
+ */
+function loadCode(nlsConfiguration) {
+ return new Promise((resolve, reject) => {
+
+ /** @type {INLSConfiguration} */
+ process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required for `bootstrap-amd` to pick up NLS messages
+
+ // See https://github.com/microsoft/vscode-remote-release/issues/6543
+ // We would normally install a SIGPIPE listener in bootstrap-node.js
+ // But in certain situations, the console itself can be in a broken pipe state
+ // so logging SIGPIPE to the console will cause an infinite async loop
+ process.env['VSCODE_HANDLES_SIGPIPE'] = 'true';
+
+ if (process.env['VSCODE_DEV']) {
+ // When running out of sources, we need to load node modules from remote/node_modules,
+ // which are compiled against nodejs, not electron
+ process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || path.join(__dirname, '..', 'remote', 'node_modules');
+ bootstrapNode.devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
+ } else {
+ delete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];
+ }
+ bootstrapAmd.load('vs/server/node/server.main', resolve, reject);
+ });
+}
+
+/**
+ * @returns { Promise<typeof import('./vs/server/node/server.main')> }
+ */
+async function loadCodeWithNls() { +async function loadCodeWithNls() {
+ const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname }); + const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: __dirname });
+ return loadCode(nlsConfiguration); + return loadCode(nlsConfiguration);
+} +}
+ +
+module.exports.loadCodeWithNls = loadCodeWithNls; +module.exports.loadCodeWithNls = loadCodeWithNls;
Index: code-server/lib/vscode/build/gulpfile.reh.js
===================================================================
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
+++ code-server/lib/vscode/build/gulpfile.reh.js
@@ -164,6 +164,7 @@ const serverWithWebEntryPoints = [
const commonJSEntryPoints = [
'out-build/server-main.js',
+ 'out-build/code-server.js',
'out-build/server-cli.js',
'out-build/bootstrap-fork.js',
];
Index: code-server/lib/vscode/src/tsconfig.json
===================================================================
--- code-server.orig/lib/vscode/src/tsconfig.json
+++ code-server/lib/vscode/src/tsconfig.json
@@ -36,6 +36,7 @@
"./bootstrap-window.js",
"./cli.js",
"./main.js",
+ "./code-server.js",
"./server-main.js",
"./server-cli.js",
"./vs/base/common/jsonc.js",

View File

@ -49,7 +49,7 @@ export interface OpenCommandPipeArgs {
export const runCodeCli = async (args: DefaultedArgs): Promise<void> => { export const runCodeCli = async (args: DefaultedArgs): Promise<void> => {
logger.debug("Running Code CLI") logger.debug("Running Code CLI")
try { try {
const mod = require(path.join(vsRootPath, "out/server-main")) as VSCodeModule const mod = require(path.join(vsRootPath, "out/code-server")) as VSCodeModule
const serverModule = await mod.loadCodeWithNls() const serverModule = await mod.loadCodeWithNls()
await serverModule.spawnCli(await toCodeArgs(args)) await serverModule.spawnCli(await toCodeArgs(args))
// Rather than have the caller handle errors and exit, spawnCli will exit // Rather than have the caller handle errors and exit, spawnCli will exit

View File

@ -41,19 +41,19 @@ export interface IVSCodeServerAPI {
*/ */
export type VSCodeModule = { export type VSCodeModule = {
// See ../../../lib/vscode/src/server-main.js:339. // See ../../../lib/vscode/src/server-main.js:339.
loadCodeWithNls(): { loadCodeWithNls(): Promise<{
// See ../../../lib/vscode/src/vs/server/node/server.main.ts:72. // See ../../../lib/vscode/src/vs/server/node/server.main.ts:72.
createServer(address: string | net.AddressInfo | null, args: CodeArgs): Promise<IVSCodeServerAPI> createServer(address: string | net.AddressInfo | null, args: CodeArgs): Promise<IVSCodeServerAPI>
// See ../../../lib/vscode/src/vs/server/node/server.main.ts:65. // See ../../../lib/vscode/src/vs/server/node/server.main.ts:65.
spawnCli(args: CodeArgs): Promise<void> spawnCli(args: CodeArgs): Promise<void>
} }>
} }
/** /**
* Load then create the VS Code server. * Load then create the VS Code server.
*/ */
async function loadVSCode(req: express.Request): Promise<IVSCodeServerAPI> { async function loadVSCode(req: express.Request): Promise<IVSCodeServerAPI> {
const mod = require(path.join(vsRootPath, "out/server-main")) as VSCodeModule const mod = require(path.join(vsRootPath, "out/code-server")) as VSCodeModule
const serverModule = await mod.loadCodeWithNls() const serverModule = await mod.loadCodeWithNls()
return serverModule.createServer(null, { return serverModule.createServer(null, {
...(await toCodeArgs(req.args)), ...(await toCodeArgs(req.args)),

View File

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es2022",
"lib": ["es2020", "dom", "dom.iterable"], "lib": ["es2022", "dom", "dom.iterable"],
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"strict": true, "strict": true,