Add vscode via vendor package.

- Remove asar linking.
- Remove module lint check.
- Use yarn for vscode vendoring.
This commit is contained in:
Teffen Ellis 2021-09-08 15:05:49 -04:00
parent d53b4970e5
commit d7fd193c9e
32 changed files with 1531 additions and 284 deletions

View File

@ -1,4 +1 @@
name: "code-server CodeQL config" name: "code-server CodeQL config"
paths-ignore:
- lib/vscode

View File

@ -124,26 +124,26 @@ jobs:
- name: Build code-server - name: Build code-server
run: yarn build run: yarn build
# Parse the hash of the latest commit inside lib/vscode # Parse the hash of the latest commit inside vendor/modules/code-oss-dev
# use this to avoid rebuilding it if nothing changed # use this to avoid rebuilding it if nothing changed
# How it works: the `git log` command fetches the hash of the last commit # How it works: the `git log` command fetches the hash of the last commit
# that changed a file inside `lib/vscode`. If a commit changes any file in there, # that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
# the hash returned will change, and we rebuild vscode. If the hash did not change, # the hash returned will change, and we rebuild vscode. If the hash did not change,
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time. # (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes. # This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
- name: Get latest lib/vscode rev - name: Get latest vendor/modules/code-oss-dev rev
id: vscode-rev id: vscode-rev
run: echo "::set-output name=rev::$(git log -1 --format='%H' ./lib/vscode)" run: echo "::set-output name=rev::$(cat vendor/modules/code-oss-dev/package.json | jq -r .version)"
- name: Attempt to fetch vscode build from cache - name: Attempt to fetch vscode build from cache
id: cache-vscode id: cache-vscode
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
lib/vscode/.build vendor/modules/code-oss-dev/.build
lib/vscode/out-build vendor/modules/code-oss-dev/out-build
lib/vscode/out-vscode vendor/modules/code-oss-dev/out-vscode
lib/vscode/out-vscode-min vendor/modules/code-oss-dev/out-vscode-min
key: vscode-build-${{ steps.vscode-rev.outputs.rev }} key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
- name: Build vscode - name: Build vscode

3
.gitignore vendored
View File

@ -8,7 +8,8 @@ release-packages/
release-gcp/ release-gcp/
release-images/ release-images/
node_modules node_modules
/lib/vscode/node_modules.asar vendor/modules
/node_modules.asar
node-* node-*
/plugins /plugins
/lib/coder-cloud-agent /lib/coder-cloud-agent

View File

@ -143,7 +143,7 @@
"description": "Static images and the manifest live here in `src/browser/media` (see the explorer)." "description": "Static images and the manifest live here in `src/browser/media` (see the explorer)."
}, },
{ {
"directory": "lib/vscode", "directory": "vendor/modules/code-oss-dev",
"line": 1, "line": 1,
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible." "description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/cdr/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
} }

View File

