Compare commits

...

8 Commits

Author SHA1 Message Date
Asher 1c009e0ac9
Fix localization 2024-10-16 23:01:57 -08:00
Asher ed3c4e79fc
Wait for proxy URI 2024-10-16 22:45:23 -08:00
Asher 39d29fcf91
Remove proxy test timeout 2024-10-16 22:25:57 -08:00
Asher 7b1ddc10cd
Wait for markdown preview selector 2024-10-16 22:03:22 -08:00
Asher 90899f07f8
Preserve package-lock.json when shrinkwrapping 2024-10-16 20:36:43 -08:00
Asher 3f67c0ebed
Format 2024-10-16 20:24:48 -08:00
Asher 5eb1d84e48
Update import paths 2024-10-16 19:49:04 -08:00
Asher e4ceeabe69
Fix import of server-main.js 2024-10-16 18:49:45 -08:00
11 changed files with 74 additions and 51 deletions

View File

@ -371,7 +371,7 @@ jobs:
- run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy --global-timeout 840000
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
- if: always()
run: sudo ~/.cache/caddy/caddy stop --config ./ci/Caddyfile

View File

@ -91,17 +91,17 @@ bundle_vscode() {
rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
# Use the package.json for the web/remote server. It does not have the right
# version though so pull that from the main package.json.
jq --slurp '.[0] * {version: .[1].version}' \
# Merge the package.json for the web/remote server so we can include
# dependencies, since we want to ship this via NPM.
jq --slurp '.[0] * .[1]' \
"$VSCODE_SRC_PATH/remote/package.json" \
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
mv "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json"
"$VSCODE_OUT_PATH/package.json" > "$VSCODE_OUT_PATH/package.json.merged"
mv "$VSCODE_OUT_PATH/package.json.merged" "$VSCODE_OUT_PATH/package.json"
cp "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json"
# Include global extension dependencies as well.
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
mv "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json"
cp "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json"
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
}
@ -119,15 +119,21 @@ create_shrinkwraps() {
# We first generate the shrinkwrap file for code-server itself - which is the
# current directory.
cp package-lock.json package-lock.json.temp
npm shrinkwrap
mv package-lock.json.temp package-lock.json
# Then the shrinkwrap files for the bundled VS Code.
pushd "$VSCODE_SRC_PATH/remote/"
cp package-lock.json package-lock.json.temp
npm shrinkwrap
mv package-lock.json.temp package-lock.json
popd
pushd "$VSCODE_SRC_PATH/extensions/"
cp package-lock.json package-lock.json.temp
npm shrinkwrap
mv package-lock.json.temp package-lock.json
popd
}

View File

