From 548d095611bf047241c3e6d224de930907630e69 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 4 Oct 2019 18:14:07 -0500 Subject: [PATCH] Add support for running extensions in the browser --- main.js | 2 +- package.json | 5 +- scripts/build-json.js | 4 +- scripts/vscode.patch | 348 ++++++++++++++++++++++++++++- src/{ => browser}/api.ts | 2 +- src/{ => browser}/client.ts | 33 ++- src/browser/extHostNodeProxy.ts | 46 ++++ src/browser/mainThreadNodeProxy.ts | 37 +++ src/{ => browser}/upload.ts | 0 src/common/nodeProxy.ts | 47 ++++ src/{ => common}/telemetry.ts | 0 src/{ => node}/channel.ts | 40 +++- src/{ => node}/cli.ts | 8 +- src/{ => node}/connection.ts | 6 +- src/{ => node}/insights.ts | 0 src/{ => node}/ipc.ts | 0 src/{ => node}/marketplace.ts | 2 +- src/{ => node}/nls.ts | 0 src/{ => node}/protocol.ts | 0 src/{ => node}/server.ts | 21 +- src/{ => node}/update.ts | 6 +- src/{ => node}/uriTransformer.js | 6 +- src/{ => node}/util.ts | 4 +- yarn.lock | 161 +++++++++++++ 24 files changed, 727 insertions(+), 51 deletions(-) rename src/{ => browser}/api.ts (99%) rename src/{ => browser}/client.ts (70%) create mode 100644 src/browser/extHostNodeProxy.ts create mode 100644 src/browser/mainThreadNodeProxy.ts rename src/{ => browser}/upload.ts (100%) create mode 100644 src/common/nodeProxy.ts rename src/{ => common}/telemetry.ts (100%) rename src/{ => node}/channel.ts (89%) rename src/{ => node}/cli.ts (97%) rename src/{ => node}/connection.ts (96%) rename src/{ => node}/insights.ts (100%) rename src/{ => node}/ipc.ts (100%) rename src/{ => node}/marketplace.ts (98%) rename src/{ => node}/nls.ts (100%) rename src/{ => node}/protocol.ts (100%) rename src/{ => node}/server.ts (97%) rename src/{ => node}/update.ts (97%) rename src/{ => node}/uriTransformer.js (78%) rename src/{ => node}/util.ts (97%) diff --git a/main.js b/main.js index aa3760e1a..360cd6eaa 100644 --- a/main.js +++ b/main.js @@ -4,4 +4,4 @@ // while still allowing us to access files within the binary. process.env.NBIN_BYPASS = true; -require("../../bootstrap-amd").load("vs/server/src/cli"); +require("../../bootstrap-amd").load("vs/server/src/node/cli"); diff --git a/package.json b/package.json index 72e01c960..122a8a620 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,13 @@ }, "dependencies": { "@coder/logger": "^1.1.8", + "@coder/node-browser": "^1.0.0", + "@coder/requirefs": "^1.0.3", "httpolyglot": "^0.1.2", "pem": "^1.14.2", "safe-compare": "^1.1.4", "tar-fs": "^2.0.0", - "tar-stream": "^2.1.0" + "tar-stream": "^2.1.0", + "util": "^0.12.1" } } diff --git a/scripts/build-json.js b/scripts/build-json.js index 188d4daed..0f578ca74 100644 --- a/scripts/build-json.js +++ b/scripts/build-json.js @@ -45,8 +45,8 @@ const writeProduct = () => { "vs/workbench/workbench.web.api.css", "vs/code/browser/workbench/workbench.html", "vs/code/browser/workbench/workbench.js", - "vs/server/src/cli.js", - "vs/server/src/uriTransformer.js", + "vs/server/src/node/cli.js", + "vs/server/src/node/uriTransformer.js", "vs/server/src/login/index.html" ]); const date = new Date().toISOString(); diff --git a/scripts/vscode.patch b/scripts/vscode.patch index 0841171cf..b07118fe1 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -1,5 +1,5 @@ diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js -index 6bb695db68..ecbabe5dc8 100644 +index 6bb695db68..7f6c5cd3cb 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -47,24 +47,28 @@ const nodeModules = ['electron', 'original-fs'] @@ -8,7 +8,7 @@ index 6bb695db68..ecbabe5dc8 100644 const vscodeEntryPoints = _.flatten([ - buildfile.entrypoint('vs/workbench/workbench.desktop.main'), + buildfile.entrypoint('vs/workbench/workbench.web.api'), -+ buildfile.entrypoint('vs/server/src/cli'), ++ buildfile.entrypoint('vs/server/src/node/cli'), buildfile.base, buildfile.serviceWorker, - buildfile.workbenchDesktop, @@ -23,7 +23,7 @@ index 6bb695db68..ecbabe5dc8 100644 - 'out-build/cli.js', - 'out-build/driver.js', + 'out-build/vs/server/main.js', -+ 'out-build/vs/server/src/uriTransformer.js', ++ 'out-build/vs/server/src/node/uriTransformer.js', + 'out-build/vs/code/browser/workbench/**', + 'out-build/vs/server/src/media/*', + 'out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js', @@ -509,15 +509,296 @@ index d789bf4e09..e25c9c9d6a 100644 return Promise.resolve(undefined); } +diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts +index 2905c52411..303ddf211f 100644 +--- a/src/vs/workbench/api/browser/extensionHost.contribution.ts ++++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts +@@ -57,6 +57,7 @@ import './mainThreadComments'; + import './mainThreadTask'; + import './mainThreadLabelService'; + import 'vs/workbench/api/common/apiCommands'; ++import 'vs/server/src/browser/mainThreadNodeProxy'; + + export class ExtensionPoints implements IWorkbenchContribution { + +diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts +index c5fd74ffe7..e972b03f79 100644 +--- a/src/vs/workbench/api/common/extHost.api.impl.ts ++++ b/src/vs/workbench/api/common/extHost.api.impl.ts +@@ -68,6 +68,7 @@ import { ILogService } from 'vs/platform/log/common/log'; + import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService'; + import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; + import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; ++import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy'; + + export interface IExtensionApiFactory { + (extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode; +@@ -87,6 +88,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I + const rpcProtocol = accessor.get(IExtHostRpcService); + const extHostStorage = accessor.get(IExtHostStorage); + const extHostLogService = accessor.get(ILogService); ++ const extHostNodeProxy = accessor.get(IExtHostNodeProxy); + + // register addressable instances + rpcProtocol.set(ExtHostContext.ExtHostLogService, extHostLogService); +@@ -94,6 +96,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I + rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration); + rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService); + rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage); ++ rpcProtocol.set(ExtHostContext.ExtHostNodeProxy, extHostNodeProxy); + + // automatically create and register addressable instances + const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations)); +diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts +index a6ac9b8086..c0027b8f74 100644 +--- a/src/vs/workbench/api/common/extHost.protocol.ts ++++ b/src/vs/workbench/api/common/extHost.protocol.ts +@@ -614,6 +614,10 @@ export interface MainThreadLabelServiceShape extends IDisposable { + $unregisterResourceLabelFormatter(handle: number): void; + } + ++export interface MainThreadNodeProxyShape extends IDisposable { ++ $send(message: string): void; ++} ++ + export interface MainThreadSearchShape extends IDisposable { + $registerFileSearchProvider(handle: number, scheme: string): void; + $registerTextSearchProvider(handle: number, scheme: string): void; +@@ -844,6 +848,13 @@ export interface ExtHostLabelServiceShape { + $registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable; + } + ++export interface ExtHostNodeProxyShape { ++ $onMessage(message: string): void; ++ $onClose(): void; ++ $onDown(): void; ++ $onUp(): void; ++} ++ + export interface ExtHostSearchShape { + $provideFileSearchResults(handle: number, session: number, query: search.IRawQuery, token: CancellationToken): Promise; + $provideTextSearchResults(handle: number, session: number, query: search.IRawTextQuery, token: CancellationToken): Promise; +@@ -1351,7 +1362,8 @@ export const MainContext = { + MainThreadSearch: createMainId('MainThreadSearch'), + MainThreadTask: createMainId('MainThreadTask'), + MainThreadWindow: createMainId('MainThreadWindow'), +- MainThreadLabelService: createMainId('MainThreadLabelService') ++ MainThreadLabelService: createMainId('MainThreadLabelService'), ++ MainThreadNodeProxy: createMainId('MainThreadNodeProxy') + }; + + export const ExtHostContext = { +@@ -1385,5 +1397,6 @@ export const ExtHostContext = { + ExtHostStorage: createMainId('ExtHostStorage'), + ExtHostUrls: createExtId('ExtHostUrls'), + ExtHostOutputService: createMainId('ExtHostOutputService'), +- ExtHosLabelService: createMainId('ExtHostLabelService') ++ ExtHosLabelService: createMainId('ExtHostLabelService'), ++ ExtHostNodeProxy: createMainId('ExtHostNodeProxy') + }; +diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts +index 8c903a6027..7199c1e467 100644 +--- a/src/vs/workbench/api/common/extHostExtensionService.ts ++++ b/src/vs/workbench/api/common/extHostExtensionService.ts +@@ -5,7 +5,7 @@ + + import * as nls from 'vs/nls'; + import * as path from 'vs/base/common/path'; +-import { originalFSPath, joinPath } from 'vs/base/common/resources'; ++import { originalFSPath } from 'vs/base/common/resources'; + import { Barrier } from 'vs/base/common/async'; + import { dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle'; + import { TernarySearchTree } from 'vs/base/common/map'; +@@ -32,6 +32,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData + import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths'; + import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; + import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; ++import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy'; + + interface ITestRunner { + /** Old test runner API, as exported from `vscode/lib/testrunner` */ +@@ -75,6 +76,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + protected readonly _extHostWorkspace: ExtHostWorkspace; + protected readonly _extHostConfiguration: ExtHostConfiguration; + protected readonly _logService: ILogService; ++ protected readonly _nodeProxy: IExtHostNodeProxy; + + protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape; + protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape; +@@ -103,7 +105,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + @IExtHostConfiguration extHostConfiguration: IExtHostConfiguration, + @ILogService logService: ILogService, + @IExtHostInitDataService initData: IExtHostInitDataService, +- @IExtensionStoragePaths storagePath: IExtensionStoragePaths ++ @IExtensionStoragePaths storagePath: IExtensionStoragePaths, ++ @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy, + ) { + this._hostUtils = hostUtils; + this._extHostContext = extHostContext; +@@ -112,6 +115,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + this._extHostWorkspace = extHostWorkspace; + this._extHostConfiguration = extHostConfiguration; + this._logService = logService; ++ this._nodeProxy = nodeProxy; + this._disposables = new DisposableStore(); + + this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace); +@@ -331,15 +335,15 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio + this._logService.info(`ExtensionService#_doActivateExtension ${extensionDescription.identifier.value} ${JSON.stringify(reason)}`); + + const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup); +- return Promise.all([ +- this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder), ++ return Promise.all([ ++ this._loadCommonJSModule(extensionDescription, activationTimesBuilder), + this._loadExtensionContext(extensionDescription) + ]).then(values => { + return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder); + }); + } + +- protected abstract _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise; ++ protected abstract _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise; + + private _loadExtensionContext(extensionDescription: IExtensionDescription): Promise { + +diff --git a/src/vs/workbench/api/node/extHost.services.ts b/src/vs/workbench/api/node/extHost.services.ts +index a227d8a67b..92553a976c 100644 +--- a/src/vs/workbench/api/node/extHost.services.ts ++++ b/src/vs/workbench/api/node/extHost.services.ts +@@ -26,6 +26,8 @@ import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionS + import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; + import { ILogService } from 'vs/platform/log/common/log'; + import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService'; ++import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; ++import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy'; + + // register singleton services + registerSingleton(ILogService, ExtHostLogService); +@@ -42,3 +44,19 @@ registerSingleton(IExtHostSearch, ExtHostSearch); + registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths); + registerSingleton(IExtHostExtensionService, ExtHostExtensionService); + registerSingleton(IExtHostStorage, ExtHostStorage); ++ ++function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { ++ return class { ++ constructor() { ++ return new Proxy({}, { ++ get(target: any, prop: string | number) { ++ if (target[prop]) { ++ return target[prop]; ++ } ++ throw new Error(`Not Implemented: ${name}->${String(prop)}`); ++ } ++ }); ++ } ++ }; ++} ++registerSingleton(IExtHostNodeProxy, class extends NotImplementedProxy(IExtHostNodeProxy) {}); +diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts +index 8e96e6738e..5a3a48101a 100644 +--- a/src/vs/workbench/api/node/extHostExtensionService.ts ++++ b/src/vs/workbench/api/node/extHostExtensionService.ts +@@ -13,6 +13,8 @@ import { ExtHostDownloadService } from 'vs/workbench/api/node/extHostDownloadSer + import { CLIServer } from 'vs/workbench/api/node/extHostCLIServer'; + import { URI } from 'vs/base/common/uri'; + import { Schemas } from 'vs/base/common/network'; ++import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; ++import { joinPath } from 'vs/base/common/resources'; + + class NodeModuleRequireInterceptor extends RequireInterceptor { + +@@ -75,7 +77,10 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { + }; + } + +- protected _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { ++ protected _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { ++ if (!URI.isUri(module)) { ++ module = joinPath(module.extensionLocation, module.main!); ++ } + if (module.scheme !== Schemas.file) { + throw new Error(`Cannot load URI: '${module}', must be of file-scheme`); + } +diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts +index 4fcb6db76f..840ac56c3b 100644 +--- a/src/vs/workbench/api/worker/extHostExtensionService.ts ++++ b/src/vs/workbench/api/worker/extHostExtensionService.ts +@@ -10,6 +10,9 @@ import { endsWith, startsWith } from 'vs/base/common/strings'; + import { URI } from 'vs/base/common/uri'; + import { joinPath } from 'vs/base/common/resources'; + import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor'; ++import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; ++import { fromTar } from 'vs/server/node_modules/@coder/requirefs/out/src/requirefs'; ++import { Client } from 'vs/server/node_modules/@coder/node-browser/out/client/client'; + + class ExportsTrap { + +@@ -105,7 +108,44 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { + await this._fakeModules.install(); + } + +- protected _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { ++ protected async _loadCommonJSModule(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { ++ if (!URI.isUri(module) && module.extensionKind !== 'web') { ++ const fetchUri = URI.from({ ++ scheme: self.location.protocol.replace(':', ''), ++ authority: self.location.host, ++ path: `${self.location.pathname.replace(/\/static\/out\/vs\/workbench\/services\/extensions\/worker\/extensionHostWorkerMain.js$/, '')}/tar`, ++ query: `path=${encodeURIComponent(module.extensionLocation.path)}`, ++ }); ++ const response = await fetch(fetchUri.toString(true)); ++ if (response.status !== 200) { ++ throw new Error(`Failed to download extension '${module.extensionLocation.path}'`); ++ } ++ const client = new Client(this._nodeProxy, { logger: this._logService }); ++ const init = await client.handshake(); ++ const buffer = new Uint8Array(await response.arrayBuffer()); ++ const rfs = fromTar(buffer); ++ (self).global = self; ++ rfs.provide('vscode', this._fakeModules.getModule('vscode', module.extensionLocation)); ++ Object.keys(client.modules).forEach((key) => { ++ const mod = (client.modules as any)[key]; ++ if (key === 'process') { ++ (self).process = mod; ++ (self).process.env = init.env; ++ return; ++ } ++ ++ rfs.provide(key, mod); ++ switch (key) { ++ case 'buffer': ++ (self).Buffer = mod.Buffer; ++ break; ++ case 'timers': ++ (self).setImmediate = mod.setImmediate; ++ break; ++ } ++ }); ++ return rfs.require('.'); ++ } + + (self).window = self; // <- that's improper but might help extensions that aren't authored correctly + +@@ -132,6 +172,9 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { + + return trap.claim(); + }; ++ if (!URI.isUri(module)) { ++ module = joinPath(module.extensionLocation, module.main!); ++ } + + try { + activationTimesBuilder.codeLoadingStart(); diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts -index b99f800164..eb82443e74 100644 +index b99f800164..bf44f1d9c4 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -32,6 +32,7 @@ import { IRecentFile } from 'vs/platform/history/common/history'; import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing'; import { withNullAsUndefined } from 'vs/base/common/types'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -+import { IUploadService } from 'vs/server/src/upload'; ++import { IUploadService } from 'vs/server/src/browser/upload'; export interface IDraggedResource { resource: URI; @@ -570,14 +851,14 @@ index 2e1e63986f..563c4b2472 100644 } diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts -index f5944ce974..f2094de18b 100644 +index f5944ce974..66bedce55c 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -45,6 +45,7 @@ import { FileLogService } from 'vs/platform/log/common/fileLogService'; import { toLocalISOString } from 'vs/base/common/date'; import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedDBLogProvider'; import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider'; -+import { initialize } from 'vs/server/src/client'; ++import { initialize } from 'vs/server/src/browser/client'; class CodeRendererMain extends Disposable { @@ -598,14 +879,14 @@ index f5944ce974..f2094de18b 100644 if (!this.configuration.userDataProvider) { const remoteUserDataUri = this.getRemoteUserDataUri(); diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts -index 895a8a0393..6530b66cbb 100644 +index 895a8a0393..e9fa627fba 100644 --- a/src/vs/workbench/browser/web.simpleservices.ts +++ b/src/vs/workbench/browser/web.simpleservices.ts @@ -33,6 +33,7 @@ import { localize } from 'vs/nls'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; // tslint:disable-next-line: import-patterns import { IWorkspaceStatsService, Tags } from 'vs/workbench/contrib/stats/common/workspaceStats'; -+import { withQuery } from 'vs/server/src/client'; ++import { withQuery } from 'vs/server/src/browser/client'; //#region Update @@ -669,14 +950,14 @@ index 19fcd5b0ac..30df54ac1a 100644 'additionalProperties': { 'anyOf': [ diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts -index 0c368120df..52ece63cd0 100644 +index 0c368120df..6396d2316b 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -47,6 +47,7 @@ import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/work import { findValidPasteFileTarget } from 'vs/workbench/contrib/files/browser/fileActions'; import { FuzzyScore, createMatches } from 'vs/base/common/filters'; import { Emitter } from 'vs/base/common/event'; -+import { IUploadService } from 'vs/server/src/upload'; ++import { IUploadService } from 'vs/server/src/browser/upload'; export class ExplorerDelegate implements IListVirtualDelegate { @@ -1044,6 +1325,31 @@ index 7c3b6ae53e..18dec6effa 100644 readonly logFile: URI; get webviewResourceRoot(): string { +diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts +index 0f09ebb5b6..1efd5fb196 100644 +--- a/src/vs/workbench/services/extensions/browser/extensionService.ts ++++ b/src/vs/workbench/services/extensions/browser/extensionService.ts +@@ -119,6 +119,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten + + } else { + // remote: only enabled and none-web'ish extension ++ localExtensions.push(...remoteEnv.extensions.filter(extension => this._isEnabled(extension) && isWebExtension(extension, this._configService))); + remoteEnv.extensions = remoteEnv.extensions.filter(extension => this._isEnabled(extension) && !isWebExtension(extension, this._configService)); + this._checkEnableProposedApi(remoteEnv.extensions); + +diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts +index a1496708db..e65acfffbe 100644 +--- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts ++++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts +@@ -12,7 +12,7 @@ import { IProductService } from 'vs/platform/product/common/product'; + + export function isWebExtension(manifest: IExtensionManifest, configurationService: IConfigurationService): boolean { + const extensionKind = getExtensionKind(manifest, configurationService); +- return extensionKind === 'web'; ++ return extensionKind === 'web' || manifest.name === 'vim'; + } + + export function isUIExtension(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean { diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts index 6d31b177ac..67c955a59d 100644 --- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts @@ -1072,6 +1378,26 @@ index 6d31b177ac..67c955a59d 100644 }); } } +diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts +index bf4a779155..1aa90b3e36 100644 +--- a/src/vs/workbench/services/extensions/worker/extHost.services.ts ++++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts +@@ -21,6 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio + import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; + import { ILogService } from 'vs/platform/log/common/log'; + import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; ++import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy'; + + // register singleton services + registerSingleton(ILogService, ExtHostLogService); +@@ -32,6 +33,7 @@ registerSingleton(IExtHostCommands, ExtHostCommands); + registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors); + registerSingleton(IExtHostStorage, ExtHostStorage); + registerSingleton(IExtHostExtensionService, ExtHostExtensionService); ++registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy); + + // register services that only throw errors + function NotImplementedProxy(name: ServiceIdentifier): { new(): T } { diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 681fc606b6..e34ef5d4bc 100644 --- a/src/vs/workbench/workbench.web.main.ts diff --git a/src/api.ts b/src/browser/api.ts similarity index 99% rename from src/api.ts rename to src/browser/api.ts index 26880cc21..649ebd71d 100644 --- a/src/api.ts +++ b/src/browser/api.ts @@ -1,5 +1,5 @@ import * as vscode from "vscode"; -import { CoderApi, VSCodeApi } from "../typings/api"; +import { CoderApi, VSCodeApi } from "../../typings/api"; import { createCSSRule } from "vs/base/browser/dom"; import { Emitter, Event } from "vs/base/common/event"; import { IDisposable } from "vs/base/common/lifecycle"; diff --git a/src/client.ts b/src/browser/client.ts similarity index 70% rename from src/client.ts rename to src/browser/client.ts index 1bd2aa149..c2c926bf2 100644 --- a/src/client.ts +++ b/src/browser/client.ts @@ -1,13 +1,18 @@ +import { Emitter } from "vs/base/common/event"; import { URI } from "vs/base/common/uri"; import { registerSingleton } from "vs/platform/instantiation/common/extensions"; import { ServiceCollection } from "vs/platform/instantiation/common/serviceCollection"; -import { ITelemetryService } from "vs/platform/telemetry/common/telemetry"; import { ILocalizationsService } from "vs/platform/localizations/common/localizations"; import { LocalizationsService } from "vs/platform/localizations/electron-browser/localizationsService"; +import { ITelemetryService } from "vs/platform/telemetry/common/telemetry"; import { IUpdateService } from "vs/platform/update/common/update"; import { UpdateService } from "vs/platform/update/electron-browser/updateService"; -import { TelemetryChannelClient } from "vs/server/src/telemetry"; -import { IUploadService, UploadService } from 'vs/server/src/upload'; +import { coderApi, vscodeApi } from "vs/server/src/browser/api"; +import { IUploadService, UploadService } from "vs/server/src/browser/upload"; +import { INodeProxyService, NodeProxyChannelClient } from "vs/server/src/common/nodeProxy"; +import { TelemetryChannelClient } from "vs/server/src/common/telemetry"; +import "vs/workbench/contrib/localizations/browser/localizations.contribution"; +import "vs/workbench/contrib/update/electron-browser/update.contribution"; import { IRemoteAgentService } from "vs/workbench/services/remote/common/remoteAgentService"; class TelemetryService extends TelemetryChannelClient { @@ -18,16 +23,28 @@ class TelemetryService extends TelemetryChannelClient { } } +class NodeProxyService extends NodeProxyChannelClient implements INodeProxyService { + private readonly _onClose = new Emitter(); + public readonly onClose = this._onClose.event; + private readonly _onDown = new Emitter(); + public readonly onDown = this._onDown.event; + private readonly _onUp = new Emitter(); + public readonly onUp = this._onUp.event; + + public constructor( + @IRemoteAgentService remoteAgentService: IRemoteAgentService, + ) { + // TODO: up/down/close + super(remoteAgentService.getConnection()!.getChannel("nodeProxy")); + } +} + registerSingleton(ILocalizationsService, LocalizationsService); +registerSingleton(INodeProxyService, NodeProxyService); registerSingleton(ITelemetryService, TelemetryService); registerSingleton(IUpdateService, UpdateService); registerSingleton(IUploadService, UploadService, true); -import "vs/workbench/contrib/update/electron-browser/update.contribution"; -import 'vs/workbench/contrib/localizations/browser/localizations.contribution'; - -import { coderApi, vscodeApi } from "vs/server/src/api"; - /** * This is called by vs/workbench/browser/web.main.ts after the workbench has * been initialized so we can initialize our own client-side code. diff --git a/src/browser/extHostNodeProxy.ts b/src/browser/extHostNodeProxy.ts new file mode 100644 index 000000000..e5a88a940 --- /dev/null +++ b/src/browser/extHostNodeProxy.ts @@ -0,0 +1,46 @@ +import { Emitter } from "vs/base/common/event"; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { ExtHostNodeProxyShape, MainContext, MainThreadNodeProxyShape } from "vs/workbench/api/common/extHost.protocol"; +import { IExtHostRpcService } from "vs/workbench/api/common/extHostRpcService"; + +export class ExtHostNodeProxy implements ExtHostNodeProxyShape { + _serviceBrand: any; + + private readonly _onMessage = new Emitter(); + public readonly onMessage = this._onMessage.event; + private readonly _onClose = new Emitter(); + public readonly onClose = this._onClose.event; + private readonly _onDown = new Emitter(); + public readonly onDown = this._onDown.event; + private readonly _onUp = new Emitter(); + public readonly onUp = this._onUp.event; + + private readonly proxy: MainThreadNodeProxyShape; + + constructor(@IExtHostRpcService rpc: IExtHostRpcService) { + this.proxy = rpc.getProxy(MainContext.MainThreadNodeProxy); + } + + public $onMessage(message: string): void { + this._onMessage.fire(message); + } + + public $onClose(): void { + this._onClose.fire(); + } + + public $onUp(): void { + this._onUp.fire(); + } + + public $onDown(): void { + this._onDown.fire(); + } + + public send(message: string): void { + this.proxy.$send(message); + } +} + +export interface IExtHostNodeProxy extends ExtHostNodeProxy { } +export const IExtHostNodeProxy = createDecorator('IExtHostNodeProxy'); diff --git a/src/browser/mainThreadNodeProxy.ts b/src/browser/mainThreadNodeProxy.ts new file mode 100644 index 000000000..ab23d3ad9 --- /dev/null +++ b/src/browser/mainThreadNodeProxy.ts @@ -0,0 +1,37 @@ +import { IDisposable } from "vs/base/common/lifecycle"; +import { INodeProxyService } from "vs/server/src/common/nodeProxy"; +import { ExtHostContext, IExtHostContext, MainContext, MainThreadNodeProxyShape } from "vs/workbench/api/common/extHost.protocol"; +import { extHostNamedCustomer } from "vs/workbench/api/common/extHostCustomers"; + +@extHostNamedCustomer(MainContext.MainThreadNodeProxy) +export class MainThreadNodeProxy implements MainThreadNodeProxyShape { + private disposed = false; + private disposables = []; + + constructor( + extHostContext: IExtHostContext, + @INodeProxyService private readonly proxyService: INodeProxyService, + ) { + if (!extHostContext.remoteAuthority) { // HACK: A terrible way to detect if running in the worker. + const proxy = extHostContext.getProxy(ExtHostContext.ExtHostNodeProxy); + this.disposables = [ + this.proxyService.onMessage((message: string) => proxy.$onMessage(message)), + this.proxyService.onClose(() => proxy.$onClose()), + this.proxyService.onDown(() => proxy.$onDown()), + this.proxyService.onUp(() => proxy.$onUp()), + ]; + } + } + + $send(message: string): void { + if (!this.disposed) { + this.proxyService.send(message); + } + } + + dispose(): void { + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + this.disposed = true; + } +} diff --git a/src/upload.ts b/src/browser/upload.ts similarity index 100% rename from src/upload.ts rename to src/browser/upload.ts diff --git a/src/common/nodeProxy.ts b/src/common/nodeProxy.ts new file mode 100644 index 000000000..bfbd6575d --- /dev/null +++ b/src/common/nodeProxy.ts @@ -0,0 +1,47 @@ +import { Event } from "vs/base/common/event"; +import { IChannel, IServerChannel } from "vs/base/parts/ipc/common/ipc"; +import { createDecorator } from "vs/platform/instantiation/common/instantiation"; +import { ReadWriteConnection } from "vs/server/node_modules/@coder/node-browser/out/common/connection"; + +export const INodeProxyService = createDecorator("nodeProxyService"); + +export interface INodeProxyService extends ReadWriteConnection { + _serviceBrand: any; + send(message: string): void; + onMessage: Event; + onUp: Event; + onClose: Event; + onDown: Event; +} + +export class NodeProxyChannel implements IServerChannel { + constructor(private service: INodeProxyService) {} + + listen(_: unknown, event: string): Event { + switch (event) { + case "onMessage": return this.service.onMessage; + } + throw new Error(`Invalid listen ${event}`); + } + + async call(_: unknown, command: string, args?: any): Promise { + switch (command) { + case "send": return this.service.send(args[0]); + } + throw new Error(`Invalid call ${command}`); + } +} + +export class NodeProxyChannelClient { + _serviceBrand: any; + + public readonly onMessage: Event; + + constructor(private readonly channel: IChannel) { + this.onMessage = this.channel.listen("onMessage"); + } + + public send(data: string): void { + this.channel.call("send", [data]); + } +} diff --git a/src/telemetry.ts b/src/common/telemetry.ts similarity index 100% rename from src/telemetry.ts rename to src/common/telemetry.ts diff --git a/src/channel.ts b/src/node/channel.ts similarity index 89% rename from src/channel.ts rename to src/node/channel.ts index 99fcb384d..f2554f446 100644 --- a/src/channel.ts +++ b/src/node/channel.ts @@ -16,9 +16,11 @@ import pkg from "vs/platform/product/node/package"; import product from "vs/platform/product/node/product"; import { IRemoteAgentEnvironment } from "vs/platform/remote/common/remoteAgentEnvironment"; import { ITelemetryService } from "vs/platform/telemetry/common/telemetry"; -import { getTranslations } from "vs/server/src/nls"; -import { getUriTransformer } from "vs/server/src/util"; +import { INodeProxyService } from "vs/server/src/common/nodeProxy"; +import { getTranslations } from "vs/server/src/node/nls"; +import { getUriTransformer } from "vs/server/src/node/util"; import { ExtensionScanner, ExtensionScannerInput } from "vs/workbench/services/extensions/node/extensionPoints"; +import { Server } from "vs/server/node_modules/@coder/node-browser/out/server/server"; /** * Extend the file provider to allow unwatching. @@ -274,3 +276,37 @@ export class ExtensionEnvironmentChannel implements IServerChannel { this.telemetry.setEnabled(false); } } + +export class NodeProxyService implements INodeProxyService { + public _serviceBrand = undefined; + + public readonly server: Server; + + private readonly _onMessage = new Emitter(); + public readonly onMessage = this._onMessage.event; + private readonly _$onMessage = new Emitter(); + public readonly $onMessage = this._$onMessage.event; + private readonly _onClose = new Emitter(); + public readonly onClose = this._onClose.event; + private readonly _onDown = new Emitter(); + public readonly onDown = this._onDown.event; + private readonly _onUp = new Emitter(); + public readonly onUp = this._onUp.event; + + public constructor() { + // TODO: close/down/up + this.server = new Server({ + onMessage: this.$onMessage, + onClose: this.onClose, + onDown: this.onDown, + onUp: this.onUp, + send: (message: string): void => { + this._onMessage.fire(message); + } + }); + } + + public send(message: string): void { + this._$onMessage.fire(message); + } +} diff --git a/src/cli.ts b/src/node/cli.ts similarity index 97% rename from src/cli.ts rename to src/node/cli.ts index f65f055eb..1766bdb2e 100644 --- a/src/cli.ts +++ b/src/node/cli.ts @@ -9,10 +9,10 @@ import { buildHelpMessage, buildVersionMessage, Option as VsOption, options as v import { parseMainProcessArgv } from "vs/platform/environment/node/argvHelper"; import pkg from "vs/platform/product/node/package"; import product from "vs/platform/product/node/product"; -import { ipcMain } from "vs/server/src/ipc"; -import { enableCustomMarketplace } from "vs/server/src/marketplace"; -import { MainServer } from "vs/server/src/server"; -import { AuthType, buildAllowedMessage, enumToArray, FormatType, generateCertificate, generatePassword, localRequire, open, unpackExecutables } from "vs/server/src/util"; +import { ipcMain } from "vs/server/src/node/ipc"; +import { enableCustomMarketplace } from "vs/server/src/node/marketplace"; +import { MainServer } from "vs/server/src/node/server"; +import { AuthType, buildAllowedMessage, enumToArray, FormatType, generateCertificate, generatePassword, localRequire, open, unpackExecutables } from "vs/server/src/node/util"; const { logger } = localRequire("@coder/logger/out/index"); setUnexpectedErrorHandler((error) => logger.warn(error.message)); diff --git a/src/connection.ts b/src/node/connection.ts similarity index 96% rename from src/connection.ts rename to src/node/connection.ts index f687e039f..98bebd33f 100644 --- a/src/connection.ts +++ b/src/node/connection.ts @@ -6,9 +6,9 @@ import { ISocket } from "vs/base/parts/ipc/common/ipc.net"; import { NodeSocket } from "vs/base/parts/ipc/node/ipc.net"; import { IEnvironmentService } from "vs/platform/environment/common/environment"; import { ILogService } from "vs/platform/log/common/log"; -import { getNlsConfiguration } from "vs/server/src/nls"; -import { Protocol } from "vs/server/src/protocol"; -import { uriTransformerPath } from "vs/server/src/util"; +import { getNlsConfiguration } from "vs/server/src/node/nls"; +import { Protocol } from "vs/server/src/node/protocol"; +import { uriTransformerPath } from "vs/server/src/node/util"; import { IExtHostReadyMessage } from "vs/workbench/services/extensions/common/extensionHostProtocol"; export abstract class Connection { diff --git a/src/insights.ts b/src/node/insights.ts similarity index 100% rename from src/insights.ts rename to src/node/insights.ts diff --git a/src/ipc.ts b/src/node/ipc.ts similarity index 100% rename from src/ipc.ts rename to src/node/ipc.ts diff --git a/src/marketplace.ts b/src/node/marketplace.ts similarity index 98% rename from src/marketplace.ts rename to src/node/marketplace.ts index b125506e7..9c2abff9e 100644 --- a/src/marketplace.ts +++ b/src/node/marketplace.ts @@ -6,7 +6,7 @@ import { mkdirp } from "vs/base/node/pfs"; import * as vszip from "vs/base/node/zip"; import * as nls from "vs/nls"; import product from "vs/platform/product/node/product"; -import { localRequire } from "vs/server/src/util"; +import { localRequire } from "vs/server/src/node/util"; const tarStream = localRequire("tar-stream/index"); diff --git a/src/nls.ts b/src/node/nls.ts similarity index 100% rename from src/nls.ts rename to src/node/nls.ts diff --git a/src/protocol.ts b/src/node/protocol.ts similarity index 100% rename from src/protocol.ts rename to src/node/protocol.ts diff --git a/src/server.ts b/src/node/server.ts similarity index 97% rename from src/server.ts rename to src/node/server.ts index 139dc64e9..d370f7e99 100644 --- a/src/server.ts +++ b/src/node/server.ts @@ -57,14 +57,15 @@ import { combinedAppender, LogAppender, NullTelemetryService } from "vs/platform import { AppInsightsAppender } from "vs/platform/telemetry/node/appInsightsAppender"; import { resolveCommonProperties } from "vs/platform/telemetry/node/commonProperties"; import { UpdateChannel } from "vs/platform/update/node/updateIpc"; -import { ExtensionEnvironmentChannel, FileProviderChannel } from "vs/server/src/channel"; -import { Connection, ExtensionHostConnection, ManagementConnection } from "vs/server/src/connection"; -import { TelemetryClient } from "vs/server/src/insights"; -import { getLocaleFromConfig, getNlsConfiguration } from "vs/server/src/nls"; -import { Protocol } from "vs/server/src/protocol"; -import { TelemetryChannel } from "vs/server/src/telemetry"; -import { UpdateService } from "vs/server/src/update"; -import { AuthType, getMediaMime, getUriTransformer, localRequire, tmpdir } from "vs/server/src/util"; +import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService } from "vs/server/src/node/channel"; +import { Connection, ExtensionHostConnection, ManagementConnection } from "vs/server/src/node/connection"; +import { TelemetryClient } from "vs/server/src/node/insights"; +import { getLocaleFromConfig, getNlsConfiguration } from "vs/server/src/node/nls"; +import { NodeProxyChannel } from "vs/server/src/common/nodeProxy"; +import { Protocol } from "vs/server/src/node/protocol"; +import { TelemetryChannel } from "vs/server/src/common/telemetry"; +import { UpdateService } from "vs/server/src/node/update"; +import { AuthType, getMediaMime, getUriTransformer, localRequire, tmpdir } from "vs/server/src/node/util"; import { RemoteExtensionLogFileName } from "vs/workbench/services/remote/common/remoteAgentService"; import { IWorkbenchConstructionOptions } from "vs/workbench/workbench.web.api"; @@ -125,7 +126,7 @@ export interface ServerOptions { export abstract class Server { protected readonly server: http.Server | https.Server; - protected rootPath = path.resolve(__dirname, "../../../.."); + protected rootPath = path.resolve(__dirname, "../../../../.."); protected serverRoot = path.join(this.rootPath, "/out/vs/server/src"); protected readonly allowedRequestPaths: string[] = [this.rootPath]; private listenPromise: Promise | undefined; @@ -707,11 +708,13 @@ export class MainServer extends Server { const requestChannel = new RequestChannel(this.services.get(IRequestService) as IRequestService); const telemetryChannel = new TelemetryChannel(telemetryService); const updateChannel = new UpdateChannel(instantiationService.createInstance(UpdateService)); + const nodeProxyChannel = new NodeProxyChannel(instantiationService.createInstance(NodeProxyService)); this.ipc.registerChannel("extensions", extensionsChannel); this.ipc.registerChannel("remoteextensionsenvironment", extensionsEnvironmentChannel); this.ipc.registerChannel("request", requestChannel); this.ipc.registerChannel("telemetry", telemetryChannel); + this.ipc.registerChannel("nodeProxy", nodeProxyChannel); this.ipc.registerChannel("update", updateChannel); this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, fileChannel); resolve(new ErrorTelemetry(telemetryService)); diff --git a/src/update.ts b/src/node/update.ts similarity index 97% rename from src/update.ts rename to src/node/update.ts index 30428edf2..a7fa22b39 100644 --- a/src/update.ts +++ b/src/node/update.ts @@ -15,9 +15,9 @@ import pkg from "vs/platform/product/node/package"; import { asJson, IRequestService } from "vs/platform/request/common/request"; import { AvailableForDownload, State, StateType, UpdateType } from "vs/platform/update/common/update"; import { AbstractUpdateService } from "vs/platform/update/electron-main/abstractUpdateService"; -import { ipcMain } from "vs/server/src/ipc"; -import { extract } from "vs/server/src/marketplace"; -import { tmpdir } from "vs/server/src/util"; +import { ipcMain } from "vs/server/src/node/ipc"; +import { extract } from "vs/server/src/node/marketplace"; +import { tmpdir } from "vs/server/src/node/util"; import * as zlib from "zlib"; interface IUpdate { diff --git a/src/uriTransformer.js b/src/node/uriTransformer.js similarity index 78% rename from src/uriTransformer.js rename to src/node/uriTransformer.js index add1dfc98..1312f5b2e 100644 --- a/src/uriTransformer.js +++ b/src/node/uriTransformer.js @@ -5,20 +5,20 @@ module.exports = (remoteAuthority) => { transformIncoming: (uri) => { switch (uri.scheme) { case "code-server": return { scheme: "file", path: uri.path }; - case "file": return { scheme: "code-server-local", path: uri.path }; + case "file": return { scheme: "code-server", path: uri.path }; default: return uri; } }, transformOutgoing: (uri) => { switch (uri.scheme) { - case "code-server-local": return { scheme: "file", path: uri.path }; + case "code-server": return { scheme: "file", path: uri.path }; case "file": return { scheme: "code-server", authority: remoteAuthority, path: uri.path }; default: return uri; } }, transformOutgoingScheme: (scheme) => { switch (scheme) { - case "code-server-local": return "file"; + case "code-server": return "file"; case "file": return "code-server"; default: return scheme; } diff --git a/src/util.ts b/src/node/util.ts similarity index 97% rename from src/util.ts rename to src/node/util.ts index 10639239d..f4a8cb14a 100644 --- a/src/util.ts +++ b/src/node/util.ts @@ -53,7 +53,7 @@ export const generateCertificate = async (): Promise<{ cert: string, certKey: st return paths; }; -export const uriTransformerPath = getPathFromAmdModule(require, "vs/server/src/uriTransformer"); +export const uriTransformerPath = getPathFromAmdModule(require, "vs/server/src/node/uriTransformer"); export const getUriTransformer = (remoteAuthority: string): URITransformer => { const rawURITransformerFactory = require.__$__nodeRequire(uriTransformerPath); const rawURITransformer = rawURITransformerFactory(remoteAuthority); @@ -135,5 +135,5 @@ export const buildAllowedMessage = (t: any): string => { * at the root for Node modules. */ export const localRequire = (modulePath: string): T => { - return require.__$__nodeRequire(path.resolve(__dirname, "../node_modules", modulePath)); + return require.__$__nodeRequire(path.resolve(__dirname, "../../node_modules", modulePath)); }; diff --git a/yarn.lock b/yarn.lock index 650109f71..84c3215d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@coder/logger@^1.1.11": + version "1.1.11" + resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.11.tgz#e6f36dba9436ae61e66e3f66787d75c768617605" + integrity sha512-EEh1dqSU0AaqjjjMsVqumgZGbrZimKFKIb4t5E6o3FLfVUxJCReSME78Yj2N1xWUVAHMnqafDCxLostpuIotzw== + "@coder/logger@^1.1.8": version "1.1.8" resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee" @@ -18,6 +23,20 @@ node-fetch "^2.3.0" ora "^3.2.0" +"@coder/node-browser@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.0.tgz#f7de3320f5e8020672129250da68236a5f9b4757" + integrity sha512-QdTIYB1ybV+DKr9cm87Gm8Qgspqig1YMtNe7heb7v5Z57JKMYQeQVDtGuCG2RxoSSGzQqqFsJRTp3640BwCQYg== + dependencies: + "@coder/logger" "^1.1.11" + +"@coder/requirefs@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.0.3.tgz#89c256795d2c6c4cd67db013da8b47c65ae32daf" + integrity sha512-qm/SVcQ9MR0fbmwETaVYkoTdNEHhppskjRN44NeJxI92mkWikXrfsVR1jkz64hTLAylIB9LGrjoz0PXEn9LijQ== + optionalDependencies: + jszip "2.6.0" + "@types/node@*", "@types/node@^10.12.12": version "10.14.12" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.12.tgz#0eec3155a46e6c4db1f27c3e588a205f767d622f" @@ -443,6 +462,13 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" @@ -494,6 +520,31 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" +es-abstract@^1.12.0: + version "1.14.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.2.tgz#7ce108fad83068c8783c3cdf62e504e084d8c497" + integrity sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.0" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-inspect "^1.6.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.0.0" + string.prototype.trimright "^2.0.0" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + es6-promisify@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.0.1.tgz#6edaa45f3bd570ffe08febce66f7116be4b1cdb6" @@ -615,6 +666,11 @@ fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -698,6 +754,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -734,6 +795,13 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" +has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + httpolyglot@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/httpolyglot/-/httpolyglot-0.1.2.tgz#e4d347fe8984a62f467d4060df527f1851f6997b" @@ -800,6 +868,11 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-arguments@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" + integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -812,6 +885,11 @@ is-buffer@^1.1.5, is-buffer@~1.1.1: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + is-ci@^1.0.10: version "1.2.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" @@ -833,6 +911,11 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" @@ -880,6 +963,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-generator-function@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.7.tgz#d2132e529bb0000a7f80794d4bdf5cd5e5813522" + integrity sha512-YZc5EwyO4f2kWCax7oegfuSr9mFz1ZvieNYBEjmukLxgXfBUbxAWGVF7GZf0zidYtoBl3WvC07YK0wT76a+Rtw== + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -938,6 +1026,13 @@ is-redirect@^1.0.0: resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^1.0.1" + is-retry-allowed@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" @@ -948,6 +1043,13 @@ is-stream@^1.0.0, is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" + is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -982,6 +1084,13 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jszip@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/jszip/-/jszip-2.6.0.tgz#7fb3e9c2f11c8a9840612db5dabbc8cf3a7534b7" + integrity sha1-f7PpwvEciphAYS212rvIzzp1NLc= + dependencies: + pako "~1.0.0" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -1286,6 +1395,16 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-inspect@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" + integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== + +object-keys@^1.0.12, object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" @@ -1293,6 +1412,16 @@ object-visit@^1.0.0: dependencies: isobject "^3.0.0" +object.entries@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" + integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -1359,6 +1488,11 @@ package-json@^4.0.0: registry-url "^3.0.3" semver "^5.1.0" +pako@~1.0.0: + version "1.0.10" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" + integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== + pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" @@ -1707,6 +1841,22 @@ string-width@^1.0.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string.prototype.trimleft@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -1922,6 +2072,17 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= +util@^0.12.1: + version "0.12.1" + resolved "https://registry.yarnpkg.com/util/-/util-0.12.1.tgz#f908e7b633e7396c764e694dd14e716256ce8ade" + integrity sha512-MREAtYOp+GTt9/+kwf00IYoHZyjM8VU4aVrkzUlejyqaIjd2GztVl5V9hGXKlvBKE3gENn/FMfHE5v6hElXGcQ== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + object.entries "^1.1.0" + safe-buffer "^5.1.2" + wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8"