@ -12,10 +12,11 @@ KEEP_MODULES="${KEEP_MODULES-0}"
main() { main() {
cd "$(dirname "${0}")/../.." cd "$(dirname "${0}")/../.."
source ./ci/lib.sh source ./ci/lib.sh
VSCODE_SRC_PATH="lib/vscode" VSCODE_SRC_PATH="vendor/modules/code-oss-dev"
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode" VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev"
mkdir -p "$RELEASE_PATH" mkdir -p "$RELEASE_PATH"
@ -24,7 +25,7 @@ main() {
rsync ./docs/README.md "$RELEASE_PATH" rsync ./docs/README.md "$RELEASE_PATH"
rsync LICENSE.txt "$RELEASE_PATH" rsync LICENSE.txt "$RELEASE_PATH"
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH" rsync ./vendor/modules/code-oss-dev/ThirdPartyNotices.txt "$RELEASE_PATH"
} }
bundle_code_server() { bundle_code_server() {
@ -98,10 +99,6 @@ EOF
# yarn to fetch node_modules if necessary without build scripts running. # yarn to fetch node_modules if necessary without build scripts running.
# We cannot use --no-scripts because we still want dependent package scripts to run. # We cannot use --no-scripts because we still want dependent package scripts to run.
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json" jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
pushd "$VSCODE_OUT_PATH"
symlink_asar
popd
} }
main "$@" main "$@"

View File

@ -7,6 +7,7 @@ export npm_config_build_from_source=true
main() { main() {
cd "$(dirname "${0}")/../.." cd "$(dirname "${0}")/../.."
source ./ci/lib.sh source ./ci/lib.sh
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone" rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
@ -32,7 +33,7 @@ main() {
# leaves a few stray symlinks. Clean them up so nfpm does not fail. # leaves a few stray symlinks. Clean them up so nfpm does not fail.
# Remove this line when its no longer needed. # Remove this line when its no longer needed.
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin" rm -fr "$RELEASE_PATH/vendor/modules/code-oss-dev/extensions/node_modules/.bin"
} }
main "$@" main "$@"

View File

@ -1,14 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Builds vscode into lib/vscode/out-vscode. # Builds vscode into vendor/modules/code-oss-dev/out-vscode.
# MINIFY controls whether a minified version of vscode is built. # MINIFY controls whether a minified version of vscode is built.
MINIFY=${MINIFY-true} MINIFY=${MINIFY-true}
main() { main() {
cd "$(dirname "${0}")/../.." cd "$(dirname "${0}")/../.."
cd lib/vscode
cd vendor/modules/code-oss-dev
yarn gulp compile-build compile-extensions-build compile-extension-media yarn gulp compile-build compile-extensions-build compile-extension-media
yarn gulp optimize --gulpfile ./coder.js yarn gulp optimize --gulpfile ./coder.js

View File

@ -6,10 +6,6 @@ main() {
source ./ci/lib.sh source ./ci/lib.sh
git clean -Xffd git clean -Xffd
pushd lib/vscode
git clean -xffd
popd
} }
main "$@" main "$@"

View File

@ -76,21 +76,10 @@ main() {
fi fi
} }
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
symlink_asar() {
rm -rf node_modules.asar
if [ "${WINDIR-}" ]; then
mklink /J node_modules.asar node_modules
else
ln -s node_modules node_modules.asar
fi
}
vscode_yarn() { vscode_yarn() {
cd lib/vscode cd node_modules
yarn --production --frozen-lockfile
symlink_asar yarn --production --frozen-lockfile
cd extensions cd extensions
yarn --production --frozen-lockfile yarn --production --frozen-lockfile

View File

@ -19,7 +19,7 @@ main() {
"*.sh" "*.sh"
) )
prettier --write --loglevel=warn $( prettier --write --loglevel=warn $(
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart' git ls-files "${prettierExts[@]}" | grep -v "vendor/modules/code-oss-dev" | grep -v 'helm-chart'
) )
doctoc --title '# FAQ' docs/FAQ.md > /dev/null doctoc --title '# FAQ' docs/FAQ.md > /dev/null

View File

@ -4,17 +4,14 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode") eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "vendor/modules")
stylelint $(git ls-files "*.css" | grep -v "lib/vscode") stylelint $(git ls-files "*.css" | grep -v "vendor/modules")
tsc --noEmit --skipLibCheck tsc --noEmit --skipLibCheck
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode") shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "vendor/modules")
if command -v helm && helm kubeval --help > /dev/null; then if command -v helm && helm kubeval --help > /dev/null; then
helm kubeval ci/helm-chart helm kubeval ci/helm-chart
fi fi
cd lib/vscode
# Run this periodically in vanilla VS code to make sure we don't add any more warnings.
yarn -s eslint --max-warnings=3
cd "$OLDPWD" cd "$OLDPWD"
} }

View File

@ -3,17 +3,19 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
source ./ci/lib.sh
# This installs the dependencies needed for testing echo 'Installing code-server test dependencies...'
cd test cd test
yarn yarn install
cd .. cd ..
cd lib/vscode cd vendor
yarn ${CI+--frozen-lockfile} echo 'Installing vendor dependencies...'
symlink_asar # Ignore scripts to prevent partial install which omits development dependencies.
yarn install --modules-folder modules --ignore-scripts
yarn run postinstall
} }
main "$@" main "$@"

