From 068e399bf2e9d5fb1747cc76b2028746bbb6082c Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 9 Feb 2021 10:40:14 -0600 Subject: [PATCH] Remove Node browser shim We used this to run vscodevim in the browser but it now has a version that is able to run as a VS Code web extension. This does require an update to our marketplace, however. --- docs/CONTRIBUTING.md | 1 - lib/vscode/package.json | 2 - lib/vscode/src/vs/server/browser/client.ts | 29 ---------- .../src/vs/server/browser/extHostNodeProxy.ts | 51 ----------------- .../vs/server/browser/mainThreadNodeProxy.ts | 55 ------------------- lib/vscode/src/vs/server/browser/worker.ts | 48 ---------------- lib/vscode/src/vs/server/common/nodeProxy.ts | 47 ---------------- lib/vscode/src/vs/server/node/channel.ts | 47 +--------------- lib/vscode/src/vs/server/node/server.ts | 10 +--- .../api/browser/extensionHost.contribution.ts | 1 - .../workbench/api/common/extHost.api.impl.ts | 3 - .../workbench/api/common/extHost.protocol.ts | 13 ----- .../api/common/extHostExtensionService.ts | 4 -- .../api/node/extHost.node.services.ts | 3 - .../api/worker/extHost.worker.services.ts | 2 - .../api/worker/extHostExtensionService.ts | 10 +--- .../extensions/browser/extensionService.ts | 4 +- .../extensions/common/extensionsUtil.ts | 3 +- .../worker/extensionHostWorkerMain.ts | 8 --- lib/vscode/yarn.lock | 24 -------- 20 files changed, 6 insertions(+), 359 deletions(-) delete mode 100644 lib/vscode/src/vs/server/browser/extHostNodeProxy.ts delete mode 100644 lib/vscode/src/vs/server/browser/mainThreadNodeProxy.ts delete mode 100644 lib/vscode/src/vs/server/browser/worker.ts delete mode 100644 lib/vscode/src/vs/server/common/nodeProxy.ts diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index ffd6498d..edaaf767 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -144,7 +144,6 @@ Some noteworthy changes in our version of VS Code: - Sending client-side telemetry through the server - Allowing modification of the display language - Making it possible for us to load code on the client -- Making extensions work in the browser - Making it possible to install extensions of any kind - Fixing issue with getting disconnected when your machine sleeps or hibernates - Adding connection type to web socket query parameters diff --git a/lib/vscode/package.json b/lib/vscode/package.json index ba3585b3..d4efccba 100644 --- a/lib/vscode/package.json +++ b/lib/vscode/package.json @@ -50,8 +50,6 @@ "dependencies_comment": "Move rimraf to dependencies because it is used in the postinstall script.", "dependencies": { "@coder/logger": "1.1.16", - "@coder/node-browser": "^1.0.8", - "@coder/requirefs": "^1.1.5", "applicationinsights": "1.0.8", "chokidar": "3.4.3", "graceful-fs": "4.2.3", diff --git a/lib/vscode/src/vs/server/browser/client.ts b/lib/vscode/src/vs/server/browser/client.ts index c4180112..e52bd9e8 100644 --- a/lib/vscode/src/vs/server/browser/client.ts +++ b/lib/vscode/src/vs/server/browser/client.ts @@ -1,4 +1,3 @@ -import { Emitter } from 'vs/base/common/event'; import * as path from 'vs/base/common/path'; import { URI } from 'vs/base/common/uri'; import { localize } from 'vs/nls'; @@ -9,10 +8,8 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza import { ILogService } from 'vs/platform/log/common/log'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { Registry } from 'vs/platform/registry/common/platform'; -import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy'; import { TelemetryChannelClient } from 'vs/server/common/telemetry'; import { Options } from 'vs/server/ipc.d'; import 'vs/workbench/contrib/localizations/browser/localizations.contribution'; @@ -63,33 +60,7 @@ Registry.as(Extensions.Configuration).registerConfigurat } }); -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, - ) { - super(remoteAgentService.getConnection()!.getChannel('nodeProxy')); - remoteAgentService.getConnection()!.onDidStateChange((state) => { - switch (state.type) { - case PersistentConnectionEventType.ConnectionGain: - return this._onUp.fire(); - case PersistentConnectionEventType.ConnectionLost: - return this._onDown.fire(); - case PersistentConnectionEventType.ReconnectionPermanentFailure: - return this._onClose.fire(); - } - }); - } -} - registerSingleton(ILocalizationsService, LocalizationsService); -registerSingleton(INodeProxyService, NodeProxyService); registerSingleton(ITelemetryService, TelemetryService); /** diff --git a/lib/vscode/src/vs/server/browser/extHostNodeProxy.ts b/lib/vscode/src/vs/server/browser/extHostNodeProxy.ts deleted file mode 100644 index 5dd5406b..00000000 --- a/lib/vscode/src/vs/server/browser/extHostNodeProxy.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Emitter } from 'vs/base/common/event'; -import { UriComponents } from 'vs/base/common/uri'; -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); - } - - public async fetchExtension(extensionUri: UriComponents): Promise { - return this.proxy.$fetchExtension(extensionUri).then(b => b.buffer); - } -} - -export interface IExtHostNodeProxy extends ExtHostNodeProxy { } -export const IExtHostNodeProxy = createDecorator('IExtHostNodeProxy'); diff --git a/lib/vscode/src/vs/server/browser/mainThreadNodeProxy.ts b/lib/vscode/src/vs/server/browser/mainThreadNodeProxy.ts deleted file mode 100644 index acabf8c1..00000000 --- a/lib/vscode/src/vs/server/browser/mainThreadNodeProxy.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { VSBuffer } from 'vs/base/common/buffer'; -import { IDisposable } from 'vs/base/common/lifecycle'; -import { FileAccess } from 'vs/base/common/network'; -import { URI, UriComponents } from 'vs/base/common/uri'; -import { INodeProxyService } from 'vs/server/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); - } - } - - async $fetchExtension(extensionUri: UriComponents): Promise { - const fetchUri = URI.from({ - scheme: window.location.protocol.replace(':', ''), - authority: window.location.host, - // Use FileAccess to get the static base path. - path: FileAccess.asBrowserUri('', require).path, - query: `tar=${encodeURIComponent(extensionUri.path)}`, - }); - const response = await fetch(fetchUri.toString(true)); - if (response.status !== 200) { - throw new Error(`Failed to download extension "${module}"`); - } - return VSBuffer.wrap(new Uint8Array(await response.arrayBuffer())); - } - - dispose(): void { - this.disposables.forEach((d) => d.dispose()); - this.disposables = []; - this.disposed = true; - } -} diff --git a/lib/vscode/src/vs/server/browser/worker.ts b/lib/vscode/src/vs/server/browser/worker.ts deleted file mode 100644 index 1d47ede4..00000000 --- a/lib/vscode/src/vs/server/browser/worker.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Client } from '@coder/node-browser'; -import { fromTar } from '@coder/requirefs'; -import { URI } from 'vs/base/common/uri'; -import { ILogService } from 'vs/platform/log/common/log'; -import { ExtensionActivationTimesBuilder } from 'vs/workbench/api/common/extHostExtensionActivator'; -import { IExtHostNodeProxy } from './extHostNodeProxy'; - -export const loadCommonJSModule = async ( - module: URI, - activationTimesBuilder: ExtensionActivationTimesBuilder, - nodeProxy: IExtHostNodeProxy, - logService: ILogService, - vscode: any, -): Promise => { - const client = new Client(nodeProxy, { logger: logService }); - const [buffer, init] = await Promise.all([ - nodeProxy.fetchExtension(module), - client.handshake(), - ]); - const rfs = fromTar(buffer); - (self).global = self; - rfs.provide('vscode', vscode); - 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; - } - }); - - try { - activationTimesBuilder.codeLoadingStart(); - return rfs.require('.'); - } finally { - activationTimesBuilder.codeLoadingStop(); - } -}; diff --git a/lib/vscode/src/vs/server/common/nodeProxy.ts b/lib/vscode/src/vs/server/common/nodeProxy.ts deleted file mode 100644 index 14b9de87..00000000 --- a/lib/vscode/src/vs/server/common/nodeProxy.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { ReadWriteConnection } from '@coder/node-browser'; -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'; - -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/lib/vscode/src/vs/server/node/channel.ts b/lib/vscode/src/vs/server/node/channel.ts index a6c1f9f8..541647a1 100644 --- a/lib/vscode/src/vs/server/node/channel.ts +++ b/lib/vscode/src/vs/server/node/channel.ts @@ -1,5 +1,4 @@ import { field, logger } from '@coder/logger'; -import { Server } from '@coder/node-browser'; import * as os from 'os'; import * as path from 'path'; import { VSBuffer } from 'vs/base/common/buffer'; @@ -21,7 +20,6 @@ import { ILogService } from 'vs/platform/log/common/log'; import product from 'vs/platform/product/common/product'; import { IRemoteAgentEnvironment, RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment'; import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { INodeProxyService } from 'vs/server/common/nodeProxy'; import { getTranslations } from 'vs/server/node/nls'; import { getUriTransformer } from 'vs/server/node/util'; import { IFileChangeDto } from 'vs/workbench/api/common/extHost.protocol'; @@ -305,14 +303,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel { const newPath = extension.extensionLocation.fsPath; this.log.warn(`${oldPath} has been overridden ${newPath}`); } - uniqueExtensions.set(id, { - ...extension, - // Force extensions that should run on the client due to latency - // issues. - extensionKind: extension.identifier.value === 'vscodevim.vim' - ? [ 'web' ] - : extension.extensionKind, - }); + uniqueExtensions.set(id, extension) }); }); }); @@ -337,42 +328,6 @@ export class ExtensionEnvironmentChannel implements IServerChannel { } } -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; - public readonly _onDown = new Emitter(); - public readonly onDown = this._onDown.event; - public readonly _onUp = new Emitter(); - public readonly onUp = this._onUp.event; - - // Unused because the server connection will never permanently close. - private readonly _onClose = new Emitter(); - public readonly onClose = this._onClose.event; - - public constructor() { - // TODO: 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); - } -} - class VariableResolverService extends AbstractVariableResolverService { constructor( remoteAuthority: string, diff --git a/lib/vscode/src/vs/server/node/server.ts b/lib/vscode/src/vs/server/node/server.ts index 0f4d31a9..e048f38a 100644 --- a/lib/vscode/src/vs/server/node/server.ts +++ b/lib/vscode/src/vs/server/node/server.ts @@ -45,10 +45,9 @@ import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService' import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender'; import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties'; -import { INodeProxyService, NodeProxyChannel } from 'vs/server/common/nodeProxy'; import { TelemetryChannel } from 'vs/server/common/telemetry'; import { Query, VscodeOptions, WorkbenchOptions } from 'vs/server/ipc'; -import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService, TerminalProviderChannel } from 'vs/server/node/channel'; +import { ExtensionEnvironmentChannel, FileProviderChannel, TerminalProviderChannel } from 'vs/server/node/channel'; import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection'; import { TelemetryClient } from 'vs/server/node/insights'; import { logger } from 'vs/server/node/logger'; @@ -180,11 +179,6 @@ export class Vscode { this._onDidClientConnect.fire({ protocol, onDidClientDisconnect: connection.onClose, }); - // TODO: Need a way to match clients with a connection. For now - // dispose everything which only works because no extensions currently - // utilize long-running proxies. - (this.services.get(INodeProxyService) as NodeProxyService)._onUp.fire(); - connection.onClose(() => (this.services.get(INodeProxyService) as NodeProxyService)._onDown.fire()); } else { const buffer = protocol.readEntireBuffer(); connection = new ExtensionHostConnection( @@ -279,7 +273,6 @@ export class Vscode { this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService)); this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService)); this.services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService)); - this.services.set(INodeProxyService, new SyncDescriptor(NodeProxyService)); this.ipc.registerChannel('extensions', new ExtensionManagementChannel( accessor.get(IExtensionManagementService), @@ -290,7 +283,6 @@ export class Vscode { )); this.ipc.registerChannel('request', new RequestChannel(accessor.get(IRequestService))); this.ipc.registerChannel('telemetry', new TelemetryChannel(telemetryService)); - this.ipc.registerChannel('nodeProxy', new NodeProxyChannel(accessor.get(INodeProxyService))); this.ipc.registerChannel('localizations', >createChannelReceiver(accessor.get(ILocalizationsService))); this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService)); this.ipc.registerChannel(REMOTE_TERMINAL_CHANNEL_NAME, new TerminalProviderChannel(logService)); diff --git a/lib/vscode/src/vs/workbench/api/browser/extensionHost.contribution.ts b/lib/vscode/src/vs/workbench/api/browser/extensionHost.contribution.ts index e9bd0096..3b4c8a66 100644 --- a/lib/vscode/src/vs/workbench/api/browser/extensionHost.contribution.ts +++ b/lib/vscode/src/vs/workbench/api/browser/extensionHost.contribution.ts @@ -61,7 +61,6 @@ import './mainThreadComments'; import './mainThreadNotebook'; import './mainThreadTask'; import './mainThreadLabelService'; -import 'vs/server/browser/mainThreadNodeProxy'; import './mainThreadTunnelService'; import './mainThreadAuthentication'; import './mainThreadTimeline'; diff --git a/lib/vscode/src/vs/workbench/api/common/extHost.api.impl.ts b/lib/vscode/src/vs/workbench/api/common/extHost.api.impl.ts index b4d33094..fa880fcf 100644 --- a/lib/vscode/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/lib/vscode/src/vs/workbench/api/common/extHost.api.impl.ts @@ -68,7 +68,6 @@ import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransf import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService'; import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook'; -import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; import { ExtHostTheming } from 'vs/workbench/api/common/extHostTheming'; import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService'; @@ -105,7 +104,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I const extHostStorage = accessor.get(IExtHostStorage); const extensionStoragePaths = accessor.get(IExtensionStoragePaths); const extHostLogService = accessor.get(ILogService); - const extHostNodeProxy = accessor.get(IExtHostNodeProxy); const extHostTunnelService = accessor.get(IExtHostTunnelService); const extHostApiDeprecation = accessor.get(IExtHostApiDeprecationService); const extHostWindow = accessor.get(IExtHostWindow); @@ -117,7 +115,6 @@ 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); rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService); rpcProtocol.set(ExtHostContext.ExtHostWindow, extHostWindow); diff --git a/lib/vscode/src/vs/workbench/api/common/extHost.protocol.ts b/lib/vscode/src/vs/workbench/api/common/extHost.protocol.ts index a1d5d6b9..b97a962f 100644 --- a/lib/vscode/src/vs/workbench/api/common/extHost.protocol.ts +++ b/lib/vscode/src/vs/workbench/api/common/extHost.protocol.ts @@ -824,17 +824,6 @@ export interface MainThreadLabelServiceShape extends IDisposable { $unregisterResourceLabelFormatter(handle: number): void; } -export interface MainThreadNodeProxyShape extends IDisposable { - $send(message: string): void; - $fetchExtension(extensionUri: UriComponents): Promise; -} -export interface ExtHostNodeProxyShape { - $onMessage(message: string): void; - $onClose(): void; - $onDown(): void; - $onUp(): void; -} - export interface MainThreadSearchShape extends IDisposable { $registerFileSearchProvider(handle: number, scheme: string): void; $registerTextSearchProvider(handle: number, scheme: string): void; @@ -1838,7 +1827,6 @@ export const MainContext = { MainThreadWindow: createMainId('MainThreadWindow'), MainThreadLabelService: createMainId('MainThreadLabelService'), MainThreadNotebook: createMainId('MainThreadNotebook'), - MainThreadNodeProxy: createMainId('MainThreadNodeProxy'), MainThreadTheming: createMainId('MainThreadTheming'), MainThreadTunnelService: createMainId('MainThreadTunnelService'), MainThreadTimeline: createMainId('MainThreadTimeline'), @@ -1882,7 +1870,6 @@ export const ExtHostContext = { ExtHostOutputService: createMainId('ExtHostOutputService'), ExtHosLabelService: createMainId('ExtHostLabelService'), ExtHostNotebook: createMainId('ExtHostNotebook'), - ExtHostNodeProxy: createMainId('ExtHostNodeProxy'), ExtHostTheming: createMainId('ExtHostTheming'), ExtHostTunnelService: createMainId('ExtHostTunnelService'), ExtHostAuthentication: createMainId('ExtHostAuthentication'), diff --git a/lib/vscode/src/vs/workbench/api/common/extHostExtensionService.ts b/lib/vscode/src/vs/workbench/api/common/extHostExtensionService.ts index 38963843..6c1a942a 100644 --- a/lib/vscode/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/lib/vscode/src/vs/workbench/api/common/extHostExtensionService.ts @@ -31,7 +31,6 @@ 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/browser/extHostNodeProxy'; import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService'; import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService'; import { Emitter, Event } from 'vs/base/common/event'; @@ -83,7 +82,6 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme protected readonly _extHostWorkspace: ExtHostWorkspace; protected readonly _extHostConfiguration: ExtHostConfiguration; protected readonly _logService: ILogService; - protected readonly _nodeProxy: IExtHostNodeProxy; protected readonly _extHostTunnelService: IExtHostTunnelService; protected readonly _extHostTerminalService: IExtHostTerminalService; @@ -116,7 +114,6 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme @ILogService logService: ILogService, @IExtHostInitDataService initData: IExtHostInitDataService, @IExtensionStoragePaths storagePath: IExtensionStoragePaths, - @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy, @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService, @IExtHostTerminalService extHostTerminalService: IExtHostTerminalService ) { @@ -128,7 +125,6 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme this._extHostWorkspace = extHostWorkspace; this._extHostConfiguration = extHostConfiguration; this._logService = logService; - this._nodeProxy = nodeProxy; this._extHostTunnelService = extHostTunnelService; this._extHostTerminalService = extHostTerminalService; this._disposables = new DisposableStore(); diff --git a/lib/vscode/src/vs/workbench/api/node/extHost.node.services.ts b/lib/vscode/src/vs/workbench/api/node/extHost.node.services.ts index e21abe4e..b3c89e51 100644 --- a/lib/vscode/src/vs/workbench/api/node/extHost.node.services.ts +++ b/lib/vscode/src/vs/workbench/api/node/extHost.node.services.ts @@ -3,8 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; -import { NotImplementedProxy } from 'vs/base/common/types'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ExtHostOutputService2 } from 'vs/workbench/api/node/extHostOutputService'; import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService'; @@ -38,4 +36,3 @@ registerSingleton(IExtHostSearch, NativeExtHostSearch); registerSingleton(IExtHostTask, ExtHostTask); registerSingleton(IExtHostTerminalService, ExtHostTerminalService); registerSingleton(IExtHostTunnelService, ExtHostTunnelService); -registerSingleton(IExtHostNodeProxy, class extends NotImplementedProxy(String(IExtHostNodeProxy)) { whenReady = Promise.resolve(); }); diff --git a/lib/vscode/src/vs/workbench/api/worker/extHost.worker.services.ts b/lib/vscode/src/vs/workbench/api/worker/extHost.worker.services.ts index 8aac4df5..3843fdec 100644 --- a/lib/vscode/src/vs/workbench/api/worker/extHost.worker.services.ts +++ b/lib/vscode/src/vs/workbench/api/worker/extHost.worker.services.ts @@ -8,7 +8,6 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService'; import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensionService'; import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService'; -import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/browser/extHostNodeProxy'; // ######################################################################### // ### ### @@ -18,4 +17,3 @@ import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/browser/extHostNo registerSingleton(IExtHostExtensionService, ExtHostExtensionService); registerSingleton(ILogService, ExtHostLogService); -registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy); diff --git a/lib/vscode/src/vs/workbench/api/worker/extHostExtensionService.ts b/lib/vscode/src/vs/workbench/api/worker/extHostExtensionService.ts index 4474a93b..021af6e0 100644 --- a/lib/vscode/src/vs/workbench/api/worker/extHostExtensionService.ts +++ b/lib/vscode/src/vs/workbench/api/worker/extHostExtensionService.ts @@ -11,7 +11,6 @@ import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterc import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { ExtensionRuntime } from 'vs/workbench/api/common/extHostTypes'; import { timeout } from 'vs/base/common/async'; -import { loadCommonJSModule } from 'vs/server/browser/worker'; class WorkerRequireInterceptor extends RequireInterceptor { @@ -47,15 +46,10 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService { } protected _getEntryPoint(extensionDescription: IExtensionDescription): string | undefined { - // NOTE@coder: We can support regular Node modules as well. These will just - // require the root of the extension. - return extensionDescription.browser || '.'; + return extensionDescription.browser; } - protected async _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise { - if (isRemote) { - return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules!.getModule('vscode', module)); - } + protected async _loadCommonJSModule(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise { module = module.with({ path: ensureSuffix(module.path, '.js') }); const response = await fetch(module.toString(true)); diff --git a/lib/vscode/src/vs/workbench/services/extensions/browser/extensionService.ts b/lib/vscode/src/vs/workbench/services/extensions/browser/extensionService.ts index 3dc63d0e..e0346952 100644 --- a/lib/vscode/src/vs/workbench/services/extensions/browser/extensionService.ts +++ b/lib/vscode/src/vs/workbench/services/extensions/browser/extensionService.ts @@ -178,10 +178,8 @@ export class ExtensionService extends AbstractExtensionService implements IExten this._remoteAgentService.getEnvironment(), this._remoteAgentService.scanExtensions() ]); + localExtensions = this._checkEnabledAndProposedAPI(localExtensions); remoteExtensions = this._checkEnabledAndProposedAPI(remoteExtensions); - // NOTE@coder: Include remotely hosted extensions that should run locally. - localExtensions = this._checkEnabledAndProposedAPI(localExtensions) - .concat(remoteExtensions.filter(ext => !ext.browser && ext.extensionKind && (ext.extensionKind === 'web' || ext.extensionKind.includes('web')))); const remoteAgentConnection = this._remoteAgentService.getConnection(); this._runningLocation = this._runningLocationClassifier.determineRunningLocation(localExtensions, remoteExtensions); diff --git a/lib/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/lib/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.ts index 0b6282fd..65e532ee 100644 --- a/lib/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.ts +++ b/lib/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.ts @@ -37,8 +37,7 @@ export function canExecuteOnWorkspace(manifest: IExtensionManifest, productServi export function canExecuteOnWeb(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean { const extensionKind = getExtensionKind(manifest, productService, configurationService); - // NOTE@coder: Hardcode vim for now. - return extensionKind.some(kind => kind === 'web') || manifest.name === 'vim'; + return extensionKind.some(kind => kind === 'web'); } export function getExtensionKind(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): ExtensionKind[] { diff --git a/lib/vscode/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts b/lib/vscode/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts index fee5fc5c..f5c55522 100644 --- a/lib/vscode/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts +++ b/lib/vscode/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts @@ -21,15 +21,7 @@ require.config({ baseUrl: monacoBaseUrl, catchError: true, -<<<<<<< HEAD - createTrustedScriptURL: (value: string) => value, - paths: { - '@coder/node-browser': `../node_modules/@coder/node-browser/out/client/client.js`, - '@coder/requirefs': `../node_modules/@coder/requirefs/out/requirefs.js`, - } -======= trustedTypesPolicy ->>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775 }); require(['vs/workbench/services/extensions/worker/extensionHostWorker'], () => { }, err => console.error(err)); diff --git a/lib/vscode/yarn.lock b/lib/vscode/yarn.lock index e5931964..e998cf9b 100644 --- a/lib/vscode/yarn.lock +++ b/lib/vscode/yarn.lock @@ -145,18 +145,6 @@ resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.16.tgz#ee5b1b188f680733f35c11b065bbd139d618c1e1" integrity sha512-X6VB1++IkosYY6amRAiMvuvCf12NA4+ooX+gOuu5bJIkdjmh4Lz7QpJcWRdgxesvo1msriDDr9E/sDbIWf6vsQ== -"@coder/node-browser@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.8.tgz#c22f581b089ad7d95ad1362fd351c57b7fbc6e70" - integrity sha512-NLF9sYMRCN9WK1C224pHax1Cay3qKypg25BhVg7VfNbo3Cpa3daata8RF/rT8JK3lPsu8PmFgDRQjzGC9X1Lrw== - -"@coder/requirefs@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.1.5.tgz#259db370d563a79a96fb150bc9d69c7db6edc9fb" - integrity sha512-3jB47OFCql9+9FI6Vc4YX0cfFnG5rxBfrZUH45S4XYtYGOz+/Xl4h4d2iMk50b7veHkeSWGlB4VHC3UZ16zuYQ== - optionalDependencies: - jszip "2.6.0" - "@istanbuljs/schema@^0.1.2": version "0.1.2" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" @@ -5357,13 +5345,6 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -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" - just-debounce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" @@ -6677,11 +6658,6 @@ pac-resolver@^4.1.0: ip "^1.1.5" netmask "^1.0.6" -pako@~1.0.0: - version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" - integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== - pako@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"