@ -20,18 +20,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1727104955,
"narHash": "sha256-m6kgjR4zAwyMe1Pn4RGXLCzArtoBp1qzhb2AUlPeVh4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d266adc5a77ec8c10ed941c7251b2673004dbd62",
"type": "github"
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"path": "/nix/store/j8pbrsb3nybdap3hhg9kw0ffqd4rlbx6-source",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "path"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {

View File

@ -363,3 +363,16 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js
// Process monitor
'out-build/vs/base/node/cpuUsage.sh',
Index: code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
+++ code-server/lib/vscode/src/vs/workbench/workbench.web.main.internal.ts
@@ -52,7 +52,7 @@ import './services/dialogs/browser/fileD
import './services/host/browser/browserHostService.js';
import './services/lifecycle/browser/lifecycleService.js';
import './services/clipboard/browser/clipboardService.js';
-import './services/localization/browser/localeService.js';
+import './services/localization/electron-sandbox/localeService.js';
import './services/path/browser/pathService.js';
import './services/themes/browser/browserHostColorSchemeService.js';
import './services/encryption/browser/encryptionService.js';

View File

@ -17,9 +17,9 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
@@ -1,7 +1,10 @@
import { Disposable } from 'vs/base/common/lifecycle';
+import { localize } from 'vs/nls';
+import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { Disposable } from "../../base/common/lifecycle.js";
+import { localize } from '../../nls.js';
+import { INotificationService, Severity } from '../../platform/notification/common/notification.js';
export class CodeServerClient extends Disposable {
constructor (

View File

@ -126,7 +126,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
--- /dev/null
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
@@ -0,0 +1,46 @@
+import { Disposable } from 'vs/base/common/lifecycle';
+import { Disposable } from "../../base/common/lifecycle.js";
+
+export class CodeServerClient extends Disposable {
+ constructor (
@ -276,7 +276,7 @@ Index: code-server/lib/vscode/src/server-main.js
===================================================================
--- code-server.orig/lib/vscode/src/server-main.js
+++ code-server/lib/vscode/src/server-main.js
@@ -339,4 +339,9 @@ function prompt(question) {
@@ -339,4 +339,15 @@ function prompt(question) {
});
}
@ -286,4 +286,10 @@ Index: code-server/lib/vscode/src/server-main.js
+ return loadCode(nlsConfiguration);
+}
+
+module.exports.loadCodeWithNls = loadCodeWithNls;
+// This alias prevents the name getting mangled during obfuscation which would
+// make it difficult to import.
+export { loadCodeWithNls as loadCodeWithNls };
+
+if (!process.env.CODE_SERVER_PARENT_PID) {
+ start();
+}

View File

@ -53,14 +53,14 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
@@ -1,11 +1,15 @@
import { Disposable } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
+import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
+import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IProductService } from 'vs/platform/product/common/productService';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { Disposable } from "../../base/common/lifecycle.js";
import { localize } from '../../nls.js';
+import { MenuId, MenuRegistry } from '../../platform/actions/common/actions.js';
+import { CommandsRegistry } from '../../platform/commands/common/commands.js';
import { ILogService } from '../../platform/log/common/log.js';
import { INotificationService, Severity } from '../../platform/notification/common/notification.js';
import { IProductService } from '../../platform/product/common/productService.js';
import { IStorageService, StorageScope, StorageTarget } from '../../platform/storage/common/storage.js';
export class CodeServerClient extends Disposable {
+ static LOGOUT_COMMAND_ID = 'code-server.logout';

View File

@ -13,12 +13,12 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
--- code-server.orig/lib/vscode/src/vs/workbench/browser/client.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
@@ -1,10 +1,16 @@
import { Disposable } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
+import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
+import { IProductService } from 'vs/platform/product/common/productService';
+import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { Disposable } from "../../base/common/lifecycle.js";
import { localize } from '../../nls.js';
+import { ILogService } from '../../platform/log/common/log.js';
import { INotificationService, Severity } from '../../platform/notification/common/notification.js';
+import { IProductService } from '../../platform/product/common/productService.js';
+import { IStorageService, StorageScope, StorageTarget } from '../../platform/storage/common/storage.js';
export class CodeServerClient extends Disposable {
constructor (

View File

@ -41,19 +41,25 @@ export interface IVSCodeServerAPI {
*/
export type VSCodeModule = {
// See ../../../lib/vscode/src/server-main.js:339.
loadCodeWithNls(): {
loadCodeWithNls(): Promise<{
// See ../../../lib/vscode/src/vs/server/node/server.main.ts:72.
createServer(address: string | net.AddressInfo | null, args: CodeArgs): Promise<IVSCodeServerAPI>
// See ../../../lib/vscode/src/vs/server/node/server.main.ts:65.
spawnCli(args: CodeArgs): Promise<void>
}
}>
}
/**
* Load then create the VS Code server.
*/
async function loadVSCode(req: express.Request): Promise<IVSCodeServerAPI> {
const mod = require(path.join(vsRootPath, "out/server-main")) as VSCodeModule
// Since server-main.js is an ES module, we have to use `import`. However,
// tsc will transpile this to `require` unless we change our module type,
// which will also require that we switch to ESM, since a hybrid approach
// breaks importing `rotating-file-stream` for some reason. To work around
// this, use `eval` for now, but we should consider switching to ESM.
const modPath = path.join(vsRootPath, "out/server-main.js")
const mod = (await eval(`import("${modPath}")`)) as VSCodeModule
const serverModule = await mod.loadCodeWithNls()
return serverModule.createServer(null, {
...(await toCodeArgs(req.args)),

View File

@ -11,11 +11,9 @@ function runTestExtensionTests() {
await codeServerPage.waitForTestExtensionLoaded()
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI")
await codeServerPage.page.waitForSelector("text=proxyUri", { timeout: 3000 })
const text = await codeServerPage.page.locator("text=proxyUri").first().textContent()
// Remove end slash in address
// Remove end slash in address.
const normalizedAddress = address.replace(/\/+$/, "")
expect(text).toBe(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`)
await codeServerPage.page.getByText(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}/`)
})
}

View File

@ -18,11 +18,8 @@ describe("Webviews", ["--disable-workspace-trust"], {}, () => {
// It's an iframe within an iframe
// so we have to do .frameLocator twice
const renderedText = await codeServerPage.page
.frameLocator("iframe.webview.ready")
.frameLocator("#active-frame")
.locator("text=Hello world")
expect(renderedText).toBeVisible()
await expect(
codeServerPage.page.frameLocator("iframe.webview.ready").frameLocator("#active-frame").getByText("Hello world"),
).toBeVisible()
})
})