View File

@ -3,6 +3,7 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
source ./ci/lib.sh source ./ci/lib.sh
local dir="$PWD" local dir="$PWD"
@ -24,7 +25,7 @@ main() {
exit 1 exit 1
fi fi
if [[ ! -d $dir/lib/vscode/out ]]; then if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then
echo >&2 "No VS Code build detected" echo >&2 "No VS Code build detected"
echo >&2 "You can build it with 'yarn build:vscode' or 'yarn watch'" echo >&2 "You can build it with 'yarn build:vscode' or 'yarn watch'"
exit 1 exit 1

View File

@ -1,133 +0,0 @@
#!/usr/bin/env bash
# Description: This is a script to make the process of updating vscode versions easier
# Run it with `yarn update:vscode` and it will do the following:
# 1. Check that you have a remote called `vscode`
# 2. Ask you which version you want to upgrade to
# 3. Grab the exact version from the package.json i.e. 1.53.2
# 4. Fetch the vscode remote branches to run the subtree update
# 5. Run the subtree update and pull in the vscode update
# 6. Commit the changes (including merge conflicts)
# 7. Open a draft PR
set -euo pipefail
# This function expects two arguments
# 1. the vscode version we're updating to
# 2. the list of merge conflict files
make_pr_body() {
local BODY="This PR updates vscode to $1
## TODOS
- [ ] test editor locally
- [ ] test terminal locally
- [ ] make notes about any significant changes in docs/CONTRIBUTING.md#notes-about-changes
## Files with conflicts (fix these)
$2"
echo "$BODY"
}
main() {
cd "$(dirname "$0")/../.."
# Check if the remote exists
# if it doesn't, we add it
if ! git config remote.vscode.url > /dev/null; then
echo "Could not find 'vscode' as a remote"
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
git remote add vscode https://github.com/microsoft/vscode.git
fi
# Ask which version we should update to
# In the future, we'll automate this and grab the latest version automatically
read -r -p "What version of VSCode would you like to update to? (i.e. 1.52) " VSCODE_VERSION_TO_UPDATE
# Check that this version exists
if [[ -z $(git ls-remote --heads vscode release/"$VSCODE_VERSION_TO_UPDATE") ]]; then
echo "Oops, that doesn't look like a valid version."
echo "You entered: $VSCODE_VERSION_TO_UPDATE"
echo "Verify that this branches exists here: https://github.com/microsoft/vscode/branches/all?query=release%2F$VSCODE_VERSION_TO_UPDATE"
exit 1
fi
# Check that they have jq installed
if ! command -v jq &> /dev/null; then
echo "jq could not be found."
echo "We use this when looking up the exact version to update to in the package.json in VS Code."
echo -e "See docs here: https://stedolan.github.io/jq/download/"
exit 1
fi
# Note: `git subtree` returns 129 when installed, and prints help;
# but when uninstalled, returns 1.
set +e
git subtree &> /dev/null
if [ $? -ne 129 ]; then
echo "git-subtree could not be found."
echo "We use this to fetch and update the lib/vscode subtree."
echo -e "Please install git subtree."
exit 1
fi
set -e
# Grab the exact version from package.json
VSCODE_EXACT_VERSION=$(curl -s "https://raw.githubusercontent.com/microsoft/vscode/release/$VSCODE_VERSION_TO_UPDATE/package.json" | jq -r ".version")
echo -e "Great! We'll prep a PR for updating to $VSCODE_EXACT_VERSION\n"
# For some reason the subtree update doesn't work
# unless we fetch all the branches
echo -e "Fetching vscode branches..."
echo -e "Note: this might take a while"
git fetch vscode
# Check if GitHub CLI is installed
if ! command -v gh &> /dev/null; then
echo "GitHub CLI could not be found."
echo "If you install it before you run this script next time, we'll open a draft PR for you!"
echo -e "See docs here: https://github.com/cli/cli#installation\n"
exit
fi
# Push branch to remote if not already pushed
# If we don't do this, the opening a draft PR step won't work
# because it will stop and ask where you want to push the branch
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
echo "Doesn't look like you've pushed this branch to remote"
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
# Note: we need to set upstream as well or the gh pr create step will fail
# See: https://github.com/cli/cli/issues/575
echo "Please set the upstream and re-run the script"
exit 1
fi
echo "Going to try to update vscode for you..."
echo -e "Running: git subtree pull --prefix lib/vscode vscode release/${VSCODE_VERSION_TO_UPDATE} --squash\n"
# Try to run subtree update command
# Note: we add `|| true` because we want the script to keep running even if the squash fails
# We know the squash fails everytime because there will always be merge conflicts
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash || true
# Get the files with conflicts before we commit them
# so we can list them in the PR body as todo items
CONFLICTS=$(git diff --name-only --diff-filter=U | while read -r line; do echo "- [ ] $line"; done)
PR_BODY=$(make_pr_body "$VSCODE_EXACT_VERSION" "$CONFLICTS")
echo -e "\nForcing a commit with conflicts"
echo "Note: this is intentional"
echo "If we don't do this, code review is impossible."
echo -e "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code\n"
# We need --no-verify to skip the husky pre-commit hook
# which fails because of the merge conflicts
git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION" --no-verify
# Note: we can't open a draft PR unless their are changes.
# Hence why we do this after the subtree update.
echo "Opening a draft PR on GitHub"
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
gh pr create --base main --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body "$PR_BODY" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
}
main "$@"

View File

@ -16,7 +16,7 @@ async function main(): Promise<void> {
class Watcher { class Watcher {
private readonly rootPath = path.resolve(__dirname, "../..") private readonly rootPath = path.resolve(__dirname, "../..")
private readonly vscodeSourcePath = path.join(this.rootPath, "lib/vscode") private readonly vscodeSourcePath = path.join(this.rootPath, "vendor/modules/code-oss-dev")
private static log(message: string, skipNewline = false): void { private static log(message: string, skipNewline = false): void {
process.stdout.write(message) process.stdout.write(message)

View File

@ -14,7 +14,7 @@ pkg_json_version() {
} }
vscode_version() { vscode_version() {
jq -r .version lib/vscode/package.json jq -r .version vendor/modules/code-oss-dev/package.json
} }
os() { os() {
@ -104,21 +104,3 @@ export OS
# RELEASE_PATH is the destination directory for the release from the root. # RELEASE_PATH is the destination directory for the release from the root.
# Defaults to release # Defaults to release
RELEASE_PATH="${RELEASE_PATH-release}" RELEASE_PATH="${RELEASE_PATH-release}"
# VS Code bundles some modules into an asar which is an archive format that
# works like tar. It then seems to get unpacked into node_modules.asar.
#
# I don't know why they do this but all the dependencies they bundle already
# exist in node_modules so just symlink it. We have to do this since not only VS
# Code itself but also extensions will look specifically in this directory for
# files (like the ripgrep binary or the oniguruma wasm).
symlink_asar() {
rm -rf node_modules.asar
if [ "${WINDIR-}" ]; then
# mklink takes the link name first.
mklink /J node_modules.asar node_modules
else
# ln takes the link name second.
ln -s node_modules node_modules.asar
fi
}

View File

@ -77,23 +77,24 @@ yarn watch
### Updates to VS Code ### Updates to VS Code
Updating VS Code requires `git subtree`. On some RPM-based Linux distros, `git subtree` is not included by default and needs to be installed separately. To 1. Update the package tag listed in `vendor/package.json`:
install, run `dnf install git-subtree` or `yum install git-subtree`.
To update VS Code: ```json
{
"devDependencies": {
"vscode": "cdr/vscode#X.XX.X-code-server"
}
}
```
1. Run `yarn update:vscode`. 2. From the code-server **project root**, run `yarn install`.
2. Enter a version (e.g., `1.53`) Then, test code-server locally to make sure everything works.
3. This will open a draft pull request for you. 1. Check the Node.js version that's used by Electron (which is shipped with VS
4. There will be merge conflicts. Commit them first, since it will be impossible
for us to review your PR if you don't.
5. Fix the conflicts. Then, test code-server locally to make sure everything
works.
6. Check the Node.js version that's used by Electron (which is shipped with VS
Code. If necessary, update your version of Node.js to match. Code. If necessary, update your version of Node.js to match.
1. Open a PR
> Watch for updates to > Watch for updates to
> `lib/vscode/src/vs/code/browser/workbench/workbench.html`. You may need to > `vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.html`. You may need to
> make changes to `src/browser/pages/vscode.html`. > make changes to `src/browser/pages/vscode.html`.
### Build ### Build
@ -184,7 +185,7 @@ The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
in [src/node/routes](../src/node/routes). in [src/node/routes](../src/node/routes).
Most of the meaty parts are in the VS Code portion of the codebase under Most of the meaty parts are in the VS Code portion of the codebase under
[lib/vscode](../lib/vscode), which we describe next. [vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev), which we describe next.
### Modifications to VS Code ### Modifications to VS Code
@ -197,66 +198,66 @@ Over time, Microsoft added support to VS Code to run it on the web. They have
made the front-end open source, but not the server. As such, code-server v2 (and made the front-end open source, but not the server. As such, code-server v2 (and
later) uses the VS Code front-end and implements the server. We do this by using later) uses the VS Code front-end and implements the server. We do this by using
a Git subtree to fork and modify VS Code. This code lives under a Git subtree to fork and modify VS Code. This code lives under
[lib/vscode](../lib/vscode). [vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev).
Some noteworthy changes in our version of VS Code include: Some noteworthy changes in our version of VS Code include:
- Adding our build file, [`lib/vscode/coder.js`](../lib/vscode/coder.js), which includes build steps specific to code-server - Adding our build file, [`vendor/modules/code-oss-dev/coder.js`](../vendor/modules/code-oss-dev/coder.js), which includes build steps specific to code-server
- Node.js version detection changes in [`build/lib/node.ts`](../lib/vscode/build/lib/node.ts) and [`build/lib/util.ts`](../lib/vscode/build/lib/util.ts) - Node.js version detection changes in [`build/lib/node.ts`](../vendor/modules/code-oss-dev/build/lib/node.ts) and [`build/lib/util.ts`](../vendor/modules/code-oss-dev/build/lib/util.ts)
- Allowing extra extension directories - Allowing extra extension directories
- Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../lib/vscode/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../lib/vscode/src/vs/platform/environment/node/argv.ts) - Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/node/argv.ts)
- Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../lib/vscode/src/vs/platform/environment/common/environment.ts); - Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environment.ts);
- Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../lib/vscode/src/vs/platform/environment/common/environmentService.ts) - Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environmentService.ts)
- Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../lib/vscode/src/vs/platform/extensionManagement/node/extensionsScanner.ts) - Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../vendor/modules/code-oss-dev/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
- Additions/removals from [`package.json`](../lib/vscode/package.json): - Additions/removals from [`package.json`](../vendor/modules/code-oss-dev/package.json):
- Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux - Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux
- Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies) - Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies)
- Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps) - Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps)
- Adding our branding/custom URLs/version: - Adding our branding/custom URLs/version:
- [`product.json`](../lib/vscode/product.json) - [`product.json`](../vendor/modules/code-oss-dev/product.json)
- [`src/vs/base/common/product.ts`](../lib/vscode/src/vs/base/common/product.ts) - [`src/vs/base/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/product.ts)
- [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts) - [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts) - [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts) - [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts)
- Removing azure/macOS signing related dependencies from [`build/package.json`](../lib/vscode/build/package.json) - Removing azure/macOS signing related dependencies from [`build/package.json`](../vendor/modules/code-oss-dev/build/package.json)
- Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code). - Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code).
- Sharing some files with our codebase via symlinks: - Sharing some files with our codebase via symlinks:
- [`src/vs/base/common/ipc.d.ts`](../lib/vscode/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts) - [`src/vs/base/common/ipc.d.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts)
- [`src/vs/base/common/util.ts`](../lib/vscode/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts) - [`src/vs/base/common/util.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts)
- [`src/vs/base/node/proxy_agent.ts`](../lib/vscode/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts) - [`src/vs/base/node/proxy_agent.ts`](../vendor/modules/code-oss-dev/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts)
- Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts) - Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../vendor/modules/code-oss-dev/src/vs/base/parts/ipc/common/ipc.net.ts)
- We use this for connection persistence in our server-side code. - We use this for connection persistence in our server-side code.
- Added our server-side Node.JS code to `src/vs/server`. - Added our server-side Node.JS code to `src/vs/server`.
- This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue - This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue
- Added [`src/vs/workbench/browser/client.ts`](../lib/vscode/src/vs/workbench/browser/client.ts) to hold some server customizations. - Added [`src/vs/workbench/browser/client.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/client.ts) to hold some server customizations.
- Includes the functionality for the Log Out command and menu item - Includes the functionality for the Log Out command and menu item
- Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../lib/vscode/src/vs/workbench/browser/web.main.ts) - Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/web.main.ts)
- Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../lib/vscode/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration. - Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration.
- Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts) - Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/common/remoteAgentConnection.ts)
- Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../lib/vscode/src/vs/base/common/processes.ts) - Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/processes.ts)
- Fix localization support: - Fix localization support:
- Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../lib/vscode/src/vs/workbench/services/localizations/browser/localizationsService.ts). - Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/localizations/browser/localizationsService.ts).
- Modified file [`src/vs/base/common/platform.ts`](../lib/vscode/src/vs/base/common/platform.ts) - Modified file [`src/vs/base/common/platform.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/platform.ts)
- Modified file [`src/vs/base/node/languagePacks.js`](../lib/vscode/src/vs/base/node/languagePacks.js) - Modified file [`src/vs/base/node/languagePacks.js`](../vendor/modules/code-oss-dev/src/vs/base/node/languagePacks.js)
- Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../lib/vscode/src/vs/platform/product/common/product.ts) - Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/platform/product/common/product.ts)
- Extension fixes: - Extension fixes:
- Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons) - Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons)
- Remove broken symlinks in [`extensions/postinstall.js`](../lib/vscode/extensions/postinstall.js) - Remove broken symlinks in [`extensions/postinstall.js`](../vendor/modules/code-oss-dev/extensions/postinstall.js)
- Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts) - Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts)
- Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../lib/vscode/extensions/github-authentication/src/githubServer.ts) - Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../vendor/modules/code-oss-dev/extensions/github-authentication/src/githubServer.ts)
- Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts) - Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts)
- Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts) - Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts)
- Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../lib/vscode/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts) - Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts)
- Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../lib/vscode/build/lib/extensions.ts) - Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../vendor/modules/code-oss-dev/build/lib/extensions.ts)
- Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts) - Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts)
- Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../lib/vscode/src/vs/platform/storage/common/storage.ts) - Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../vendor/modules/code-oss-dev/src/vs/platform/storage/common/storage.ts)
- Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts) - Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts) - URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- Socket/Authority-related fixes (for remote proxying etc.): - Socket/Authority-related fixes (for remote proxying etc.):
- [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts) - [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
- [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts) - [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/browser/browserSocketFactory.ts)
- [`src/vs/base/common/network.ts`](../lib/vscode/src/vs/base/common/network.ts) - [`src/vs/base/common/network.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/network.ts)
- Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts) - Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/api/node/extHostCLIServer.ts)
As the web portion of VS Code matures, we'll be able to shrink and possibly As the web portion of VS Code matures, we'll be able to shrink and possibly
eliminate our modifications. In the meantime, upgrading the VS Code version requires eliminate our modifications. In the meantime, upgrading the VS Code version requires

