diff --git a/discojs/discojs-core/package.json b/discojs/discojs-core/package.json index a96df3aa0..7e3ecf1ff 100644 --- a/discojs/discojs-core/package.json +++ b/discojs/discojs-core/package.json @@ -29,7 +29,6 @@ "msgpack-lite": "0.1", "simple-peer": "9", "tslib": "2", - "url": "0.11", "ws": "8" }, "devDependencies": { diff --git a/discojs/discojs-core/src/client/base.ts b/discojs/discojs-core/src/client/base.ts index a0bed010d..40db0d18c 100644 --- a/discojs/discojs-core/src/client/base.ts +++ b/discojs/discojs-core/src/client/base.ts @@ -1,5 +1,5 @@ -import { Set } from 'immutable' import axios from 'axios' +import { Set } from 'immutable' import { tf, Task, TrainingInformant, serialization, WeightsContainer } from '..' import { NodeID } from './types' diff --git a/discojs/discojs-core/src/client/decentralized/base.ts b/discojs/discojs-core/src/client/decentralized/base.ts index 4d71146d6..fa588e241 100644 --- a/discojs/discojs-core/src/client/decentralized/base.ts +++ b/discojs/discojs-core/src/client/decentralized/base.ts @@ -1,5 +1,4 @@ import { Map, Set } from 'immutable' -import * as nodeUrl from 'url' import { TrainingInformant, WeightsContainer, serialization } from '../..' import { Client, NodeID } from '..' @@ -96,7 +95,6 @@ export class Base extends Client { } async connect (): Promise { - const URL = typeof window !== 'undefined' ? window.URL : nodeUrl.URL const serverURL = new URL('', this.url.href) switch (this.url.protocol) { case 'http:': diff --git a/discojs/discojs-core/src/client/event_connection.ts b/discojs/discojs-core/src/client/event_connection.ts index 56d622453..c258a4532 100644 --- a/discojs/discojs-core/src/client/event_connection.ts +++ b/discojs/discojs-core/src/client/event_connection.ts @@ -109,7 +109,7 @@ export class WebSocketServer implements EventConnection { const emitter: EventEmitter = new EventEmitter() const server: WebSocketServer = new WebSocketServer(ws, emitter, validateReceived, validateSent) - ws.onmessage = (event: isomorphic.MessageEvent) => { + ws.onmessage = (event: WebSocket.MessageEvent) => { if (!(event.data instanceof ArrayBuffer)) { throw new Error('server did not send an ArrayBuffer') } @@ -125,7 +125,7 @@ export class WebSocketServer implements EventConnection { } return await new Promise((resolve, reject) => { - ws.onerror = (err: isomorphic.ErrorEvent) => + ws.onerror = (err: WebSocket.ErrorEvent) => reject(new Error(`connecting server: ${err.message}`)) // eslint-disable-line @typescript-eslint/restrict-template-expressions ws.onopen = () => resolve(server) }) diff --git a/discojs/discojs-core/src/client/federated/base.ts b/discojs/discojs-core/src/client/federated/base.ts index 515cbfd0f..1984e5c65 100644 --- a/discojs/discojs-core/src/client/federated/base.ts +++ b/discojs/discojs-core/src/client/federated/base.ts @@ -1,4 +1,3 @@ -import * as nodeUrl from 'url' import { Map } from 'immutable' import { serialization, informant, MetadataKey, MetadataValue, WeightsContainer, TrainingInformant } from '../..' @@ -43,7 +42,6 @@ export class Base extends Client { * for the task. */ async connect (): Promise { - const URL = typeof window !== 'undefined' ? window.URL : nodeUrl.URL const serverURL = new URL('', this.url.href) switch (this.url.protocol) { case 'http:': diff --git a/discojs/discojs-core/src/task/task_handler.ts b/discojs/discojs-core/src/task/task_handler.ts index 8a4dfc043..56d66ed2d 100644 --- a/discojs/discojs-core/src/task/task_handler.ts +++ b/discojs/discojs-core/src/task/task_handler.ts @@ -1,5 +1,5 @@ -import { Map } from 'immutable' import axios from 'axios' +import { Map } from 'immutable' import { serialization, tf, WeightsContainer } from '..' import { isTask, Task, TaskID } from './task' diff --git a/discojs/discojs-web/tsconfig.json b/discojs/discojs-web/tsconfig.json index fec0ec3d5..fcc5151a4 100644 --- a/discojs/discojs-web/tsconfig.json +++ b/discojs/discojs-web/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { + "lib": ["DOM"], "outDir": "dist", "baseUrl": "src" }, diff --git a/discojs/tsconfig.base.json b/discojs/tsconfig.base.json index e2a253b78..53b9a60e0 100644 --- a/discojs/tsconfig.base.json +++ b/discojs/tsconfig.base.json @@ -2,7 +2,7 @@ "compilerOptions": { // TODO ES6 disallow server's test "target": "ES5", - "lib": ["ES5", "DOM"], + "lib": ["ES5"], "strict": true, "noEmitOnError": true,