From 1c50b5285e8c3dfc19b8a105de9e78db632ad18b Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 10 Oct 2019 15:17:45 -0500 Subject: [PATCH] Resolve bundling issues with node-browser --- package.json | 4 ++-- scripts/vscode.patch | 6 +++--- src/node/channel.ts | 6 +++--- yarn.lock | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 52ddbadc..0bc729b6 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ }, "dependencies": { "@coder/logger": "^1.1.8", - "@coder/node-browser": "^1.0.1", - "@coder/requirefs": "^1.0.5", + "@coder/node-browser": "^1.0.5", + "@coder/requirefs": "^1.0.6", "httpolyglot": "^0.1.2", "pem": "^1.14.2", "safe-compare": "^1.1.4", diff --git a/scripts/vscode.patch b/scripts/vscode.patch index 511f4e88..43c9c0da 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -722,7 +722,7 @@ index 8e96e6738e..5a3a48101a 100644 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 +index 4fcb6db76f..b6c92528f4 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'; @@ -730,7 +730,7 @@ index 4fcb6db76f..840ac56c3b 100644 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 { fromTar } from 'vs/server/node_modules/@coder/requirefs/out/requirefs'; +import { Client } from 'vs/server/node_modules/@coder/node-browser/out/client/client'; class ExportsTrap { @@ -745,7 +745,7 @@ index 4fcb6db76f..840ac56c3b 100644 + 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`, ++ 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)); diff --git a/src/node/channel.ts b/src/node/channel.ts index f2554f44..e3d833a9 100644 --- a/src/node/channel.ts +++ b/src/node/channel.ts @@ -18,9 +18,8 @@ import { IRemoteAgentEnvironment } from "vs/platform/remote/common/remoteAgentEn import { ITelemetryService } from "vs/platform/telemetry/common/telemetry"; 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 { getUriTransformer, localRequire } 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. @@ -280,7 +279,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel { export class NodeProxyService implements INodeProxyService { public _serviceBrand = undefined; - public readonly server: Server; + public readonly server: import("@coder/node-browser/out/server/server").Server; private readonly _onMessage = new Emitter(); public readonly onMessage = this._onMessage.event; @@ -295,6 +294,7 @@ export class NodeProxyService implements INodeProxyService { public constructor() { // TODO: close/down/up + const { Server } = localRequire("@coder/node-browser/out/server/server"); this.server = new Server({ onMessage: this.$onMessage, onClose: this.onClose, diff --git a/yarn.lock b/yarn.lock index 2bf87f03..94d15d7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,15 +18,15 @@ node-fetch "^2.3.0" ora "^3.2.0" -"@coder/node-browser@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.1.tgz#0b3d685f042052cfadb9a8f5d3bd88a0080985ba" - integrity sha512-lbDxT6AdEkHEleIzZBL5zncyrPikLG8klgE75ZTw8z4xYRRO3eYoNFt6rM9CgwbjBLxf20xQ8YjmkWNVzCPeBQ== - -"@coder/requirefs@^1.0.5": +"@coder/node-browser@^1.0.5": version "1.0.5" - resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.0.5.tgz#60b0b410f33527594ab35b40d6184ced6c1c5a58" - integrity sha512-GstGO+1HFdN39MpZbdh85NUMHhHu5kUcpKyQ7+j3oA6J5uW5ZUhRXDmwMuxGi8XjZ6z8hnqIhcl2/OF5T+1GhQ== + resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.5.tgz#58275041cbe11808574260bb2f41db3965388f88" + integrity sha512-9iN6RqJCErlp30Da/PJBGf8YT9phSTCtCgoufDQqSkSMmnV+Oho4nkFKPKB3jVb9RG5lqgi7oJpNMSXPluvlyw== + +"@coder/requirefs@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.0.6.tgz#d2d9b529d55e00da5b779aba0ac37c534a9fe55c" + integrity sha512-AEHfWXXJV1FGB0CjTVz+BhyS9G5xUlC0L1+/jDgGE9CuKK2obZzg3xdALFXadZhcpQGa2vXFEmrtkkW2xP6X2A== optionalDependencies: jszip "2.6.0"