View File

@ -45,7 +45,7 @@ There is a known issue with search not working on Android because it's missing
```sh ```sh
# run this command inside the code-server directory # run this command inside the code-server directory
ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg ln -s $PREFIX/bin/rg ./vendor/modules/code-oss-dev/vscode-ripgrep/bin/rg
``` ```
### Backspace doesn't work ### Backspace doesn't work

View File

@ -23,8 +23,6 @@
"test:scripts": "./ci/dev/test-scripts.sh", "test:scripts": "./ci/dev/test-scripts.sh",
"package": "./ci/build/build-packages.sh", "package": "./ci/build/build-packages.sh",
"postinstall": "./ci/dev/postinstall.sh", "postinstall": "./ci/dev/postinstall.sh",
"update:vscode": "./ci/dev/update-vscode.sh",
"_____": "",
"_audit": "./ci/dev/audit.sh", "_audit": "./ci/dev/audit.sh",
"fmt": "./ci/dev/fmt.sh", "fmt": "./ci/dev/fmt.sh",
"lint": "./ci/dev/lint.sh", "lint": "./ci/dev/lint.sh",
@ -154,7 +152,6 @@
} }
}, },
"modulePathIgnorePatterns": [ "modulePathIgnorePatterns": [
"<rootDir>/lib/vscode",
"<rootDir>/release-packages", "<rootDir>/release-packages",
"<rootDir>/release", "<rootDir>/release",
"<rootDir>/release-standalone", "<rootDir>/release-standalone",

View File

@ -6,10 +6,6 @@
"matchUpdateTypes": ["minor", "patch", "digest"], "matchUpdateTypes": ["minor", "patch", "digest"],
"automerge": true, "automerge": true,
"groupName": "Minor dependency updates" "groupName": "Minor dependency updates"
},
{
"matchPaths": ["lib/vscode/"],
"enabled": false
} }
], ],
"vulnerabilityAlerts": { "vulnerabilityAlerts": {

View File

@ -40,13 +40,13 @@
<!-- Startup (do not modify order of script tags!) --> <!-- Startup (do not modify order of script tags!) -->
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script> <script data-cfasync="false" src="{{CS_STATIC_BASE}}/out/browser/pages/vscode.browserified.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/loader.js"></script> <script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/loader.js"></script>
<script> <script>
performance.mark("code/willLoadWorkbenchMain") performance.mark("code/willLoadWorkbenchMain")
</script> </script>
<!-- PROD_ONLY <!-- PROD_ONLY
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.nls.js"></script> <script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.nls.js"></script>
<script data-cfasync="false" src="{{CS_STATIC_BASE}}/lib/vscode/out/vs/workbench/workbench.web.api.js"></script> <script data-cfasync="false" src="{{CS_STATIC_BASE}}/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js"></script>
END_PROD_ONLY --> END_PROD_ONLY -->
<script> <script>
require(["vs/code/browser/workbench/workbench"], function () {}) require(["vs/code/browser/workbench/workbench"], function () {})

View File

@ -140,7 +140,7 @@ export function _createScriptURL(value: string, origin: string): string {
export function getConfigurationForLoader({ nlsConfig, options, _window }: GetLoaderParams) { export function getConfigurationForLoader({ nlsConfig, options, _window }: GetLoaderParams) {
const loader: Loader = { const loader: Loader = {
// Without the full URL VS Code will try to load file://. // Without the full URL VS Code will try to load file://.
baseUrl: `${window.location.origin}${options.csStaticBase}/lib/vscode/out`, baseUrl: `${window.location.origin}${options.csStaticBase}/vendor/modules/code-oss-dev/out`,
recordStats: true, recordStats: true,
trustedTypesPolicy: (_window as FixMeLater).trustedTypes?.createPolicy("amdLoader", { trustedTypesPolicy: (_window as FixMeLater).trustedTypes?.createPolicy("amdLoader", {
createScriptURL(value: string): string { createScriptURL(value: string): string {

View File

@ -49,7 +49,7 @@ async function entry(): Promise<void> {
console.log({ console.log({
codeServer: version, codeServer: version,
commit, commit,
vscode: require("../../lib/vscode/package.json").version, vscode: require("../../vendor/modules/code-oss-dev/package.json").version,
}) })
} else { } else {
console.log(version, commit) console.log(version, commit)

View File

@ -13,7 +13,7 @@ import { humanPath, isFile, open } from "./util"
export const runVsCodeCli = (args: DefaultedArgs): void => { export const runVsCodeCli = (args: DefaultedArgs): void => {
logger.debug("forking vs code cli...") logger.debug("forking vs code cli...")
const vscode = cp.fork(path.resolve(__dirname, "../../lib/vscode/out/vs/server/fork"), [], { const vscode = cp.fork(path.resolve(__dirname, "../../vendor/modules/code-oss-dev/out/vs/server/fork"), [], {
env: { env: {
...process.env, ...process.env,
CODE_SERVER_PARENT_PID: process.pid.toString(), CODE_SERVER_PARENT_PID: process.pid.toString(),

View File

@ -166,7 +166,7 @@ router.get("/callback", ensureAuthenticated, async (req, res) => {
callbacks.set(id, callback) callbacks.set(id, callback)
callbackEmitter.emit({ id, callback }) callbackEmitter.emit({ id, callback })
res.sendFile(path.join(rootPath, "lib/vscode/resources/web/callback.html")) res.sendFile(path.join(rootPath, "vendor/modules/code-oss-dev/resources/web/callback.html"))
}) })
router.get("/fetch-callback", ensureAuthenticated, async (req, res) => { router.get("/fetch-callback", ensureAuthenticated, async (req, res) => {

View File

@ -17,7 +17,7 @@ export class VscodeProvider {
private readonly socketProvider = new SocketProxyProvider() private readonly socketProvider = new SocketProxyProvider()
public constructor() { public constructor() {
this.vsRootPath = path.resolve(rootPath, "lib/vscode") this.vsRootPath = path.resolve(rootPath, "vendor/modules/code-oss-dev")
this.serverRootPath = path.join(this.vsRootPath, "out/vs/server") this.serverRootPath = path.join(this.vsRootPath, "out/vs/server")
wrapper.onDispose(() => this.dispose()) wrapper.onDispose(() => this.dispose())
} }

View File

@ -253,7 +253,7 @@ describe("vscode", () => {
}) })
expect(loader).toStrictEqual({ expect(loader).toStrictEqual({
baseUrl: "http://localhost//lib/vscode/out", baseUrl: "http://localhost//vendor/modules/code-oss-dev/out",
paths: { paths: {
"iconv-lite-umd": "../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js", "iconv-lite-umd": "../node_modules/iconv-lite-umd/lib/iconv-lite-umd.js",
jschardet: "../node_modules/jschardet/dist/jschardet.min.js", jschardet: "../node_modules/jschardet/dist/jschardet.min.js",

View File

@ -1,12 +1,12 @@
import bodyParser from "body-parser" import bodyParser from "body-parser"
import * as express from "express" import * as express from "express"
import * as nodeFetch from "node-fetch"
import * as http from "http" import * as http from "http"
import * as nodeFetch from "node-fetch"
import { HttpCode } from "../../../src/common/http" import { HttpCode } from "../../../src/common/http"
import { proxy } from "../../../src/node/proxy" import { proxy } from "../../../src/node/proxy"
import { getAvailablePort } from "../../utils/helpers"
import * as httpserver from "../../utils/httpserver" import * as httpserver from "../../utils/httpserver"
import * as integration from "../../utils/integration" import * as integration from "../../utils/integration"
import { getAvailablePort } from "../../utils/helpers"
describe("proxy", () => { describe("proxy", () => {
const nhooyrDevServer = new httpserver.HttpServer() const nhooyrDevServer = new httpserver.HttpServer()

View File

@ -1,7 +1,7 @@
import { promises as fs } from "fs" import { promises as fs } from "fs"
import * as net from "net"
import * as os from "os" import * as os from "os"
import * as path from "path" import * as path from "path"
import * as net from "net"
/** /**
* Return a mock of @coder/logger. * Return a mock of @coder/logger.

12
vendor/package.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"name": "vendor",
"version": "1.0.0",
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "./postinstall.sh"
},
"devDependencies": {
"code-oss-dev": "cdr/vscode#50f8fff79d612104eed6eb067daf596031fe9f83"
}
}

10
vendor/postinstall.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
echo 'Installing VS Code dependencies...'
cd modules/code-oss-dev
yarn install --frozen-lockfile
}
main "$@"

1400
vendor/yarn.lock vendored Normal file

File diff suppressed because it is too large Load Diff