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.
This commit is contained in:
Asher
2021-02-09 10:40:14 -06:00
parent a65231808a
commit 068e399bf2
20 changed files with 6 additions and 359 deletions

View File

@@ -61,7 +61,6 @@ import './mainThreadComments';
import './mainThreadNotebook';
import './mainThreadTask';
import './mainThreadLabelService';
import 'vs/server/browser/mainThreadNodeProxy';
import './mainThreadTunnelService';
import './mainThreadAuthentication';
import './mainThreadTimeline';

View File

@@ -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);

View File

@@ -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<VSBuffer>;
}
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<MainThreadWindowShape>('MainThreadWindow'),
MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService'),
MainThreadNotebook: createMainId<MainThreadNotebookShape>('MainThreadNotebook'),
MainThreadNodeProxy: createMainId<MainThreadNodeProxyShape>('MainThreadNodeProxy'),
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline'),
@@ -1882,7 +1870,6 @@ export const ExtHostContext = {
ExtHostOutputService: createMainId<ExtHostOutputServiceShape>('ExtHostOutputService'),
ExtHosLabelService: createMainId<ExtHostLabelServiceShape>('ExtHostLabelService'),
ExtHostNotebook: createMainId<ExtHostNotebookShape>('ExtHostNotebook'),
ExtHostNodeProxy: createMainId<ExtHostNodeProxyShape>('ExtHostNodeProxy'),
ExtHostTheming: createMainId<ExtHostThemingShape>('ExtHostTheming'),
ExtHostTunnelService: createMainId<ExtHostTunnelServiceShape>('ExtHostTunnelService'),
ExtHostAuthentication: createMainId<ExtHostAuthenticationShape>('ExtHostAuthentication'),

View File

@@ -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();

View File

@@ -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<IExtHostNodeProxy>(String(IExtHostNodeProxy)) { whenReady = Promise.resolve(); });

View File

@@ -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);

View File

@@ -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<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder, isRemote?: boolean): Promise<T> {
if (isRemote) {
return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules!.getModule('vscode', module));
}
protected async _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
module = module.with({ path: ensureSuffix(module.path, '.js') });
const response = await fetch(module.toString(true));

View File

@@ -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);

View File

@@ -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[] {

View File

@@ -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));