未验证 提交 705e8217 编写于 作者: J Joe Previte 提交者: GitHub

fix(testing): revert change & fix playwright tests (#4310)

* fix(testing): revert change & fix playwright tests

* fix(constants): add type to import statement

* refactor(e2e): delete browser test

This test was originally added to ensure playwright was working.

At this point, we know it works so removing this test because it doesn't help
with anything specific to code-server and only adds unnecessary code to the
codebase plus increases the e2e test job duration.

* chore(e2e): use 1 worker for e2e test

I don't know if it's a resources issue, playwright, or code-server but it seems
like the e2e tests choke when multiple workers are used.

This change is okay because our CI runner only has 2 cores so it would only use
1 worker anyway, but by specifying it in our playwright config, we ensure more
stability in our e2e tests working correctly.

See these PRs:
- https://github.com/cdr/code-server/pull/3263
- https://github.com/cdr/code-server/pull/4310

* revert(vscode): add missing route with redirect

* chore(vscode): update to latest fork

* Touch up compilation step.

* Bump vendor.

* Fix VS Code minification step

* Move ClientConfiguration to common

Common code must not import Node code as it is imported by the browser.

* Ensure lib directory exists before curling

cURL errors now because VS Code was moved and the directory does not
exist.

* Update incorrect e2e test help output

Revert workers change as well; this can be overridden when desired.

* Add back extension compilation step

* Include missing resources in release

This includes a favicon, for example.  I opted to include the entire
directory to make sure we do not miss anything.  Some of the other
stuff looks potentially useful (like completions).

* Set quality property in product configuration

When httpWebWorkerExtensionHostIframe.html is fetched it uses the web
endpoint template (in which we do not include the commit) but if the
quality is not set it prepends the commit to the web endpoint instead.
The new static endpoint does not use/handle commits so this 404s.

Long-term we might want to make the new static endpoint use commits like
the old one but we will also need to update the various other static
URLs to include the commit.

For now I just fixed this by adding the quality since:
  1. Probably faster than trying to find and update all static uses.
  2. VS Code probably expects it anyway.
  3. Gives us better control over the endpoint.

* Update VS Code

This fixes several build issues.

* Bump vscode.

* Bump.

* Bump.

* Use CLI directly.

* Update tests to reflect new upstream behavior.

* Move unit tests to after the build

Our code has new dependencies on VS Code that are pulled in when the
unit tests run.  Because of this we need to build VS Code before running
the unit tests (as it only pulls built code).

* Upgrade proxy-agent dependencies

This resolves a security report with one of its dependencies (vm2).

* Symlink VS Code output directory before unit tests

This is necessary now that we import from the out directory.

* Fix issues surrounding persistent processes between tests.

* Update VS Code cache directories

These were renamed so the cached paths need to be updated.  I changed
the key as well to force a rebuild.

* Move test symlink to script

This way it works for local testing as well.

I had to use out-build instead of out-vscode-server-min because Jest
throws some obscure error about a handlebars haste map.

* Fix listening on a socket

* Update VS Code

It contains fixes for missing files in the build.

* Standardize disposals

* Dispose HTTP server

Shares code with the test HTTP server.  For now it is a function but
maybe we should make it a class that is extended by tests.

* Dispose app on exit

* Fix logging link errors

Unfortunately the logger currently chokes when provided with error
objects.

Also for some reason the bracketed text was not displaying...

* Update regex used by e2e to extract address

The address was recently changed to use URL which seems to add a
trailing slash when using toString, causing the regex match to fail.

* Log browser console in e2e tests

* Add base back to login page

This is used to set cookies when using a base path.

* Remove login page test

The file this was testing no longer exists.

* Use path.posix for static base

Since this is a web path and not platform-dependent.

* Add test for invalid password
Co-authored-by: NTeffen Ellis <teffen@nirri.us>
Co-authored-by: NAsher <ash@coder.com>
上级 0e97a94a
......@@ -19,8 +19,6 @@ jobs:
name: Pre-build checks
runs-on: ubuntu-latest
timeout-minutes: 15
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
......@@ -54,14 +52,6 @@ jobs:
run: yarn lint
if: success()
- name: Run code-server unit tests
run: yarn test:unit
if: success()
- name: Upload coverage report to Codecov
run: yarn coverage
if: success()
audit-ci:
name: Run audit-ci
needs: prebuild
......@@ -98,6 +88,8 @@ jobs:
needs: prebuild
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
......@@ -146,14 +138,25 @@ jobs:
path: |
vendor/modules/code-oss-dev/.build
vendor/modules/code-oss-dev/out-build
vendor/modules/code-oss-dev/out-vscode
vendor/modules/code-oss-dev/out-vscode-min
key: vscode-build-${{ steps.vscode-rev.outputs.rev }}
vendor/modules/code-oss-dev/out-vscode-server
vendor/modules/code-oss-dev/out-vscode-server-min
key: vscode-server-build-${{ steps.vscode-rev.outputs.rev }}
- name: Build vscode
if: steps.cache-vscode.outputs.cache-hit != 'true'
run: yarn build:vscode
# Our code imports code from VS Code's `out` directory meaning VS Code
# must be built before running these tests.
# TODO: Move to its own step?
- name: Run code-server unit tests
run: yarn test:unit
if: success()
- name: Upload coverage report to Codecov
run: yarn coverage
if: success()
# The release package does not contain any native modules
# and is neutral to architecture/os/libc version.
- name: Create release package
......
......@@ -20,6 +20,8 @@ main() {
source ./ci/lib.sh
OS="$(uname | tr '[:upper:]' '[:lower:]')"
mkdir -p ./lib
if ! [ -f ./lib/coder-cloud-agent ]; then
echo "Downloading the cloud agent..."
......
......@@ -68,7 +68,7 @@ EOF
bundle_vscode() {
mkdir -p "$VSCODE_OUT_PATH"
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
rsync "$VSCODE_SRC_PATH/out-vscode-server${MINIFY:+-min}/" "$VSCODE_OUT_PATH/out"
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
if [ "$KEEP_MODULES" = 0 ]; then
......@@ -80,9 +80,8 @@ bundle_vscode() {
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
mkdir -p "$VSCODE_OUT_PATH/resources/"{linux,web}
rsync "$VSCODE_SRC_PATH/resources/linux/" "$VSCODE_OUT_PATH/resources/linux/"
rsync "$VSCODE_SRC_PATH/resources/web/" "$VSCODE_OUT_PATH/resources/web/"
mkdir -p "$VSCODE_OUT_PATH/resources/"
rsync "$VSCODE_SRC_PATH/resources/" "$VSCODE_OUT_PATH/resources/"
# Add the commit and date and enable telemetry. This just makes telemetry
# available; telemetry can still be disabled by flag or setting.
......@@ -91,6 +90,7 @@ bundle_vscode() {
{
"enableTelemetry": true,
"commit": "$(git rev-parse HEAD)",
"quality": "stable",
"date": $(jq -n 'now | todate')
}
EOF
......
......@@ -11,13 +11,9 @@ main() {
cd vendor/modules/code-oss-dev
yarn gulp compile-build compile-extensions-build compile-extension-media compile-web
yarn gulp optimize --gulpfile ./coder.js
if [[ $MINIFY ]]; then
yarn gulp minify --gulpfile ./coder.js
fi
# extensions-ci compiles extensions and includes their media.
# compile-web compiles web extensions. TODO: Unsure if used.
yarn gulp extensions-ci compile-web "vscode-server${MINIFY:+-min}"
}
main "$@"
......@@ -57,6 +57,9 @@ main() {
esac
OS="$(uname | tr '[:upper:]' '[:lower:]')"
mkdir -p ./lib
if curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent; then
chmod +x ./lib/coder-cloud-agent
else
......
#!/usr/bin/env bash
set -euo pipefail
help() {
echo >&2 " You can build with 'yarn watch' or you can build a release"
echo >&2 " For example: 'yarn build && yarn build:vscode && KEEP_MODULES=1 yarn release'"
echo >&2 " Then 'CODE_SERVER_TEST_ENTRY=./release yarn test:e2e'"
echo >&2 " You can manually run that release with 'node ./release'"
}
main() {
cd "$(dirname "$0")/../.."
......@@ -21,13 +28,13 @@ main() {
# wrong (native modules version issues, incomplete build, etc).
if [[ ! -d $dir/out ]]; then
echo >&2 "No code-server build detected"
echo >&2 "You can build it with 'yarn build' or 'yarn watch'"
help
exit 1
fi
if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then
echo >&2 "No VS Code build detected"
echo >&2 "You can build it with 'yarn build:vscode' or 'yarn watch'"
help
exit 1
fi
......
......@@ -3,12 +3,26 @@ set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
cd test/unit/node/test-plugin
source ./ci/lib.sh
pushd test/unit/node/test-plugin
make -s out/index.js
popd
# Our code imports from `out` in order to work during development but if you
# have only built for production you will have not have this directory. In
# that case symlink `out` to a production build directory.
local vscode="vendor/modules/code-oss-dev"
local link="$vscode/out"
local target="out-build"
if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then
ln -s "$target" "$link"
fi
# We must keep jest in a sub-directory. See ../../test/package.json for more
# information. We must also run it from the root otherwise coverage will not
# include our source files.
cd "$OLDPWD"
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
}
......
......@@ -19,7 +19,7 @@
"release:prep": "./ci/build/release-prep.sh",
"test:e2e": "./ci/dev/test-e2e.sh",
"test:standalone-release": "./ci/build/test-standalone-release.sh",
"test:unit": "./ci/dev/test-unit.sh",
"test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles",
"test:scripts": "./ci/dev/test-scripts.sh",
"package": "./ci/build/build-packages.sh",
"postinstall": "./ci/dev/postinstall.sh",
......
......@@ -30,6 +30,7 @@
<div class="content">
<form class="login-form" method="post">
<input class="user" type="text" autocomplete="username" />
<input id="base" type="hidden" name="base" value="/" />
<div class="field">
<input
required
......@@ -47,5 +48,13 @@
</div>
</div>
</div>
<script>
// Inform the backend about the path since the proxy might have rewritten
// it out of the headers and cookies must be set with absolute paths.
const el = document.getElementById("base")
if (el) {
el.value = window.location.pathname
}
</script>
</body>
</html>
......@@ -7,7 +7,7 @@ import { logger } from "@coder/logger"
export type Callback<T, R = void | Promise<void>> = (t: T, p: Promise<void>) => R
export interface Disposable {
dispose(): void
dispose(): void | Promise<void>
}
export interface Event<T> {
......
......@@ -50,35 +50,6 @@ export const resolveBase = (base?: string): string => {
return normalize(url.pathname)
}
/**
* Get client-side configuration embedded in the HTML or query params.
*/
export const getClientConfiguration = <T extends CodeServerLib.ClientConfiguration>(): T => {
let config: T
try {
config = JSON.parse(document.getElementById("coder-options")!.getAttribute("data-settings")!)
} catch (error) {
config = {} as T
}
// You can also pass options in stringified form to the options query
// variable. Options provided here will override the ones in the options
// element.
const params = new URLSearchParams(location.search)
const queryOpts = params.get("options")
if (queryOpts) {
config = {
...config,
...JSON.parse(queryOpts),
}
}
config.base = resolveBase(config.base)
config.csStaticBase = resolveBase(config.csStaticBase)
return config
}
/**
* Wrap the value in an array if it's not already an array. If the value is
* undefined return an empty array.
......@@ -94,7 +65,7 @@ export const arrayify = <T>(value?: T | T[]): T[] => {
}
// TODO: Might make sense to add Error handling to the logger itself.
export function logError(logger: { error: (msg: string) => void }, prefix: string, err: Error | string): void {
export function logError(logger: { error: (msg: string) => void }, prefix: string, err: unknown): void {
if (err instanceof Error) {
logger.error(`${prefix}: ${err.message} ${err.stack}`)
} else {
......
......@@ -4,13 +4,24 @@ import express, { Express } from "express"
import { promises as fs } from "fs"
import http from "http"
import * as httpolyglot from "httpolyglot"
import { Disposable } from "../common/emitter"
import * as util from "../common/util"
import { DefaultedArgs } from "./cli"
import { disposer } from "./http"
import { isNodeJSErrnoException } from "./util"
import { handleUpgrade } from "./wsRouter"
type ListenOptions = Pick<DefaultedArgs, "socket" | "port" | "host">
export interface App extends Disposable {
/** Handles regular HTTP requests. */
router: Express
/** Handles websocket requests. */
wsRouter: Express
/** The underlying HTTP server. */
server: http.Server
}
const listen = (server: http.Server, { host, port, socket }: ListenOptions) => {
return new Promise<void>(async (resolve, reject) => {
server.on("error", reject)
......@@ -41,10 +52,9 @@ const listen = (server: http.Server, { host, port, socket }: ListenOptions) => {
/**
* Create an Express app and an HTTP/S server to serve it.
*/
export const createApp = async (args: DefaultedArgs): Promise<[Express, Express, http.Server]> => {
const app = express()
app.use(compression())
export const createApp = async (args: DefaultedArgs): Promise<App> => {
const router = express()
router.use(compression())
const server = args.cert
? httpolyglot.createServer(
......@@ -52,30 +62,38 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, Express,
cert: args.cert && (await fs.readFile(args.cert.value)),
key: args["cert-key"] && (await fs.readFile(args["cert-key"])),
},
app,
router,
)
: http.createServer(app)
: http.createServer(router)
const dispose = disposer(server)
await listen(server, args)
const wsApp = express()
handleUpgrade(wsApp, server)
const wsRouter = express()
handleUpgrade(wsRouter, server)
return [app, wsApp, server]
return { router, wsRouter, server, dispose }
}
/**
* Get the address of a server as a string (protocol *is* included) while
* ensuring there is one (will throw if there isn't).
*
* The address might be a URL or it might be a pipe or socket path.
*/
export const ensureAddress = (server: http.Server): string => {
export const ensureAddress = (server: http.Server, protocol: string): URL | string => {
const addr = server.address()
if (!addr) {
throw new Error("server has no address")
throw new Error("Server has no address")
}
if (typeof addr !== "string") {
return `http://${addr.address}:${addr.port}`
return new URL(`${protocol}://${addr.address}:${addr.port}`)
}
// If this is a string then it is a pipe or Unix socket.
return addr
}
......
......@@ -32,6 +32,7 @@ export class OptionalString extends Optional<string> {}
export interface Args
extends Pick<
CodeServerLib.NativeParsedArgs,
| "_"
| "user-data-dir"
| "enable-proposed-api"
| "extensions-dir"
......@@ -42,7 +43,12 @@ export interface Args
| "locale"
| "log"
| "verbose"
| "_"
| "install-source"
| "list-extensions"
| "install-extension"
| "uninstall-extension"
| "locate-extension"
// | "telemetry"
> {
config?: string
auth?: AuthType
......@@ -64,10 +70,7 @@ export interface Args
socket?: string
version?: boolean
force?: boolean
"list-extensions"?: boolean
"install-extension"?: string[]
"show-versions"?: boolean
"uninstall-extension"?: string[]
"proxy-domain"?: string[]
"reuse-window"?: boolean
"new-window"?: boolean
......@@ -177,6 +180,8 @@ const options: Options<Required<Args>> = {
"extra-builtin-extensions-dir": { type: "string[]", path: true },
"list-extensions": { type: "boolean", description: "List installed VS Code extensions." },
force: { type: "boolean", description: "Avoid prompts when installing VS Code extensions." },
"install-source": { type: "string" },
"locate-extension": { type: "string[]" },
"install-extension": {
type: "string[]",
description:
......@@ -652,21 +657,6 @@ function bindAddrFromAllSources(...argsConfig: Args[]): Addr {
return addr
}
export const shouldRunVsCodeCli = (args: Args): boolean => {
// Create new interface with only Arg keys
// keyof Args
// Turn that into an array
// Array<...>
type ExtensionArgs = Array<keyof Args>
const extensionRelatedArgs: ExtensionArgs = ["list-extensions", "install-extension", "uninstall-extension"]
const argKeys = Object.keys(args)
// If any of the extensionRelatedArgs are included in args
// then we don't want to run the vscode cli
return extensionRelatedArgs.some((arg) => argKeys.includes(arg))
}
/**
* Determine if it looks like the user is trying to open a file or folder in an
* existing instance. The arguments here should be the arguments the user
......
......@@ -33,9 +33,11 @@ function runAgent(...args: string[]): Promise<void> {
})
}
export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> {
// addr needs to be in host:port format.
// So we trim the protocol.
csAddr = csAddr.replace(/^https?:\/\//, "")
return runAgent("bind", `--code-server-addr=${csAddr}`, serverName)
export function coderCloudBind(address: URL | string, serverName = ""): Promise<void> {
if (typeof address === "string") {
throw new Error("Cannot link socket paths")
}
// Address needs to be in hostname:port format without the protocol.
return runAgent("bind", `--code-server-addr=${address.host}`, serverName)
}
import { logger } from "@coder/logger"
import { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package"
import type { JSONSchemaForNPMPackageJsonFiles } from "@schemastore/package"
import * as os from "os"
import * as path from "path"
......
import { logger } from "@coder/logger"
import {
optionDescriptions,
parse,
readConfigFile,
setDefaults,
shouldOpenInExistingInstance,
shouldRunVsCodeCli,
} from "./cli"
import { optionDescriptions, parse, readConfigFile, setDefaults, shouldOpenInExistingInstance } from "./cli"
import { commit, version } from "./constants"
import { openInExistingInstance, runCodeServer, runVsCodeCli } from "./main"
import { openInExistingInstance, runCodeServer, runVsCodeCli, shouldSpawnCliProcess } from "./main"
import { monkeyPatchProxyProtocols } from "./proxy_agent"
import { isChild, wrapper } from "./wrapper"
......@@ -24,7 +17,8 @@ async function entry(): Promise<void> {
if (isChild(wrapper)) {
const args = await wrapper.handshake()
wrapper.preventExit()
await runCodeServer(args)
const server = await runCodeServer(args)
wrapper.onDispose(() => server.dispose())
return
}
......@@ -59,8 +53,8 @@ async function entry(): Promise<void> {
return
}
if (shouldRunVsCodeCli(args)) {
return runVsCodeCli(args)
if (await shouldSpawnCliProcess(args)) {
return runVsCodeCli()
}
const socketPath = await shouldOpenInExistingInstance(cliArgs)
......
import { field, logger } from "@coder/logger"
import * as express from "express"
import * as expressCore from "express-serve-static-core"
import * as http from "http"
import * as net from "net"
import path from "path"
import qs from "qs"
import { Disposable } from "../common/emitter"
import { HttpCode, HttpError } from "../common/http"
import { normalize } from "../common/util"
import { AuthType, DefaultedArgs } from "./cli"
......@@ -10,6 +13,15 @@ import { version as codeServerVersion } from "./constants"
import { Heart } from "./heart"
import { getPasswordMethod, IsCookieValidArgs, isCookieValid, sanitizeString, escapeHtml, escapeJSON } from "./util"
/**
* Base options included on every page.
*/
export interface ClientConfiguration {
codeServerVersion: string
base: string
csStaticBase: string
}
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Express {
......@@ -20,12 +32,12 @@ declare global {
}
}
export const createClientConfiguration = (req: express.Request): CodeServerLib.ClientConfiguration => {
export const createClientConfiguration = (req: express.Request): ClientConfiguration => {
const base = relativeRoot(req)
return {
base,
csStaticBase: normalize(path.join(base, "_static/")),
csStaticBase: normalize(path.posix.join(base, "_static/")),
codeServerVersion,
}
}
......@@ -38,7 +50,7 @@ export const replaceTemplates = <T extends object>(
content: string,
extraOpts?: Omit<T, "base" | "csStaticBase" | "logLevel">,
): string => {
const serverOptions: CodeServerLib.ClientConfiguration = {
const serverOptions: ClientConfiguration = {
...createClientConfiguration(req),
...extraOpts,
}
......@@ -179,3 +191,53 @@ export const getCookieDomain = (host: string, proxyDomains: string[]): string |
logger.debug("got cookie doman", field("host", host))
return host || undefined
}
/**
* Return a function capable of fully disposing an HTTP server.
*/
export function disposer(server: http.Server): Disposable["dispose"] {
const sockets = new Set<net.Socket>()
let cleanupTimeout: undefined | NodeJS.Timeout
server.on("connection", (socket) => {
sockets.add(socket)
socket.on("close", () => {
sockets.delete(socket)
if (cleanupTimeout && sockets.size === 0) {
clearTimeout(cleanupTimeout)
cleanupTimeout = undefined
}
})
})
return () => {
return new Promise<void>((resolve, reject) => {
// The whole reason we need this disposer is because close will not
// actually close anything; it only prevents future connections then waits
// until everything is closed.
server.close((err) => {
if (err) {
return reject(err)
}
resolve()
})
// If there are sockets remaining we might need to force close them or
// this promise might never resolve.
if (sockets.size > 0) {
// Give sockets a chance to close up shop.
cleanupTimeout = setTimeout(() => {
cleanupTimeout = undefined
for (const socket of sockets.values()) {
console.warn("a socket was left hanging")
socket.destroy()
}
}, 1000)
}
})
}
}
import { logger } from "@coder/logger"
import { spawn } from "child_process"
import { ChildProcessWithoutNullStreams, spawn } from "child_process"
import path from "path"
export function startLink(port: number): Promise<void> {
logger.debug(`running link targetting ${port}`)
export function startLink(address: URL | string): ChildProcessWithoutNullStreams {
if (typeof address === "string") {
throw new Error("Cannot link socket paths")
}
const agent = spawn(path.resolve(__dirname, "../../lib/linkup"), ["--devurl", `code:${port}:code-server`], {
const port = parseInt(address.port, 10)
logger.debug(`running link targeting ${port}`)
return spawn(path.resolve(__dirname, "../../lib/linkup"), ["--devurl", `code:${port}:code-server`], {
shell: false,
})
return new Promise((res, rej) => {
agent.on("error", rej)
agent.on("close", (code) => {
if (code !== 0) {
return rej({
message: `Link exited with ${code}`,
})
}
res()
})
})
}
import { field, logger } from "@coder/logger"
import { ChildProcessWithoutNullStreams } from "child_process"
import http from "http"
import path from "path"
import { plural } from "../common/util"
import { Disposable } from "../common/emitter"
import { plural, logError } from "../common/util"
import { createApp, ensureAddress } from "./app"
import { AuthType, DefaultedArgs, Feature } from "./cli"
import { coderCloudBind } from "./coder_cloud"
import { commit, version } from "./constants"
import { commit, version, vsRootPath } from "./constants"
import { startLink } from "./link"
import { register } from "./routes"
import { humanPath, isFile, loadAMDModule, open } from "./util"
export const shouldSpawnCliProcess = async (args: CodeServerLib.NativeParsedArgs): Promise<boolean> => {
const shouldSpawn = await loadAMDModule<(argv: CodeServerLib.NativeParsedArgs) => boolean>(
"vs/code/node/cli",
"shouldSpawnCliProcess",
)
return shouldSpawn(args)
}
/**
* This is useful when an CLI arg should be passed to VS Code directly,
* such as when managing extensions.
* @deprecated This should be removed when code-server merges with lib/vscode.
*/
export const runVsCodeCli = async (args: DefaultedArgs): Promise<void> => {
export const runVsCodeCli = async (): Promise<void> => {
logger.debug("Running VS Code CLI")
const cliProcessMain = await loadAMDModule<CodeServerLib.IMainCli["main"]>("vs/code/node/cliProcessMain", "main")
// Delete `VSCODE_CWD` very early even before
// importing bootstrap files. We have seen
// reports where `code .` would use the wrong
// current working directory due to our variable
// somehow escaping to the parent shell
// (https://github.com/microsoft/vscode/issues/126399)
delete process.env["VSCODE_CWD"]
const bootstrap = require(path.join(vsRootPath, "out", "bootstrap"))
const bootstrapNode = require(path.join(vsRootPath, "out", "bootstrap-node"))
const product = require(path.join(vsRootPath, "product.json"))
// Avoid Monkey Patches from Application Insights
bootstrap.avoidMonkeyPatchFromAppInsights()
// Enable portable support
bootstrapNode.configurePortable(product)
// Enable ASAR support
bootstrap.enableASARSupport()
// Signal processes that we got launched as CLI
process.env["VSCODE_CLI"] = "1"
const cliProcessMain = await loadAMDModule<CodeServerLib.IMainCli["main"]>("vs/code/node/cli", "initialize")
try {
await cliProcessMain(args)
await cliProcessMain(process.argv)
} catch (error: any) {
logger.error("Got error from VS Code", error)
}
......@@ -72,7 +107,9 @@ export const openInExistingInstance = async (args: DefaultedArgs, socketPath: st
vscode.end()
}
export const runCodeServer = async (args: DefaultedArgs): Promise<http.Server> => {
export const runCodeServer = async (
args: DefaultedArgs,
): Promise<{ dispose: Disposable["dispose"]; server: http.Server }> => {
logger.info(`code-server ${version} ${commit}`)
logger.info(`Using user-data-dir ${humanPath(args["user-data-dir"])}`)
......@@ -84,12 +121,12 @@ export const runCodeServer = async (args: DefaultedArgs): Promise<http.Server> =
)
}
const [app, wsApp, server] = await createApp(args)
const serverAddress = ensureAddress(server)
await register(app, wsApp, server, args)
const app = await createApp(args)
const serverAddress = ensureAddress(app.server, args.cert ? "https" : "http")
const disposeRoutes = await register(app, args)
logger.info(`Using config file ${humanPath(args.config)}`)
logger.info(`HTTP server listening on ${serverAddress} ${args.link ? "(randomized by --link)" : ""}`)
logger.info(`HTTP server listening on ${serverAddress.toString()} ${args.link ? "(randomized by --link)" : ""}`)
if (args.auth === AuthType.Password) {
logger.info(" - Authentication is enabled")
if (args.usingEnvPassword) {
......@@ -115,17 +152,21 @@ export const runCodeServer = async (args: DefaultedArgs): Promise<http.Server> =
}
if (args.link) {
await coderCloudBind(serverAddress.replace(/^https?:\/\//, ""), args.link.value)
await coderCloudBind(serverAddress, args.link.value)
logger.info(" - Connected to cloud agent")
}
let linkAgent: undefined | ChildProcessWithoutNullStreams
try {
const port = parseInt(serverAddress.split(":").pop() as string, 10)
startLink(port).catch((ex) => {
logger.debug("Link daemon exited!", field("error", ex))
linkAgent = startLink(serverAddress)
linkAgent.on("error", (error) => {
logError(logger, "link daemon", error)
})
linkAgent.on("close", (code) => {
logger.debug("link daemon closed", field("code", code))
})
} catch (error) {
logger.debug("Failed to start link daemon!", error as any)
logError(logger, "link daemon", error)
}
if (args.enable && args.enable.length > 0) {
......@@ -143,16 +184,21 @@ export const runCodeServer = async (args: DefaultedArgs): Promise<http.Server> =
)
}
if (!args.socket && args.open) {
// The web socket doesn't seem to work if browsing with 0.0.0.0.
const openAddress = serverAddress.replace("://0.0.0.0", "://localhost")
if (args.open) {
try {
await open(openAddress)
logger.info(`Opened ${openAddress}`)
await open(serverAddress)
logger.info(`Opened ${serverAddress}`)
} catch (error) {
logger.error("Failed to open", field("address", openAddress), field("error", error))
logger.error("Failed to open", field("address", serverAddress.toString()), field("error", error))
}
}
return server
return {
server: app.server,
dispose: async () => {
linkAgent?.kill()
disposeRoutes()
await app.dispose()
},
}
}
......@@ -2,19 +2,19 @@ import { logger } from "@coder/logger"
import cookieParser from "cookie-parser"
import * as express from "express"
import { promises as fs } from "fs"
import http from "http"
import * as path from "path"
import * as tls from "tls"
import * as pluginapi from "../../../typings/pluginapi"
import { Disposable } from "../../common/emitter"
import { HttpCode, HttpError } from "../../common/http"
import { plural } from "../../common/util"
import { App } from "../app"
import { AuthType, DefaultedArgs } from "../cli"
import { commit, isDevMode, rootPath } from "../constants"
import { Heart } from "../heart"
import { ensureAuthenticated, redirect } from "../http"
import { PluginAPI } from "../plugin"
import { getMediaMime, paths } from "../util"
import { wrapper } from "../wrapper"
import * as apps from "./apps"
import * as domainProxy from "./domainProxy"
import { errorHandler, wsErrorHandler } from "./errors"
......@@ -28,15 +28,10 @@ import { createVSServerRouter, VSServerResult } from "./vscode"
/**
* Register all routes and middleware.
*/
export const register = async (
app: express.Express,
wsApp: express.Express,
server: http.Server,
args: DefaultedArgs,
): Promise<void> => {
export const register = async (app: App, args: DefaultedArgs): Promise<Disposable["dispose"]> => {
const heart = new Heart(path.join(paths.data, "heartbeat"), async () => {
return new Promise((resolve, reject) => {
server.getConnections((error, count) => {
app.server.getConnections((error, count) => {
if (error) {
return reject(error)
}
......@@ -45,15 +40,12 @@ export const register = async (
})
})
})
server.on("close", () => {
heart.dispose()
})
app.disable("x-powered-by")
wsApp.disable("x-powered-by")
app.router.disable("x-powered-by")
app.wsRouter.disable("x-powered-by")
app.use(cookieParser())
wsApp.use(cookieParser())
app.router.use(cookieParser())
app.wsRouter.use(cookieParser())
const common: express.RequestHandler = (req, _, next) => {
// /healthz|/healthz/ needs to be excluded otherwise health checks will make
......@@ -69,10 +61,10 @@ export const register = async (
next()
}
app.use(common)
wsApp.use(common)
app.router.use(common)
app.wsRouter.use(common)
app.use(async (req, res, next) => {
app.router.use(async (req, res, next) => {
// If we're handling TLS ensure all requests are redirected to HTTPS.
// TODO: This does *NOT* work if you have a base path since to specify the
// protocol we need to specify the whole path.
......@@ -90,68 +82,68 @@ export const register = async (
next()
})
app.use("/", domainProxy.router)
wsApp.use("/", domainProxy.wsRouter.router)
app.router.use("/", domainProxy.router)
app.wsRouter.use("/", domainProxy.wsRouter.router)
app.all("/proxy/(:port)(/*)?", (req, res) => {
app.router.all("/proxy/(:port)(/*)?", (req, res) => {
pathProxy.proxy(req, res)
})
wsApp.get("/proxy/(:port)(/*)?", async (req) => {
app.wsRouter.get("/proxy/(:port)(/*)?", async (req) => {
await pathProxy.wsProxy(req as pluginapi.WebsocketRequest)
})
// These two routes pass through the path directly.
// So the proxied app must be aware it is running
// under /absproxy/<someport>/
app.all("/absproxy/(:port)(/*)?", (req, res) => {
app.router.all("/absproxy/(:port)(/*)?", (req, res) => {
pathProxy.proxy(req, res, {
passthroughPath: true,
})
})
wsApp.get("/absproxy/(:port)(/*)?", async (req) => {
app.wsRouter.get("/absproxy/(:port)(/*)?", async (req) => {
await pathProxy.wsProxy(req as pluginapi.WebsocketRequest, {
passthroughPath: true,
})
})
let pluginApi: PluginAPI
if (!process.env.CS_DISABLE_PLUGINS) {
const workingDir = args._ && args._.length > 0 ? path.resolve(args._[args._.length - 1]) : undefined
const pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
pluginApi = new PluginAPI(logger, process.env.CS_PLUGIN, process.env.CS_PLUGIN_PATH, workingDir)
await pluginApi.loadPlugins()
pluginApi.mount(app, wsApp)
app.use("/api/applications", ensureAuthenticated, apps.router(pluginApi))
wrapper.onDispose(() => pluginApi.dispose())
pluginApi.mount(app.router, app.wsRouter)
app.router.use("/api/applications", ensureAuthenticated, apps.router(pluginApi))
}
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.router.use(express.json())
app.router.use(express.urlencoded({ extended: true }))
app.use(
app.router.use(
"/_static",
express.static(rootPath, {
cacheControl: commit !== "development",
}),
)
app.use("/healthz", health.router)
wsApp.use("/healthz", health.wsRouter.router)
app.router.use("/healthz", health.router)
app.wsRouter.use("/healthz", health.wsRouter.router)
if (args.auth === AuthType.Password) {
app.use("/login", login.router)
app.use("/logout", logout.router)
app.router.use("/login", login.router)
app.router.use("/logout", logout.router)
} else {
app.all("/login", (req, res) => redirect(req, res, "/", {}))
app.all("/logout", (req, res) => redirect(req, res, "/", {}))
app.router.all("/login", (req, res) => redirect(req, res, "/", {}))
app.router.all("/logout", (req, res) => redirect(req, res, "/", {}))
}
app.use("/update", update.router)
app.router.use("/update", update.router)
let vscode: VSServerResult
try {
vscode = await createVSServerRouter(args)
app.use("/", vscode.router)
wsApp.use("/", vscode.wsRouter.router)
app.use("/vscode", vscode.router)
wsApp.use("/vscode", vscode.wsRouter.router)
app.router.use("/", vscode.router)
app.wsRouter.use("/", vscode.wsRouter.router)
app.router.use("/vscode", vscode.router)
app.wsRouter.use("/vscode", vscode.wsRouter.router)
} catch (error: any) {
if (isDevMode) {
logger.warn(error)
......@@ -161,14 +153,16 @@ export const register = async (
}
}
server.on("close", () => {
vscode?.vscodeServer.close()
})
app.use(() => {
app.router.use(() => {
throw new HttpError("Not Found", HttpCode.NotFound)
})
app.use(errorHandler)
wsApp.use(wsErrorHandler)
app.router.use(errorHandler)
app.wsRouter.use(wsErrorHandler)
return () => {
heart.dispose()
pluginApi?.dispose()
vscode?.codeServerMain.dispose()
}
}
......@@ -88,7 +88,11 @@ router.post("/", async (req, res) => {
// obfuscation purposes (and as a side effect it handles escaping).
res.cookie(Cookie.Key, hashedPassword, {
domain: getCookieDomain(req.headers.host || "", req.args["proxy-domain"]),
path: req.body.base || "/",
// Browsers do not appear to allow cookies to be set relatively so we
// need to get the root path from the browser since the proxy rewrites
// it out of the path. Otherwise code-server instances hosted on
// separate sub-paths will clobber each other.
path: req.body.base ? path.posix.join(req.body.base, "..") : "/",
sameSite: "lax",
})
......
import * as express from "express"
import { Server } from "http"
import path from "path"
import { AuthType, DefaultedArgs } from "../cli"
import { version as codeServerVersion, vsRootPath } from "../constants"
import { ensureAuthenticated } from "../http"
import { ensureAuthenticated, authenticated, redirect } from "../http"
import { loadAMDModule } from "../util"
import { Router as WsRouter, WebsocketRouter } from "../wsRouter"
import { errorHandler } from "./errors"
......@@ -11,7 +10,7 @@ import { errorHandler } from "./errors"
export interface VSServerResult {
router: express.Router
wsRouter: WebsocketRouter
vscodeServer: Server
codeServerMain: CodeServerLib.IServerProcessMain
}
export const createVSServerRouter = async (args: DefaultedArgs): Promise<VSServerResult> => {
......@@ -39,10 +38,10 @@ export const createVSServerRouter = async (args: DefaultedArgs): Promise<VSServe
// Signal processes that we got launched as CLI
process.env["VSCODE_CLI"] = "1"
const vscodeServerMain = await loadAMDModule<CodeServerLib.CreateVSServer>("vs/server/entry", "createVSServer")
const createVSServer = await loadAMDModule<CodeServerLib.CreateVSServer>("vs/server/entry", "createVSServer")
const serverUrl = new URL(`${args.cert ? "https" : "http"}://${args.host}:${args.port}`)
const vscodeServer = await vscodeServerMain({
const codeServerMain = await createVSServer({
codeServerVersion,
serverUrl,
args,
......@@ -50,17 +49,30 @@ export const createVSServerRouter = async (args: DefaultedArgs): Promise<VSServe
disableUpdateCheck: !!args["disable-update-check"],
})
const netServer = await codeServerMain.startup({ listenWhenReady: false })
const router = express.Router()
const wsRouter = WsRouter()
router.get("/", async (req, res, next) => {
const isAuthenticated = await authenticated(req)
if (!isAuthenticated) {
return redirect(req, res, "login", {
// req.baseUrl can be blank if already at the root.
to: req.baseUrl && req.baseUrl !== "/" ? req.baseUrl : undefined,
})
}
next()
})
router.all("*", ensureAuthenticated, (req, res, next) => {
req.on("error", (error) => errorHandler(error, req, res, next))
vscodeServer.emit("request", req, res)
netServer.emit("request", req, res)
})
wsRouter.ws("/", ensureAuthenticated, (req) => {
vscodeServer.emit("upgrade", req, req.socket, req.head)
netServer.emit("upgrade", req, req.socket, req.head)
req.socket.resume()
})
......@@ -68,6 +80,6 @@ export const createVSServerRouter = async (args: DefaultedArgs): Promise<VSServe
return {
router,
wsRouter,
vscodeServer,
codeServerMain,
}
}
......@@ -393,9 +393,17 @@ export const isWsl = async (): Promise<boolean> => {
}
/**
* Try opening a URL using whatever the system has set for opening URLs.
* Try opening an address using whatever the system has set for opening URLs.
*/
export const open = async (url: string): Promise<void> => {
export const open = async (address: URL | string): Promise<void> => {
if (typeof address === "string") {
throw new Error("Cannot open socket paths")
}
// Web sockets do not seem to work if browsing with 0.0.0.0.
const url = new URL(address)
if (url.hostname === "0.0.0.0") {
url.hostname = "localhost"
}
const args = [] as string[]
const options = {} as cp.SpawnOptions
const platform = (await isWsl()) ? "wsl" : process.platform
......@@ -403,9 +411,9 @@ export const open = async (url: string): Promise<void> => {
if (platform === "win32" || platform === "wsl") {
command = platform === "wsl" ? "cmd.exe" : "cmd"
args.push("/c", "start", '""', "/b")
url = url.replace(/&/g, "^&")
url.search = url.search.replace(/&/g, "^&")
}
const proc = cp.spawn(command, [...args, url], options)
const proc = cp.spawn(command, [...args, url.toString()], options)
await new Promise<void>((resolve, reject) => {
proc.on("error", reject)
proc.on("close", (code) => {
......
import { describe, test, expect } from "./baseFixture"
// This is a "gut-check" test to make sure playwright is working as expected
describe("browser", true, () => {
test("browser should display correct userAgent", async ({ codeServerPage, browserName }) => {
const displayNames = {
chromium: "Chrome",
firefox: "Firefox",
webkit: "Safari",
}
const userAgent = await codeServerPage.page.evaluate(() => navigator.userAgent)
expect(userAgent).toContain(displayNames[browserName])
})
})
import { Logger, logger } from "@coder/logger"
import { field, Logger, logger } from "@coder/logger"
import * as cp from "child_process"
import { promises as fs } from "fs"
import * as path from "path"
import { Page } from "playwright"
import { onLine } from "../../../src/node/util"
import { PASSWORD, workspaceDir } from "../../utils/constants"
import { tmpdir } from "../../utils/helpers"
import { idleTimer, tmpdir } from "../../utils/helpers"
interface CodeServerProcess {
process: cp.ChildProcess
......@@ -99,34 +99,44 @@ export class CodeServer {
},
)
const timer = idleTimer("Failed to extract address; did the format change?", reject)
proc.on("error", (error) => {
this.logger.error(error.message)
timer.dispose()
reject(error)
})
proc.on("close", () => {
proc.on("close", (code) => {
const error = new Error("closed unexpectedly")
if (!this.closed) {
this.logger.error(error.message)
this.logger.error(error.message, field("code", code))
}
timer.dispose()
reject(error)
})
let resolved = false
proc.stdout.setEncoding("utf8")
onLine(proc, (line) => {
// As long as we are actively getting input reset the timer. If we stop
// getting input and still have not found the address the timer will
// reject.
timer.reset()
// Log the line without the timestamp.
this.logger.trace(line.replace(/\[.+\]/, ""))
if (resolved) {
return
}
const match = line.trim().match(/HTTP server listening on (https?:\/\/[.:\d]+)$/)
const match = line.trim().match(/HTTP server listening on (https?:\/\/[.:\d]+)\/?$/)
if (match) {
// Cookies don't seem to work on IP address so swap to localhost.
// TODO: Investigate whether this is a bug with code-server.
const address = match[1].replace("127.0.0.1", "localhost")
this.logger.debug(`spawned on ${address}`)
resolved = true
timer.dispose()
resolve({ process: proc, address })
}
})
......@@ -156,7 +166,14 @@ export class CodeServer {
export class CodeServerPage {
private readonly editorSelector = "div.monaco-workbench"
constructor(private readonly codeServer: CodeServer, public readonly page: Page) {}
constructor(private readonly codeServer: CodeServer, public readonly page: Page) {
this.page.on("console", (message) => {
this.codeServer.logger.debug(message)
})
this.page.on("pageerror", (error) => {
logError(this.codeServer.logger, "page", error)
})
}
address() {
return this.codeServer.address()
......
......@@ -3,20 +3,20 @@
"#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.",
"devDependencies": {
"@playwright/test": "^1.12.1",
"@types/jest": "^26.0.20",
"@types/jest": "^27.0.2",
"@types/jsdom": "^16.2.13",
"@types/node-fetch": "^2.5.8",
"@types/supertest": "^2.0.10",
"@types/supertest": "^2.0.11",
"@types/wtfnode": "^0.7.0",
"argon2": "^0.28.0",
"jest": "^26.6.3",
"jest": "^27.3.1",
"jest-fetch-mock": "^3.0.3",
"jsdom": "^16.4.0",
"node-fetch": "^2.6.1",
"playwright": "^1.12.1",
"supertest": "^6.1.1",
"ts-jest": "^26.4.4",
"wtfnode": "^0.9.0"
"supertest": "^6.1.6",
"ts-jest": "^27.0.7",
"wtfnode": "^0.9.1"
},
"resolutions": {
"ansi-regex": "^5.0.1",
......
......@@ -2,7 +2,12 @@ import { PlaywrightTestConfig } from "@playwright/test"
import path from "path"
// Run tests in three browsers.
// The default configuration runs all tests in three browsers with workers equal
// to half the available threads. See 'yarn test:e2e --help' to customize from
// the command line. For example:
// yarn test:e2e --workers 1 # Run with one worker
// yarn test:e2e --project Chromium # Only run on Chromium
// yarn test:e2e --grep login # Run tests matching "login"
const config: PlaywrightTestConfig = {
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
timeout: 60000, // Each test is given 60 seconds.
......
import { JSDOM } from "jsdom"
import { LocationLike } from "../../common/util.test"
describe("login", () => {
describe("there is an element with id 'base'", () => {
beforeEach(() => {
const dom = new JSDOM()
global.document = dom.window.document
const location: LocationLike = {
pathname: "/healthz",
origin: "http://localhost:8080",
}
global.location = location as Location
})
afterEach(() => {
// Reset the global.document
global.document = undefined as any as Document
global.location = undefined as any as Location
})
it("should set the value to options.base", () => {
// Mock getElementById
const spy = jest.spyOn(document, "getElementById")
// Create a fake element and set the attribute
const mockElement = document.createElement("input")
const expected = {
base: "./hello-world",
logLevel: 2,
disableTelemetry: false,
disableUpdateCheck: false,
}
mockElement.setAttribute("data-settings", JSON.stringify(expected))
document.body.appendChild(mockElement)
spy.mockImplementation(() => mockElement)
})
})
describe("there is not an element with id 'base'", () => {
let spy: jest.SpyInstance
beforeAll(() => {
// This is important because we're manually requiring the file
// If you don't call this before all tests
// the module registry from other tests may cause side effects.
jest.resetModuleRegistry()
})
beforeEach(() => {
const dom = new JSDOM()
global.document = dom.window.document
spy = jest.spyOn(document, "getElementById")
const location: LocationLike = {
pathname: "/healthz",
origin: "http://localhost:8080",
}
global.location = location as Location
})
afterEach(() => {
spy.mockClear()
jest.resetModules()
// Reset the global.document
global.document = undefined as any as Document
global.location = undefined as any as Location
})
afterAll(() => {
jest.restoreAllMocks()
})
})
})
......@@ -110,71 +110,6 @@ describe("util", () => {
})
})
describe("getOptions", () => {
beforeEach(() => {
const location: LocationLike = {
pathname: "/healthz",
origin: "http://localhost:8080",
// search: "?environmentId=600e0187-0909d8a00cb0a394720d4dce",
}
// Because resolveBase is not a pure function
// and relies on the global location to be set
// we set it before all the tests
// and tell TS that our location should be looked at
// as Location (even though it's missing some properties)
global.location = location as Location
})
afterEach(() => {
jest.restoreAllMocks()
})
it("should return options with base and cssStaticBase even if it doesn't exist", () => {
expect(util.getClientConfiguration()).toStrictEqual({
base: "",
csStaticBase: "",
})
})
it("should return options when they do exist", () => {
// Mock getElementById
const spy = jest.spyOn(document, "getElementById")
// Create a fake element and set the attribute
const mockElement = document.createElement("div")
mockElement.setAttribute(
"data-settings",
'{"base":".","csStaticBase":"./static/development/Users/jp/Dev/code-server","logLevel":2,"disableUpdateCheck":false}',
)
// Return mockElement from the spy
// this way, when we call "getElementById"
// it returns the element
spy.mockImplementation(() => mockElement)
expect(util.getClientConfiguration()).toStrictEqual({
base: "",
csStaticBase: "/static/development/Users/jp/Dev/code-server",
disableUpdateCheck: false,
logLevel: 2,
})
})
it("should include queryOpts", () => {
// Trying to understand how the implementation works
// 1. It grabs the search params from location.search (i.e. ?)
// 2. it then grabs the "options" param if it exists
// 3. then it creates a new options object
// spreads the original options
// then parses the queryOpts
location.search = '?options={"logLevel":2}'
expect(util.getClientConfiguration()).toStrictEqual({
base: "",
csStaticBase: "",
logLevel: 2,
})
})
})
describe("arrayify", () => {
it("should return value it's already an array", () => {
expect(util.arrayify(["hello", "world"])).toStrictEqual(["hello", "world"])
......
......@@ -47,16 +47,16 @@ describe("createApp", () => {
port,
_: [],
})
const [app, wsApp, server] = await createApp(defaultArgs)
const app = await createApp(defaultArgs)
// This doesn't check much, but it's a good sanity check
// to ensure we actually get back values from createApp
expect(app).not.toBeNull()
expect(wsApp).not.toBeNull()
expect(server).toBeInstanceOf(http.Server)
expect(app.router).not.toBeNull()
expect(app.wsRouter).not.toBeNull()
expect(app.server).toBeInstanceOf(http.Server)
// Cleanup
server.close()
app.dispose()
})
it("should handle error events on the server", async () => {
......@@ -65,24 +65,18 @@ describe("createApp", () => {
_: [],
})
// This looks funky, but that's because createApp
// returns an array like [app, wsApp, server]
// We only need server which is at index 2
// we do it this way so ESLint is happy that we're
// have no declared variables not being used
const app = await createApp(defaultArgs)
const server = app[2]
const testError = new Error("Test error")
// We can easily test how the server handles errors
// By emitting an error event
// Ref: https://stackoverflow.com/a/33872506/3015595
server.emit("error", testError)
app.server.emit("error", testError)
expect(spy).toHaveBeenCalledTimes(1)
expect(spy).toHaveBeenCalledWith(`http server error: ${testError.message} ${testError.stack}`)
// Cleanup
server.close()
app.dispose()
})
it("should reject errors that happen before the server can listen", async () => {
......@@ -96,14 +90,13 @@ describe("createApp", () => {
async function masterBall() {
const app = await createApp(defaultArgs)
const server = app[2]
const testError = new Error("Test error")
server.emit("error", testError)
app.server.emit("error", testError)
// Cleanup
server.close()
app.dispose()
}
expect(() => masterBall()).rejects.toThrow(`listen EACCES: permission denied 127.0.0.1:${port}`)
......@@ -117,10 +110,9 @@ describe("createApp", () => {
})
const app = await createApp(defaultArgs)
const server = app[2]
expect(unlinkSpy).toHaveBeenCalledTimes(1)
server.close()
app.dispose()
})
it("should create an https server if args.cert exists", async () => {
......@@ -133,14 +125,13 @@ describe("createApp", () => {
["cert-key"]: testCertificate.certKey,
})
const app = await createApp(defaultArgs)
const server = app[2]
// This doesn't check much, but it's a good sanity check
// to ensure we actually get an https.Server
expect(server).toBeInstanceOf(https.Server)
expect(app.server).toBeInstanceOf(https.Server)
// Cleanup
server.close()
app.dispose()
})
})
......@@ -156,18 +147,12 @@ describe("ensureAddress", () => {
})
it("should throw and error if no address", () => {
expect(() => ensureAddress(mockServer)).toThrow("server has no address")
})
it("should return the address if it exists and not a string", async () => {
const port = await getAvailablePort()
mockServer.listen(port)
const address = ensureAddress(mockServer)
expect(address).toBe(`http://:::${port}`)
expect(() => ensureAddress(mockServer, "http")).toThrow("Server has no address")
})
it("should return the address if it exists", async () => {
mockServer.address = () => "http://localhost:8080"
const address = ensureAddress(mockServer)
expect(address).toBe(`http://localhost:8080`)
mockServer.address = () => "http://localhost:8080/"
const address = ensureAddress(mockServer, "http")
expect(address.toString()).toBe(`http://localhost:8080/`)
})
})
......
......@@ -10,10 +10,10 @@ import {
parse,
setDefaults,
shouldOpenInExistingInstance,
shouldRunVsCodeCli,
splitOnFirstEquals,
} from "../../../src/node/cli"
import { tmpdir } from "../../../src/node/constants"
import { shouldSpawnCliProcess } from "../../../src/node/main"
import { generatePassword, paths } from "../../../src/node/util"
import { useEnv } from "../../utils/helpers"
......@@ -486,45 +486,45 @@ describe("splitOnFirstEquals", () => {
})
})
describe("shouldRunVsCodeCli", () => {
it("should return false if no 'extension' related args passed in", () => {
describe("shouldSpawnCliProcess", () => {
it("should return false if no 'extension' related args passed in", async () => {
const args = {
_: [],
}
const actual = shouldRunVsCodeCli(args)
const actual = await shouldSpawnCliProcess(args)
const expected = false
expect(actual).toBe(expected)
})
it("should return true if 'list-extensions' passed in", () => {
it("should return true if 'list-extensions' passed in", async () => {
const args = {
_: [],
["list-extensions"]: true,
}
const actual = shouldRunVsCodeCli(args)
const actual = await shouldSpawnCliProcess(args)
const expected = true
expect(actual).toBe(expected)
})
it("should return true if 'install-extension' passed in", () => {
it("should return true if 'install-extension' passed in", async () => {
const args = {
_: [],
["install-extension"]: ["hello.world"],
}
const actual = shouldRunVsCodeCli(args)
const actual = await shouldSpawnCliProcess(args)
const expected = true
expect(actual).toBe(expected)
})
it("should return true if 'uninstall-extension' passed in", () => {
it("should return true if 'uninstall-extension' passed in", async () => {
const args = {
_: [],
["uninstall-extension"]: ["hello.world"],
}
const actual = shouldRunVsCodeCli(args)
const actual = await shouldSpawnCliProcess(args)
const expected = true
expect(actual).toBe(expected)
......
......@@ -58,7 +58,7 @@ describe("plugin", () => {
})
afterAll(async () => {
await s.close()
await s.dispose()
})
it("/api/applications", async () => {
......
import bodyParser from "body-parser"
import * as express from "express"
import * as http from "http"
import * as nodeFetch from "node-fetch"
import nodeFetch from "node-fetch"
import { HttpCode } from "../../../src/common/http"
import { proxy } from "../../../src/node/proxy"
import { getAvailablePort } from "../../utils/helpers"
......@@ -24,7 +24,7 @@ describe("proxy", () => {
})
afterAll(async () => {
await nhooyrDevServer.close()
await nhooyrDevServer.dispose()
})
beforeEach(() => {
......@@ -33,7 +33,7 @@ describe("proxy", () => {
afterEach(async () => {
if (codeServer) {
await codeServer.close()
await codeServer.dispose()
codeServer = undefined
}
})
......@@ -202,13 +202,13 @@ describe("proxy (standalone)", () => {
it("should return a 500 when proxy target errors ", async () => {
// Close the proxy target so that proxy errors
await proxyTarget.close()
const errorResp = await nodeFetch.default(`${URL}/error`)
const errorResp = await nodeFetch(`${URL}/error`)
expect(errorResp.status).toBe(HttpCode.ServerError)
expect(errorResp.statusText).toBe("Internal Server Error")
})
it("should proxy correctly", async () => {
const resp = await nodeFetch.default(`${URL}/route`)
const resp = await nodeFetch(`${URL}/route`)
expect(resp.status).toBe(200)
expect(resp.statusText).toBe("OK")
})
......
......@@ -6,7 +6,7 @@ describe("health", () => {
afterEach(async () => {
if (codeServer) {
await codeServer.close()
await codeServer.dispose()
codeServer = undefined
}
})
......
......@@ -58,7 +58,7 @@ describe("login", () => {
afterEach(async () => {
process.env.PASSWORD = previousEnvPassword
if (_codeServer) {
await _codeServer.close()
await _codeServer.dispose()
_codeServer = undefined
}
})
......@@ -72,5 +72,20 @@ describe("login", () => {
expect(htmlContent).toContain("Missing password")
})
it("should return HTML with 'Incorrect password' message", async () => {
const params = new URLSearchParams()
params.append("password", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
const resp = await codeServer().fetch("/login", {
method: "POST",
body: params,
})
expect(resp.status).toBe(200)
const htmlContent = await resp.text()
expect(htmlContent).toContain("Incorrect password")
})
})
})
......@@ -7,7 +7,7 @@ import * as integration from "../../../utils/integration"
const NOT_FOUND = {
code: 404,
message: "Not Found",
message: /not found/i,
}
describe("/_static", () => {
......@@ -33,7 +33,7 @@ describe("/_static", () => {
afterEach(async () => {
if (_codeServer) {
await _codeServer.close()
await _codeServer.dispose()
_codeServer = undefined
}
})
......@@ -44,7 +44,7 @@ describe("/_static", () => {
expect(resp.status).toBe(NOT_FOUND.code)
const content = await resp.json()
expect(content.error).toContain(NOT_FOUND.message)
expect(content.error).toMatch(NOT_FOUND.message)
})
}
......
......@@ -82,3 +82,21 @@ export const getAvailablePort = (options?: net.ListenOptions): Promise<number> =
})
})
})
/**
* Return a timer that will not reject as long as it is disposed or continually
* reset before the delay elapses.
*/
export function idleTimer(message: string, reject: (error: Error) => void, delay = 5000) {
const start = () => setTimeout(() => reject(new Error(message)), delay)
let timeout = start()
return {
reset: () => {
clearTimeout(timeout)
timeout = start()
},
dispose: () => {
clearTimeout(timeout)
},
}
}
import { logger } from "@coder/logger"
import * as express from "express"
import * as http from "http"
import * as net from "net"
import * as nodeFetch from "node-fetch"
import nodeFetch, { RequestInit, Response } from "node-fetch"
import Websocket from "ws"
import { Disposable } from "../../src/common/emitter"
import * as util from "../../src/common/util"
import { ensureAddress } from "../../src/node/app"
import { disposer } from "../../src/node/http"
import { handleUpgrade } from "../../src/node/wsRouter"
// Perhaps an abstraction similar to this should be used in app.ts as well.
export class HttpServer {
private readonly sockets = new Set<net.Socket>()
private cleanupTimeout?: NodeJS.Timeout
private hs: http.Server
public dispose: Disposable["dispose"]
// See usage in test/integration.ts
public constructor(private readonly hs = http.createServer()) {
this.hs.on("connection", (socket) => {
this.sockets.add(socket)
socket.on("close", () => {
this.sockets.delete(socket)
if (this.cleanupTimeout && this.sockets.size === 0) {
clearTimeout(this.cleanupTimeout)
this.cleanupTimeout = undefined
}
})
})
/**
* Expects a server and a disposal that cleans up the server (and anything
* else that may need cleanup).
*
* Otherwise a new server is created.
*/
public constructor(server?: { server: http.Server; dispose: Disposable["dispose"] }) {
this.hs = server?.server || http.createServer()
this.dispose = server?.dispose || disposer(this.hs)
}
/**
......@@ -34,20 +33,17 @@ export class HttpServer {
public listen(fn: http.RequestListener): Promise<void> {
this.hs.on("request", fn)
let resolved = false
return new Promise((res, rej) => {
return new Promise((resolve, reject) => {
this.hs.on("error", reject)
this.hs.listen(0, "localhost", () => {
res()
resolved = true
})
this.hs.off("error", reject)
resolve()
this.hs.on("error", (err) => {
if (!resolved) {
rej(err)
} else {
this.hs.on("error", (err) => {
// Promise resolved earlier so this is some other error.
util.logError(logger, "http server error", err)
}
})
})
})
}
......@@ -59,49 +55,31 @@ export class HttpServer {
handleUpgrade(app, this.hs)
}
/**
* close cleans up the server.
*/
public close(): Promise<void> {
return new Promise((res, rej) => {
// Close will not actually close anything; it just waits until everything
// is closed.
this.hs.close((err) => {
if (err) {
rej(err)
return
}
res()
})
// If there are sockets remaining we might need to force close them or
// this promise might never resolve.
if (this.sockets.size > 0) {
// Give sockets a chance to close up shop.
this.cleanupTimeout = setTimeout(() => {
this.cleanupTimeout = undefined
for (const socket of this.sockets.values()) {
console.warn("a socket was left hanging")
socket.destroy()
}
}, 1000)
}
})
}
/**
* fetch fetches the request path.
* The request path must be rooted!
*/
public fetch(requestPath: string, opts?: nodeFetch.RequestInit): Promise<nodeFetch.Response> {
return nodeFetch.default(`${ensureAddress(this.hs)}${requestPath}`, opts)
public fetch(requestPath: string, opts?: RequestInit): Promise<Response> {
const address = ensureAddress(this.hs, "http")
if (typeof address === "string") {
throw new Error("Cannot fetch socket path")
}
address.pathname = requestPath
return nodeFetch(address.toString(), opts)
}
/**
* Open a websocket against the requset path.
* Open a websocket against the request path.
*/
public ws(requestPath: string): Websocket {
return new Websocket(`${ensureAddress(this.hs).replace("http:", "ws:")}${requestPath}`)
const address = ensureAddress(this.hs, "ws")
if (typeof address === "string") {
throw new Error("Cannot open websocket to socket path")
}
address.pathname = requestPath
return new Websocket(address.toString())
}
public port(): number {
......
此差异已折叠。
......@@ -7,6 +7,6 @@
"postinstall": "./postinstall.sh"
},
"devDependencies": {
"code-oss-dev": "cdr/vscode#65b2462c212d415fbf521489307e58e5b691818b"
"code-oss-dev": "cdr/vscode#3fc885904886003d88d1f300d6158bee486f644f"
}
}
......@@ -128,10 +128,10 @@
dependencies:
nan "2.14.2"
"@vscode/vscode-languagedetection@1.0.20":
version "1.0.20"
resolved "https://registry.yarnpkg.com/@vscode/vscode-languagedetection/-/vscode-languagedetection-1.0.20.tgz#21c1ae29491cfa33dbea4c6f13d1884e640e4f67"
integrity sha512-y4fs4FCirszla1GaJxqSg/qAql1nvmV1GB/cfr/ioSh8s17pekb/rmJ6oqBksoQ+EA4LL9SToeOIHLZf9X7JNg==
"@vscode/vscode-languagedetection@1.0.21":
version "1.0.21"
resolved "https://registry.yarnpkg.com/@vscode/vscode-languagedetection/-/vscode-languagedetection-1.0.21.tgz#89b48f293f6aa3341bb888c1118d16ff13b032d3"
integrity sha512-zSUH9HYCw5qsCtd7b31yqkpaCU6jhtkKLkvOOA8yTrIRfBSOFb8PPhgmMicD7B/m+t4PwOJXzU1XDtrM9Fd3/g==
agent-base@4, agent-base@^4.3.0:
version "4.3.0"
......@@ -296,13 +296,13 @@ clone-response@^1.0.2:
dependencies:
mimic-response "^1.0.0"
code-oss-dev@cdr/vscode#65b2462c212d415fbf521489307e58e5b691818b:
version "1.60.2"
resolved "https://codeload.github.com/cdr/vscode/tar.gz/65b2462c212d415fbf521489307e58e5b691818b"
code-oss-dev@cdr/vscode#3fc885904886003d88d1f300d6158bee486f644f:
version "1.61.1"
resolved "https://codeload.github.com/cdr/vscode/tar.gz/3fc885904886003d88d1f300d6158bee486f644f"
dependencies:
"@microsoft/applicationinsights-web" "^2.6.4"
"@vscode/sqlite3" "4.0.12"
"@vscode/vscode-languagedetection" "1.0.20"
"@vscode/vscode-languagedetection" "1.0.21"
applicationinsights "1.0.8"
chokidar "3.5.1"
graceful-fs "4.2.6"
......@@ -315,34 +315,34 @@ code-oss-dev@cdr/vscode#65b2462c212d415fbf521489307e58e5b691818b:
native-is-elevated "0.4.3"
native-watchdog "1.3.0"
node-pty "0.11.0-beta7"
nsfw "2.1.2"
path-to-regexp "^6.2.0"
spdlog "^0.13.0"
sudo-prompt "9.2.1"
tar-stream "^2.2.0"
tas-client-umd "0.1.4"
v8-inspect-profiler "^0.0.22"
vscode-nsfw "2.1.8"
vscode-oniguruma "1.5.1"
vscode-proxy-agent "^0.11.0"
vscode-regexpp "^3.1.0"
vscode-ripgrep "^1.12.0"
vscode-ripgrep "^1.12.1"
vscode-textmate "5.4.0"
xterm "4.14.0-beta.22"
xterm-addon-search "0.9.0-beta.4"
xterm-addon-serialize "0.6.0-beta.8"
xterm-addon-unicode11 "0.3.0-beta.6"
xterm-addon-webgl "0.12.0-beta.10"
xterm-headless "4.14.0-beta.12"
xterm "4.15.0-beta.3"
xterm-addon-search "0.9.0-beta.5"
xterm-addon-serialize "0.7.0-beta.1"
xterm-addon-unicode11 "0.3.0"
xterm-addon-webgl "0.12.0-beta.13"
xterm-headless "4.15.0-beta.3"
yauzl "^2.9.2"
yazl "^2.4.3"
optionalDependencies:
electron "13.1.8"
electron "13.5.1"
keytar "7.2.0"
native-keymap "2.2.1"
vscode-windows-registry "1.0.3"
windows-foreground-love "0.4.0"
windows-mutex "0.4.1"
windows-process-tree "0.3.0"
windows-process-tree "^0.3.2"
code-point-at@^1.0.0:
version "1.1.0"
......@@ -483,10 +483,10 @@ duplexer3@^0.1.4:
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
electron@13.1.8:
version "13.1.8"
resolved "https://registry.yarnpkg.com/electron/-/electron-13.1.8.tgz#a6def6eca7cafc7b068a8f71a069e521ba803182"
integrity sha512-ei2ZyyG81zUOlvm5Zxri668TdH5GNLY0wF+XrC2FRCqa8AABAPjJIWTRkhFEr/H6PDVPNZjMPvSs3XhHyVVk2g==
electron@13.5.1:
version "13.5.1"
resolved "https://registry.yarnpkg.com/electron/-/electron-13.5.1.tgz#76c02c39be228532f886a170b472cbd3d93f0d0f"
integrity sha512-ZyxhIhmdaeE3xiIGObf0zqEyCyuIDqZQBv9NKX8w5FNzGm87j4qR0H1+GQg6vz+cA1Nnv1x175Zvimzc0/UwEQ==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^14.6.2"
......@@ -990,16 +990,16 @@ node-abi@^2.21.0:
dependencies:
semver "^5.4.1"
node-addon-api@*:
version "4.1.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.1.0.tgz#f1722f1f60793584632ffffb79e12ca042c48bd0"
integrity sha512-Zz1o1BDX2VtduiAt6kgiUl8jX1Vm3NMboljFYKQJ6ee8AGfiTvM2mlZFI3xPbqjs80rCQgiVJI/DjQ/1QJ0HwA==
node-addon-api@^3.0.0, node-addon-api@^3.0.2:
version "3.2.1"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161"
integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==
node-addon-api@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.2.0.tgz#117cbb5a959dff0992e1c586ae0393573e4d2a87"
integrity sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q==
node-pty@0.11.0-beta7:
version "0.11.0-beta7"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.11.0-beta7.tgz#aed0888b5032d96c54d8473455e6adfae3bbebbe"
......@@ -1035,13 +1035,6 @@ npmlog@^4.0.1:
gauge "~2.7.3"
set-blocking "~2.0.0"
nsfw@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-2.1.2.tgz#4fa841e7f7122b60b2e1f61187d1b57ad3403428"
integrity sha512-zGPdt32aJ5b1laK9rvgXQmXGAagrx3VkcMt0JePtu6wBfzC1o4xLCM3kq7FxZxUnxyxYhODyBYzpt3H16FhaGA==
dependencies:
node-addon-api "*"
number-is-nan@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
......@@ -1469,6 +1462,13 @@ v8-inspect-profiler@^0.0.22:
dependencies:
chrome-remote-interface "0.28.2"
vscode-nsfw@2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/vscode-nsfw/-/vscode-nsfw-2.1.8.tgz#88f5e56b22b2fd0be582e73eb1158ea8257f6c6c"
integrity sha512-tFnxPIuM65czw/Kjz8KXD88fIJtnCjzQ0ighS0a1yasVv6jKkANAlGffiOitTLMkDjvFCY8OyP6xjarTkpu/VQ==
dependencies:
node-addon-api "^4.2.0"
vscode-oniguruma@1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.5.1.tgz#9ca10cd3ada128bd6380344ea28844243d11f695"
......@@ -1494,10 +1494,10 @@ vscode-regexpp@^3.1.0:
resolved "https://registry.yarnpkg.com/vscode-regexpp/-/vscode-regexpp-3.1.0.tgz#42d059b6fffe99bd42939c0d013f632f0cad823f"
integrity sha512-pqtN65VC1jRLawfluX4Y80MMG0DHJydWhe5ZwMHewZD6sys4LbU6lHwFAHxeuaVE6Y6+xZOtAw+9hvq7/0ejkg==
vscode-ripgrep@^1.12.0:
version "1.12.0"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.12.0.tgz#8fee3f892349f2bf1c7ef9743e3bbccb108ad9d7"
integrity sha512-tn+bM7RbVElyuIGjIFyuSZZSuqodDjPNVQeHdo9w7EOIFEOuNtXuZ82s/Sy59lG/gJyMEkXjXjKunbUNNa5kOw==
vscode-ripgrep@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-1.12.1.tgz#4a319809d4010ea230659ce605fddacd1e36a589"
integrity sha512-4edKlcXNSKdC9mIQmQ9Wl25v0SF5DOK31JlvKHKHYV4co0V2MjI9pbDPdmogwbtiykz+kFV/cKnZH2TgssEasQ==
dependencies:
https-proxy-agent "^4.0.0"
proxy-from-env "^1.1.0"
......@@ -1539,10 +1539,10 @@ windows-mutex@0.4.1:
bindings "^1.2.1"
nan "^2.14.0"
windows-process-tree@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.3.0.tgz#cf0d9291b22fba2a7f5a687c8272866e28fbcafd"
integrity sha512-0bKI4gcd5MOsOpn2TdStCSlnjThtH6BdHrocekY9qCgTqgEtdaUs0B5BaqyzF9jXoTSwz38NMdE1F55o4fgv9Q==
windows-process-tree@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/windows-process-tree/-/windows-process-tree-0.3.2.tgz#8c39f39e7707e09fd74638a7ef644b5f389096d3"
integrity sha512-x8Y4KOV8tUhhPiO0TH7wOMTZ677rw7VEwq+dTuHHiLTClkrNXWSY3XzP6ez3fs2Cab4FajrtmiqRs0jTMZHfyw==
dependencies:
nan "^2.13.2"
......@@ -1566,35 +1566,35 @@ xregexp@2.0.0:
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943"
integrity sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=
xterm-addon-search@0.9.0-beta.4:
version "0.9.0-beta.4"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.4.tgz#e332f99d5eb5991f8c0e361c9b0d45b23f454323"
integrity sha512-PMzAPtUOjQjJcqpjB2k9BkbjOZPH4PFuQkBtln2599mCPeA9WdA++FpVN6WdBHgeIR5QILoT4pWg0hA8USInzg==
xterm-addon-serialize@0.6.0-beta.8:
version "0.6.0-beta.8"
resolved "https://registry.yarnpkg.com/xterm-addon-serialize/-/xterm-addon-serialize-0.6.0-beta.8.tgz#b07c56ef86c79935a64c1cbd9930dcbd67631c5d"
integrity sha512-KAy+QTRXCWkctMuuNo1O78q74H1CqrHu2FwOUQiHg6SBkqaTSA+WqRj9RCeD5eb5tyCR22kCticyFUSXeboLow==
xterm-addon-unicode11@0.3.0-beta.6:
version "0.3.0-beta.6"
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.3.0-beta.6.tgz#8914f377757d5078e7b4daee7d3e2b7428b6edf0"
integrity sha512-Qwa18yMhtacf9Jtxy+UuxHfjIeIjaX9q0LUfHtZU8/Lwjh+bGcn8E8IABVSGvXZgPNKw/4TqEpgLFexn+sfc5g==
xterm-addon-webgl@0.12.0-beta.10:
version "0.12.0-beta.10"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.10.tgz#ba23287043da8172f4f9e53babb620f54ad36189"
integrity sha512-mzMOAqgM95FAgzcVzCH/Q0NfN0CTMHVDWCCFyg4B5ZcsuRiQKqQQw0HS+5uOQDtoZEDl2BqGFby7pGpENWGjZQ==
xterm-headless@4.14.0-beta.12:
version "4.14.0-beta.12"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.14.0-beta.12.tgz#06454c63a2e7ca36abbaa0774f7db0d6d7286eff"
integrity sha512-VRtNpNbMvg0mQ3fj7tuC8/thXx5MfzqviSg2KU48mtNMhisGQSH6mL5Q7hgXs7J5m7d2nm3SyklRhQ5ztxRpQg==
xterm@4.14.0-beta.22:
version "4.14.0-beta.22"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.14.0-beta.22.tgz#89e1060927f6542645f53584bfcd35cec08abe5a"
integrity sha512-zl4d2fmjAoCB+G0O5tq2kNkoe7dnnrcY2Daj6VFPPV6nItyXrgRzlKWNfTjKYunC3kU2ApYy+FnHulO7lWuXSw==
xterm-addon-search@0.9.0-beta.5:
version "0.9.0-beta.5"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.9.0-beta.5.tgz#e0e60a203d1c9d6c8af933648a46865dba299302"
integrity sha512-ylfqim0ISBvuuX83LQwgu/06p5GC545QsAo9SssXw03TPpIrcd0zwaVMEnhOftSIzM9EKRRsyx3GbBjgUdiF5w==
xterm-addon-serialize@0.7.0-beta.1:
version "0.7.0-beta.1"
resolved "https://registry.yarnpkg.com/xterm-addon-serialize/-/xterm-addon-serialize-0.7.0-beta.1.tgz#0168ae7b07a4ce3c2445fce10efe91848717ca2e"
integrity sha512-Qt//GUsTix1FFMWJSFYreppn6nfFqFQaLL9Z9sper62/M3Ip4O+dN/bhrtd5pydBl5iqlHixJls3fu/bj3RHjA==
xterm-addon-unicode11@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.3.0.tgz#e4435c3c91a5294a7eb8b79c380acbb28a659463"
integrity sha512-x5fHDZT2j9tlTlHnzPHt++9uKZ2kJ/lYQOj3L6xJA22xoJsS8UQRw/5YIFg2FUHqEAbV77Z1fZij/9NycMSH/A==
xterm-addon-webgl@0.12.0-beta.13:
version "0.12.0-beta.13"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.12.0-beta.13.tgz#95ecf99531adcce1349f2ddfc834a40af681780e"
integrity sha512-oPQHkFcuCB+x60wilGXFS+viZbOGNFijmuHEWehCUcLFQP5Mph0/6qXLZjgn47728QvCxU7HnXPqcD7JSxe0Tg==
xterm-headless@4.15.0-beta.3:
version "4.15.0-beta.3"
resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-4.15.0-beta.3.tgz#b1ba884e2e2feef17d92eaf3ff59b0b20c059dd8"
integrity sha512-MmC75/XUz9z1fHBdJV0Mx9Fje+8hegocT1NfWUNLri3+XFvy5/UbLRhrGUw/lxWKgthseV6eqI44QTNh7fVTQg==
xterm@4.15.0-beta.3:
version "4.15.0-beta.3"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.15.0-beta.3.tgz#123ec4303be390e61cd24ae29872b9fa4e73ad30"
integrity sha512-CXzu0xDHsrOxzC+Tm9ju+eqq0VFiYZPuzPAtfoKOp2PW+wt4fRkM4kysrdLdfE2kz6qyRckRxl+3l7VzlJHVCA==
yallist@^4.0.0:
version "4.0.0"
......
......@@ -1090,9 +1090,9 @@ cookie@0.4.0:
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
version "1.0.3"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
cosmiconfig@^7.0.0:
version "7.0.0"
......@@ -1148,10 +1148,10 @@ debug@3.1.0:
dependencies:
ms "2.0.0"
debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
debug@4:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"
......@@ -1162,6 +1162,13 @@ debug@^3.2.7:
dependencies:
ms "^2.1.1"
debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
dependencies:
ms "2.1.2"
decamelize-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
......@@ -4401,9 +4408,9 @@ vfile@^4.0.0:
vfile-message "^2.0.0"
vm2@^3.9.3:
version "3.9.3"
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.3.tgz#29917f6cc081cc43a3f580c26c5b553fd3c91f40"
integrity sha512-smLS+18RjXYMl9joyJxMNI9l4w7biW8ilSDaVRvFBDwOH8P0BK1ognFQTpg0wyQ6wIKLTblHJvROW692L/E53Q==
version "3.9.5"
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.5.tgz#5288044860b4bbace443101fcd3bddb2a0aa2496"
integrity sha512-LuCAHZN75H9tdrAiLFf030oW7nJV5xwNMuk1ymOZwopmuK3d2H4L1Kv4+GFHgarKiLfXXLFU+7LDABHnwOkWng==
which-boxed-primitive@^1.0.2:
version "1.0.2"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册