Resolve bundling issues with node-browser

This commit is contained in:
Asher 2019-10-10 15:17:45 -05:00
parent ea9c511db8
commit 1c50b5285e
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
4 changed files with 16 additions and 16 deletions

View File

@ -27,8 +27,8 @@
}, },
"dependencies": { "dependencies": {
"@coder/logger": "^1.1.8", "@coder/logger": "^1.1.8",
"@coder/node-browser": "^1.0.1", "@coder/node-browser": "^1.0.5",
"@coder/requirefs": "^1.0.5", "@coder/requirefs": "^1.0.6",
"httpolyglot": "^0.1.2", "httpolyglot": "^0.1.2",
"pem": "^1.14.2", "pem": "^1.14.2",
"safe-compare": "^1.1.4", "safe-compare": "^1.1.4",

View File

@ -722,7 +722,7 @@ index 8e96e6738e..5a3a48101a 100644
throw new Error(`Cannot load URI: '${module}', must be of file-scheme`); 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 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 --- a/src/vs/workbench/api/worker/extHostExtensionService.ts
+++ b/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'; @@ -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 { joinPath } from 'vs/base/common/resources';
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor'; import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
+import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; +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'; +import { Client } from 'vs/server/node_modules/@coder/node-browser/out/client/client';
class ExportsTrap { class ExportsTrap {
@ -745,7 +745,7 @@ index 4fcb6db76f..840ac56c3b 100644
+ const fetchUri = URI.from({ + const fetchUri = URI.from({
+ scheme: self.location.protocol.replace(':', ''), + scheme: self.location.protocol.replace(':', ''),
+ authority: self.location.host, + 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)}`, + query: `path=${encodeURIComponent(module.extensionLocation.path)}`,
+ }); + });
+ const response = await fetch(fetchUri.toString(true)); + const response = await fetch(fetchUri.toString(true));

View File

@ -18,9 +18,8 @@ import { IRemoteAgentEnvironment } from "vs/platform/remote/common/remoteAgentEn
import { ITelemetryService } from "vs/platform/telemetry/common/telemetry"; import { ITelemetryService } from "vs/platform/telemetry/common/telemetry";
import { INodeProxyService } from "vs/server/src/common/nodeProxy"; import { INodeProxyService } from "vs/server/src/common/nodeProxy";
import { getTranslations } from "vs/server/src/node/nls"; 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 { 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. * Extend the file provider to allow unwatching.
@ -280,7 +279,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
export class NodeProxyService implements INodeProxyService { export class NodeProxyService implements INodeProxyService {
public _serviceBrand = undefined; public _serviceBrand = undefined;
public readonly server: Server; public readonly server: import("@coder/node-browser/out/server/server").Server;
private readonly _onMessage = new Emitter<string>(); private readonly _onMessage = new Emitter<string>();
public readonly onMessage = this._onMessage.event; public readonly onMessage = this._onMessage.event;
@ -295,6 +294,7 @@ export class NodeProxyService implements INodeProxyService {
public constructor() { public constructor() {
// TODO: close/down/up // TODO: close/down/up
const { Server } = localRequire<typeof import("@coder/node-browser/out/server/server")>("@coder/node-browser/out/server/server");
this.server = new Server({ this.server = new Server({
onMessage: this.$onMessage, onMessage: this.$onMessage,
onClose: this.onClose, onClose: this.onClose,

View File

@ -18,15 +18,15 @@
node-fetch "^2.3.0" node-fetch "^2.3.0"
ora "^3.2.0" ora "^3.2.0"
"@coder/node-browser@^1.0.1": "@coder/node-browser@^1.0.5":
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":
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/@coder/requirefs/-/requirefs-1.0.5.tgz#60b0b410f33527594ab35b40d6184ced6c1c5a58" resolved "https://registry.yarnpkg.com/@coder/node-browser/-/node-browser-1.0.5.tgz#58275041cbe11808574260bb2f41db3965388f88"
integrity sha512-GstGO+1HFdN39MpZbdh85NUMHhHu5kUcpKyQ7+j3oA6J5uW5ZUhRXDmwMuxGi8XjZ6z8hnqIhcl2/OF5T+1GhQ== 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: optionalDependencies:
jszip "2.6.0" jszip "2.6.0"